removed the (too) fancy dsl. Also introduce register indirection
This commit is contained in:
@@ -9,15 +9,23 @@ module Vm
|
||||
@value = value
|
||||
@args = args
|
||||
@function = function
|
||||
raise "oh #{name} " unless value
|
||||
end
|
||||
attr_reader :function , :args , :name , :value
|
||||
|
||||
def load_args into
|
||||
if value.is_a?(IntegerConstant) or value.is_a?(ObjectConstant)
|
||||
function.receiver.load into , value
|
||||
else
|
||||
raise "meta #{name} " if value.is_a? MetaClass
|
||||
function.receiver.move( into, value ) if value.register_symbol != function.receiver.register_symbol
|
||||
end
|
||||
raise "function call '#{name}' has #{args.length} arguments, but function has #{function.args.length}" if args.length != function.args.length
|
||||
args.each_with_index do |arg , index|
|
||||
if arg.is_a?(IntegerConstant) or arg.is_a?(StringConstant)
|
||||
function.args[index].load into , arg
|
||||
else
|
||||
function.args[index].move( into, arg ) if arg.register != function.args[index].register
|
||||
function.args[index].move( into, arg ) if arg.register_symbol != function.args[index].register_symbol
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user