2014-08-26 11:05:49 +02:00
|
|
|
module Register
|
|
|
|
class ReturnImplementation
|
|
|
|
def run block
|
|
|
|
block.codes.dup.each do |code|
|
2014-09-23 18:06:10 +02:00
|
|
|
|
|
|
|
#TODO
|
|
|
|
- move message to new meesage
|
|
|
|
- restore caller message and self / frame
|
2014-08-26 11:05:49 +02:00
|
|
|
next unless code.is_a? Virtual::MethodReturn
|
2014-09-11 18:00:14 +02:00
|
|
|
#load the return address into pc, affecting return. (other cpus have commands for this, but not arm)
|
|
|
|
message = RegisterReference.new(:r0)
|
2014-08-26 15:12:20 +02:00
|
|
|
pc = RegisterReference.new(:pc)
|
2014-09-20 16:06:11 +02:00
|
|
|
move1 = RegisterMachine.instance.ldr( pc ,message , Virtual::Slot::MESSAGE_RETURN_VALUE )
|
2014-09-11 18:00:14 +02:00
|
|
|
block.replace(code , [move1] )
|
2014-08-26 11:05:49 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
Virtual::BootSpace.space.add_pass_after ReturnImplementation , CallImplementation
|
|
|
|
end
|