fix function call and simple call logic

Before creating DynamicJump, the FunctionCall got a register for a
possible jump address. Now that is handled by DynamicJump and
FunctionCall just needs the method, from which it determines the
binaryCode address
This commit is contained in:
Torsten Ruger
2018-05-19 12:21:20 +03:00
parent 15e4533a2f
commit a350325b6b
4 changed files with 17 additions and 25 deletions

View File

@ -4,32 +4,19 @@ module Risc
# assembly takes care of the rest (ie getting the address)
class FunctionCall < Instruction
def initialize( source , method , register)
def initialize( source , method)
super(source)
@method = method
@register = register
end
attr_reader :method , :register
attr_reader :method
def to_s
class_source method.name
end
end
def self.function_call( source , method , register)
Risc::FunctionCall.new( source , method , register)
def self.function_call( source , method )
Risc::FunctionCall.new( source , method )
end
# def self.issue_call( compiler , callee )
# callee_name = callee.name
# return_label = Risc.label("_return_label #{callee_name}" , "#{compiler.type.object_class.name}.#{compiler.method.name}" )
# ret_tmp = compiler.use_reg(:Label)
# compiler.add_load_constant("#{callee_name} load ret", return_label , ret_tmp)
# compiler.add_reg_to_slot("#{callee_name} store ret", ret_tmp , :new_message , :return_address)
# compiler.add_transfer("#{callee_name} move new message", Risc.new_message_reg , Risc.message_reg )
# compiler.add_function_call( "#{callee_name} call" , callee )
# compiler.add_code return_label
# compiler.add_transfer("#{callee_name} remove new message", Risc.message_reg , Risc.new_message_reg )
# compiler.add_slot_to_reg("#{callee_name} restore message" , :new_message , :caller , :message )
# end
end