constant fixes
This commit is contained in:
parent
a00a49ecdb
commit
99b59d920c
@ -10,7 +10,7 @@ module Arm
|
|||||||
def run block
|
def run block
|
||||||
block.codes.dup.each do |code|
|
block.codes.dup.each do |code|
|
||||||
next unless code.is_a? Register::SaveReturn
|
next unless code.is_a? Register::SaveReturn
|
||||||
store = ArmMachine.str( :lr , code.register , code.index )
|
store = ArmMachine.str( :lr , code.register , 4 * code.index )
|
||||||
block.replace(code , store )
|
block.replace(code , store )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -31,19 +31,17 @@ module Register
|
|||||||
end
|
end
|
||||||
# a place to store a reference to the space, we grab the next_frame from the space
|
# a place to store a reference to the space, we grab the next_frame from the space
|
||||||
space_tmp = RegisterReference.tmp_reg
|
space_tmp = RegisterReference.tmp_reg
|
||||||
# a temporary place to store the new frame
|
|
||||||
frame_tmp = space_tmp.next_reg_use
|
|
||||||
# move the spave to it's register (mov instruction gets the address of the object)
|
# move the spave to it's register (mov instruction gets the address of the object)
|
||||||
new_codes = [ LoadConstant.new( Parfait::Space.object_space , space_tmp )]
|
new_codes = [ LoadConstant.new( Parfait::Space.object_space , space_tmp )]
|
||||||
# find index in the space where to grab frame/message
|
# find index in the space where to grab frame/message
|
||||||
ind = Parfait::Space.object_space.get_layout().index_of( kind )
|
ind = Parfait::Space.object_space.get_layout().index_of( kind )
|
||||||
raise "index not found for #{kind}.#{kind.class}" unless ind
|
raise "index not found for #{kind}.#{kind.class}" unless ind
|
||||||
# load the frame/message from space by index
|
# load the frame/message from space by index
|
||||||
new_codes << GetSlot.new( space_tmp , 5 , frame_tmp )
|
new_codes << GetSlot.new( space_tmp , ind , RegisterReference.frame_reg )
|
||||||
# save the frame in real frame register
|
# a temporary place to store the new frame
|
||||||
new_codes << RegisterTransfer.new( frame_tmp , RegisterReference.frame_reg )
|
frame_tmp = space_tmp.next_reg_use
|
||||||
# get the next_frame
|
# get the next_frame
|
||||||
new_codes << GetSlot.new( frame_tmp , 2 , frame_tmp) # 2 index of next_frame
|
new_codes << GetSlot.new( RegisterReference.frame_reg , 2 , frame_tmp) # 2 index of next_frame
|
||||||
# save next frame into space
|
# save next frame into space
|
||||||
new_codes << SetSlot.new( frame_tmp , space_tmp , ind)
|
new_codes << SetSlot.new( frame_tmp , space_tmp , ind)
|
||||||
block.replace(code , new_codes )
|
block.replace(code , new_codes )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user