2014-10-03 14:52:47 +03:00
|
|
|
module Arm
|
2014-08-23 23:37:33 +03:00
|
|
|
# This implements call logic, which is simply like a c call (not send, that involves lookup and all sorts)
|
|
|
|
#
|
2014-08-28 08:10:33 +03:00
|
|
|
# The only target for a call is a CompiledMethod, so we just need to get the address for the code
|
2014-08-23 23:37:33 +03: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 14:33:06 +03:00
|
|
|
next unless code.is_a? Register::FunctionCall
|
2014-10-04 17:34:51 +03:00
|
|
|
call = ArmMachine.call( code.method )
|
2014-08-30 16:57:56 +03:00
|
|
|
block.replace(code , call )
|
2014-08-23 23:37:33 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2014-10-05 01:05:18 +03:00
|
|
|
Virtual::BootSpace.space.add_pass "Arm::CallImplementation"
|
2014-08-23 23:37:33 +03:00
|
|
|
end
|