up to, ut not including, creating frames

This commit is contained in:
Torsten Ruger
2014-09-24 18:25:18 +03:00
parent 363fe5e35f
commit df9d6284ae
7 changed files with 38 additions and 12 deletions

View File

@ -164,6 +164,10 @@ module Register
send("add_#{clazz}".to_sym , object)
end
def add_Message m
end
def add_Frame f
end
def add_Array( array )
# also array has constant overhead, the padded helper fixes it to multiple of 8
array.each do |elem|

View File

@ -4,11 +4,12 @@ module Register
def run block
block.codes.dup.each do |code|
next unless code.is_a? Virtual::MethodEnter
new_codes = []
# save return register and create a new frame
to = RegisterReference.new(:r0) # message base
pc = RegisterReference.new(:pc)
move1 = RegisterMachine.instance.str( pc , to , Virtual::Slot::MESSAGE_RETURN_VALUE )
block.replace(code , [move1] )
# lr is link register, ie where arm stores the return address when call is issued
new_codes << RegisterMachine.instance.str( :lr , Virtual::Slot::MESSAGE_REGISTER , Virtual::Slot::MESSAGE_RETURN_ADDRESS )
new_codes << Virtual::NewFrame.new
block.replace(code , new_codes )
end
end
end