correctly linking frames and messages
This commit is contained in:
@ -34,16 +34,19 @@ module Register
|
||||
# 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 )]
|
||||
# find index in the space where to grab frame/message
|
||||
ind = Parfait::Space.object_space.get_layout().index_of( kind )
|
||||
raise "index not found for #{kind}.#{kind.class}" unless ind
|
||||
space_index = Parfait::Space.object_space.get_layout().index_of( kind )
|
||||
raise "index not found for #{kind}.#{kind.class}" unless space_index
|
||||
# load the frame/message from space by index
|
||||
new_codes << GetSlot.new( space_tmp , ind , RegisterReference.frame_reg )
|
||||
new_codes << GetSlot.new( space_tmp , space_index , RegisterReference.frame_reg )
|
||||
# a temporary place to store the new frame
|
||||
frame_tmp = space_tmp.next_reg_use
|
||||
# get the next_frame
|
||||
new_codes << GetSlot.new( RegisterReference.frame_reg , 2 , frame_tmp) # 2 index of next_frame
|
||||
from = Parfait::Space.object_space.send( kind )
|
||||
kind_index = from.get_layout().index_of( kind )
|
||||
raise "index not found for #{kind}.#{kind.class}" unless kind_index
|
||||
new_codes << GetSlot.new( RegisterReference.frame_reg , kind_index , frame_tmp) # 2 index of next_frame
|
||||
# save next frame into space
|
||||
new_codes << SetSlot.new( frame_tmp , space_tmp , ind)
|
||||
new_codes << SetSlot.new( frame_tmp , space_tmp , space_index)
|
||||
block.replace(code , new_codes )
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user