fix the exit sequence

was returning wrong register (1, not 0)
also saving the message for test, which changes order as the return value destroys the message
This commit is contained in:
Torsten Ruger
2018-06-19 19:52:06 +03:00
parent 5f7683efcf
commit ce79617875
26 changed files with 57 additions and 65 deletions

View File

@ -78,10 +78,10 @@ module Risc
# a sort of inline version of exit method.
# Used by exit and __init__ (so it doesn't have to call it)
def exit_sequence(builder)
r1 = RiscValue.new( :r1 , :Integer )
builder.add_slot_to_reg "get return" , :message , :return_value , r1
builder.reduce_int( "reduce return" , r1)
emit_syscall( builder , :exit )
save_message( builder )
builder.add_slot_to_reg "get return" , :message , :return_value , :message
builder.reduce_int( "reduce return" , :message)
builder.add_code Syscall.new("emit_syscall(exit)", :exit )
end
def exit( context )