From b2339dc33061d1f4b7d45b6754f6aa1e3a39b8d1 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Thu, 30 Aug 2018 16:38:00 +0300 Subject: [PATCH] fix address nil values --- lib/risc/text_writer.rb | 3 ++- test/risc/interpreter/calling/test_minus.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/risc/text_writer.rb b/lib/risc/text_writer.rb index 4602e7af..2ccf0d88 100644 --- a/lib/risc/text_writer.rb +++ b/lib/risc/text_writer.rb @@ -138,7 +138,8 @@ module Risc def write_return_address( addr ) write_ref_for( addr.get_type ) 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 ) log.debug "Integer witten stream 0x#{@stream.length.to_s(16)}" end diff --git a/test/risc/interpreter/calling/test_minus.rb b/test/risc/interpreter/calling/test_minus.rb index a1f6525f..7c164e4a 100644 --- a/test/risc/interpreter/calling/test_minus.rb +++ b/test/risc/interpreter/calling/test_minus.rb @@ -45,7 +45,7 @@ module Risc ret = main_ticks(64) assert_equal FunctionReturn , ret.class 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