fix frame more

This commit is contained in:
Torsten Ruger 2014-09-28 11:18:24 +03:00
parent 5a17bf3396
commit d8710de590
3 changed files with 16 additions and 4 deletions

View File

@ -94,7 +94,7 @@ module Virtual
end
end
@@SPACE = { :names => [:classes,:objects,:symbols,:messages,:frames] ,
@@SPACE = { :names => [:classes,:objects,:symbols,:messages, :next_message , :next_frame] ,
:types => [Virtual::Reference,Virtual::Reference,Virtual::Reference,Virtual::Reference,Virtual::Reference]}
def layout
@@SPACE

View File

@ -26,11 +26,23 @@ module Virtual
space = BootSpace.space
machine = Register::RegisterMachine.instance
slot = Virtual::Slot
# a place to store a reference to the space, we grab the next_frame from the space
space_tmp = Register::RegisterReference.new(Virtual::Message::TMP_REG)
# a temporary place to store the new frame
frame_tmp = space_tmp.next_reg_use
new_codes = [ machine.mov( frame_tmp , space )]
# move the spave to it's register (mov instruction gets the address of the object)
new_codes = [ machine.mov( space_tmp , space )]
# find index in the space wehre to grab frame/message
ind = space.layout[:names].index(kind)
new_codes << machine.ldr( frame_tmp , frame_tmp , ind)
raise "index not found for :#{kind}" unless ind
# load the frame/message from space by index
new_codes << machine.ldr( frame_tmp , space_tmp , 5 )
# save the frame in real frame register
new_codes << machine.mov( Virtual::Message::FRAME_REG , frame_tmp )
# get the next_frame
new_codes << machine.ldr( frame_tmp , frame_tmp , 2 ) # 2 index of next_frame
# save next frame into space
new_codes << machine.str( frame_tmp , space_tmp , ind)
block.replace(code , new_codes )
end
end

View File

@ -8,7 +8,7 @@ module Positioned
end
def set_position pos
# resetting of position used to be error, but since relink and dynamic instruction size it is ok. in measures
if @position != nil and ((@position - pos).abs > 15)
if @position != nil and ((@position - pos).abs > 32)
raise "position set again #{pos}!=#{@position} for #{self}"
end
@position = pos