remove MethodCall and thus all virtual instructions
This commit is contained in:
@ -21,7 +21,7 @@ module Register
|
||||
# And store the space as the new self (so the call can move it back as self)
|
||||
function.source.add_code Register.set_slot( function, space_reg , :new_message , :receiver)
|
||||
# now we are set up to issue a call to the main
|
||||
function.source.add_code Virtual::MethodCall.new(Virtual.machine.space.get_main)
|
||||
Register.issue_call( function , Virtual.machine.space.get_main)
|
||||
emit_syscall( function , :exit )
|
||||
return function
|
||||
end
|
||||
|
@ -13,6 +13,12 @@ module Register
|
||||
def to_s
|
||||
"FunctionCall: #{method.name}"
|
||||
end
|
||||
end
|
||||
|
||||
def self.issue_call caller , callee
|
||||
# move the current new_message to message
|
||||
caller.source.add_code RegisterTransfer.new(caller, Register.new_message_reg , Register.message_reg )
|
||||
# do the register call
|
||||
caller.source.add_code FunctionCall.new( caller , callee )
|
||||
end
|
||||
end
|
||||
|
@ -1,24 +0,0 @@
|
||||
module Register
|
||||
|
||||
# Defines the method call, ie
|
||||
# - move the new_message to message
|
||||
# - unroll self and
|
||||
# - register call
|
||||
|
||||
# all in all, quite the reverse of a return
|
||||
|
||||
class CallImplementation
|
||||
def run block
|
||||
block.codes.dup.each do |code|
|
||||
next unless code.is_a? Virtual::MethodCall
|
||||
new_codes = []
|
||||
# move the current new_message to message
|
||||
new_codes << RegisterTransfer.new(code, Register.new_message_reg , Register.message_reg )
|
||||
# do the register call
|
||||
new_codes << FunctionCall.new( code , code.method )
|
||||
block.replace(code , new_codes )
|
||||
end
|
||||
end
|
||||
end
|
||||
Virtual.machine.add_pass "Register::CallImplementation"
|
||||
end
|
@ -1,7 +1,6 @@
|
||||
require_relative "instruction"
|
||||
require_relative "register_value"
|
||||
require_relative "assembler"
|
||||
require_relative "passes/call_implementation"
|
||||
|
||||
# So the memory model of the machine allows for indexed access into an "object" .
|
||||
# A fixed number of objects exist (ie garbage collection is reclaming, not destroying and
|
||||
|
Reference in New Issue
Block a user