pass return integer back out through exit
for testing of binaries later (and off course general correctness) Some tests were using the fact that the interpreter was used, changed those to return ints rather than strings
This commit is contained in:
@ -71,13 +71,23 @@ module Risc
|
||||
add_code exit_label
|
||||
end
|
||||
compiler.reset_regs
|
||||
emit_syscall( builder , :exit )
|
||||
exit_sequence(builder)
|
||||
return compiler.method
|
||||
end
|
||||
|
||||
# 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 )
|
||||
end
|
||||
|
||||
def exit( context )
|
||||
compiler = compiler_for(:Object,:exit ,{})
|
||||
emit_syscall( compiler.builder(true, compiler.method) , :exit )
|
||||
builder = compiler.builder(true, compiler.method)
|
||||
exit_sequence(builder)
|
||||
return compiler.method
|
||||
end
|
||||
|
||||
|
@ -45,7 +45,8 @@ module Risc
|
||||
builder.reduce_int( source + " fix me", value )
|
||||
builder.reduce_int( source + " fix arg", index )
|
||||
builder.add_reg_to_byte( source , value , me , index)
|
||||
builder.add_reg_to_slot( source , me , :message , :return_value)
|
||||
value = builder.load_int_arg_at(source , 1 )
|
||||
builder.add_reg_to_slot( source , value , :message , :return_value)
|
||||
compiler.add_mom( Mom::ReturnSequence.new)
|
||||
return compiler.method
|
||||
end
|
||||
|
Reference in New Issue
Block a user