fix address nil values

This commit is contained in:
Torsten Ruger 2018-08-30 16:38:00 +03:00
parent dc12c1d70b
commit b2339dc330
2 changed files with 3 additions and 2 deletions

View File

@ -138,7 +138,8 @@ module Risc
def write_return_address( addr ) def write_return_address( addr )
write_ref_for( addr.get_type ) write_ref_for( addr.get_type )
write_ref_for( addr.next_integer ) write_ref_for( addr.next_integer )
write_ref_for( addr.value + @linker.platform.loaded_at ) val = addr.value ? addr.value + @linker.platform.loaded_at : Parfait.object_space.nil_object
write_ref_for( val )
write_ref_for( 0 ) write_ref_for( 0 )
log.debug "Integer witten stream 0x#{@stream.length.to_s(16)}" log.debug "Integer witten stream 0x#{@stream.length.to_s(16)}"
end end

View File

@ -45,7 +45,7 @@ module Risc
ret = main_ticks(64) ret = main_ticks(64)
assert_equal FunctionReturn , ret.class assert_equal FunctionReturn , ret.class
assert_equal :r1 , ret.register.symbol assert_equal :r1 , ret.register.symbol
assert_equal 41992 , @interpreter.get_register(ret.register) assert_equal 50632 , @interpreter.get_register(ret.register)
end end
end end
end end