2014-08-26 12:05:49 +03:00
|
|
|
module Register
|
|
|
|
class ReturnImplementation
|
|
|
|
def run block
|
|
|
|
block.codes.dup.each do |code|
|
|
|
|
next unless code.is_a? Virtual::MethodReturn
|
2014-09-11 19:00:14 +03: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 16:12:20 +03:00
|
|
|
pc = RegisterReference.new(:pc)
|
2014-09-11 21:30:40 +03:00
|
|
|
move1 = RegisterMachine.instance.ldr( pc ,message , Virtual::Slot::RETURN )
|
2014-09-11 19:00:14 +03:00
|
|
|
block.replace(code , [move1] )
|
2014-08-26 12:05:49 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
Virtual::BootSpace.space.add_pass_after ReturnImplementation , CallImplementation
|
|
|
|
end
|