fix most of mom from calling changes

This commit is contained in:
2019-08-22 22:56:44 +03:00
parent 0c49612e5e
commit 017e7e2971
17 changed files with 106 additions and 84 deletions

View File

@ -37,6 +37,7 @@ module Mom
# delegates to SlotLoad for receiver and to the actual args.to_risc
def to_risc(compiler)
transfer = SlotLoad.new(self.source ,[:message , :next_message , :receiver] , @receiver, self).to_risc(compiler)
#TODO transfer the Number of arguments to :arguments_given (to be checked on entry)
compiler.reset_regs
@arguments.each do |arg|
arg.to_risc(compiler)

View File

@ -26,8 +26,7 @@ module Mom
return_address! << return_label
next_message[:return_address] << return_address
block_reg! << message[:arguments]
block_reg << block_reg[index]
block_reg! << message["arg#{index}".to_sym]
message << message[:next_message]
add_code Risc::DynamicJump.new("block_yield", block_reg )

View File

@ -45,8 +45,7 @@ module Mom
end
when Integer
builder.build do
arguments! << message[:arguments]
callable! << arguments[ from ]
callable! << message[ "arg#{from}".to_sym ]
end
else
raise "unknown source #{method_source.class}:#{method_source}"

View File

@ -13,6 +13,7 @@ module Mom
def initialize(left, right , label)
super(label)
raise right.to_s if right.to_s.include?("arguments")
@left , @right = left , right
end