finish the simple call

moving jump address
This commit is contained in:
Torsten Ruger
2018-03-21 19:29:00 +05:30
parent 49880267bb
commit f424e58715
3 changed files with 11 additions and 24 deletions

View File

@ -20,12 +20,13 @@ module Mom
# For returning, we add a label after the call, and load it's address into the
# return_address of the next_message, for the ReturnSequence to pick it up.
def to_risc(compiler)
reg = compiler.use_reg(:int)
jump_address = compiler.use_reg(:int)
return_label = Risc::Label.new(self,"continue")
save_return = SlotLoad.new([:message,:next_message,:return_address],[return_label])
moves = save_return.to_risc(compiler)
moves << Risc.slot_to_reg(self, :message , :next_message , Risc.message_reg)
moves << Risc::FunctionCall.new(self, method ,reg)
moves << Risc.load_constant(self , method.binary , jump_address)
moves << Risc::FunctionCall.new(self, method ,jump_address)
moves << return_label
end