2014-10-03 13:52:47 +02:00
|
|
|
module Arm
|
2014-08-23 22:37:33 +02:00
|
|
|
# This implements call logic, which is simply like a c call (not send, that involves lookup and all sorts)
|
|
|
|
#
|
2014-08-28 07:10:33 +02:00
|
|
|
# The only target for a call is a CompiledMethod, so we just need to get the address for the code
|
2014-08-23 22:37:33 +02:00
|
|
|
# and call it.
|
|
|
|
#
|
|
|
|
# The only slight snag is that we would need to assemble before getting the address, but to assemble
|
|
|
|
# we'd have to have finished compiling. So we need a reference.
|
|
|
|
class CallImplementation
|
|
|
|
def run block
|
|
|
|
block.codes.dup.each do |code|
|
2014-10-03 13:33:06 +02:00
|
|
|
next unless code.is_a? Register::FunctionCall
|
2014-10-04 16:34:51 +02:00
|
|
|
call = ArmMachine.call( code.method )
|
2014-08-30 15:57:56 +02:00
|
|
|
block.replace(code , call )
|
2014-08-23 22:37:33 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2014-10-03 13:52:47 +02:00
|
|
|
Virtual::BootSpace.space.add_pass_after "Arm::CallImplementation" , "Register::SetImplementation"
|
2014-08-23 22:37:33 +02:00
|
|
|
end
|