clean up Get/SetSlot

document and make arguments consistent
This commit is contained in:
Torsten Ruger
2015-06-21 21:00:16 +03:00
parent f3ee11fca5
commit 836089a249
6 changed files with 56 additions and 26 deletions

View File

@ -39,11 +39,11 @@ module Register
ind = Parfait::Space.object_space.get_layout().index_of( kind )
raise "index not found for #{kind}.#{kind.class}" unless ind
# load the frame/message from space by index
new_codes << GetSlot.new( frame_tmp , space_tmp , 5 )
new_codes << GetSlot.new( space_tmp , 5 , frame_tmp )
# save the frame in real frame register
new_codes << RegisterTransfer.new( RegisterReference.frame_reg , frame_tmp )
# get the next_frame
new_codes << GetSlot.new( frame_tmp , frame_tmp , 2 ) # 2 index of next_frame
new_codes << GetSlot.new( frame_tmp , 2 , frame_tmp) # 2 index of next_frame
# save next frame into space
new_codes << SetSlot.new( frame_tmp , space_tmp , ind)
block.replace(code , new_codes )

View File

@ -8,10 +8,10 @@ module Register
# move the current message to new_message
new_codes << RegisterTransfer.new( slot::MESSAGE_REGISTER , slot::NEW_MESSAGE_REGISTER )
# and restore the message from saved value in new_message
new_codes << GetSlot.new( slot::MESSAGE_REGISTER , slot::NEW_MESSAGE_REGISTER , Virtual::MESSAGE_CALLER )
new_codes << GetSlot.new( slot::NEW_MESSAGE_REGISTER , Virtual::MESSAGE_CALLER , slot::MESSAGE_REGISTER)
# "roll out" self and frame into their registers
new_codes << GetSlot.new( slot::SELF_REGISTER ,slot::MESSAGE_REGISTER , Virtual::MESSAGE_SELF )
new_codes << GetSlot.new( slot::FRAME_REGISTER ,slot::MESSAGE_REGISTER , Virtual::MESSAGE_FRAME )
new_codes << GetSlot.new( slot::MESSAGE_REGISTER , Virtual::MESSAGE_SELF , slot::SELF_REGISTER )
new_codes << GetSlot.new( slot::MESSAGE_REGISTER , Virtual::MESSAGE_FRAME , slot::FRAME_REGISTER )
#load the return address into pc, affecting return. (other cpus have commands for this, but not arm)
new_codes << FunctionReturn.new( slot::MESSAGE_REGISTER , Virtual::MESSAGE_RETURN_ADDRESS )
block.replace(code , new_codes )

View File

@ -35,7 +35,7 @@ module Register
if( code.from.is_a?(Parfait::Value) or code.from.is_a?(Symbol))
move1 = LoadConstant.new( tmp , code.from )
else # while otherwise we "load"
move1 = GetSlot.new( tmp , code.from.reg , code.from.index )
move1 = GetSlot.new( code.from.reg , code.from.index , tmp )
end
move2 = SetSlot.new( tmp , to , code.to.index )
block.replace(code , [move1,move2] )