slight call logic modification
simplification, new model is such that the upon start the method: has a message in r0, works on it and returns to the return address. Everything else is up to the caller
This commit is contained in:
parent
f2c7ed827d
commit
5ddc96718b
@ -26,5 +26,9 @@ module Register
|
|||||||
# do the register call
|
# do the register call
|
||||||
compiler.add_code FunctionCall.new( source , callee )
|
compiler.add_code FunctionCall.new( source , callee )
|
||||||
compiler.add_code return_label
|
compiler.add_code return_label
|
||||||
|
# move the current message to new_message
|
||||||
|
compiler.add_code Register::RegisterTransfer.new(source, Register.message_reg , Register.new_message_reg )
|
||||||
|
# and restore the message from saved value in new_message
|
||||||
|
compiler.add_code Register.get_slot(source , :new_message , :caller , :message )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -86,12 +86,8 @@ module Soml
|
|||||||
@method.instructions = Register::Label.new(source, "#{method.for_class.name}.#{method.name}")
|
@method.instructions = Register::Label.new(source, "#{method.for_class.name}.#{method.name}")
|
||||||
@current = enter = method.instructions
|
@current = enter = method.instructions
|
||||||
add_code Register::Label.new( source, "return")
|
add_code Register::Label.new( source, "return")
|
||||||
# move the current message to new_message
|
|
||||||
add_code Register::RegisterTransfer.new(source, Register.message_reg , Register.new_message_reg )
|
|
||||||
# and restore the message from saved value in new_message
|
|
||||||
add_code Register.get_slot("_init_method_",:new_message , :caller , :message )
|
|
||||||
#load the return address into pc, affecting return. (other cpus have commands for this, but not arm)
|
#load the return address into pc, affecting return. (other cpus have commands for this, but not arm)
|
||||||
add_code Register::FunctionReturn.new( source , Register.new_message_reg , Register.resolve_index(:message , :return_address) )
|
add_code Register::FunctionReturn.new( source , Register.message_reg , Register.resolve_index(:message , :return_address) )
|
||||||
@current = enter
|
@current = enter
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user