diff --git a/lib/parfait/block.rb b/lib/parfait/block.rb index 13412e7e..4c2a3a2d 100644 --- a/lib/parfait/block.rb +++ b/lib/parfait/block.rb @@ -18,6 +18,5 @@ module Parfait def inspect "#{@self_type.object_class.name}(#{arguments_type.inspect})" end - end end diff --git a/lib/risc/interpreter.rb b/lib/risc/interpreter.rb index 861d7ca2..4891136b 100644 --- a/lib/risc/interpreter.rb +++ b/lib/risc/interpreter.rb @@ -110,7 +110,10 @@ module Risc # Instruction interpretation starts here def execute_DynamicJump method = get_register(@instruction.register) - pos = Position.get(method.binary).at + Parfait::BinaryCode.byte_offset + pos = Position.get(method.binary) + log.debug "Jump to binary at: #{pos} #{method.name}:#{method.binary.class}" + raise "Invalid position for #{method.name}" unless pos.valid? + pos = pos + Parfait::BinaryCode.byte_offset set_pc( pos ) false end diff --git a/test/risc/interpreter/calling/test_minus.rb b/test/risc/interpreter/calling/test_minus.rb index a8496bd1..2866105f 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(60) assert_equal FunctionReturn , ret.class assert_equal :r1 , ret.register.symbol - assert_equal 23392 , @interpreter.get_register(ret.register) + assert_equal 24160 , @interpreter.get_register(ret.register) end def test_sys sys = main_ticks(65) diff --git a/test/risc/test_interpreter.rb b/test/risc/test_interpreter.rb index 27ed5177..44fa80a6 100644 --- a/test/risc/test_interpreter.rb +++ b/test/risc/test_interpreter.rb @@ -54,7 +54,7 @@ module Risc end def test_pc1 @interpreter.tick - assert_equal 22968 , @interpreter.pc + assert_equal 23736 , @interpreter.pc end def test_tick2 @interpreter.tick @@ -68,7 +68,7 @@ module Risc def test_pc2 @interpreter.tick @interpreter.tick - assert_equal 22972 , @interpreter.pc + assert_equal 23740 , @interpreter.pc end def test_tick_14_jump 14.times {@interpreter.tick} diff --git a/test/risc/test_linker.rb b/test/risc/test_linker.rb index 464de3bf..c729dc7b 100644 --- a/test/risc/test_linker.rb +++ b/test/risc/test_linker.rb @@ -25,7 +25,7 @@ module Risc assert_equal 0 , Position.get(@linker.cpu_init).at end def test_cpu_at - assert_equal "0x686c" , Position.get(@linker.cpu_init.first).to_s + assert_equal "0x6b6c" , Position.get(@linker.cpu_init.first).to_s end def test_cpu_label assert_equal Position , Position.get(@linker.cpu_init.first).class diff --git a/test/risc/test_method_compiler.rb b/test/risc/test_method_compiler.rb index 069ac65e..fb83fcfa 100644 --- a/test/risc/test_method_compiler.rb +++ b/test/risc/test_method_compiler.rb @@ -49,16 +49,6 @@ module Risc assert_equal Vool::MethodStatement , clazz.body.first.class end - def test_method_statement_has_class - vool = in_test_vool("def meth; @ivar = 5;end") - assert vool.body.first.clazz - end - - def test_parfait_class_creation - vool = in_test_vool("def meth; @ivar = 5;end") - assert_equal Parfait::Class , vool.body.first.clazz.class - end - def test_callable_method_instance_type in_test_vool("def meth; @ivar = 5; @ibar = 4;end") test = Parfait.object_space.get_class_by_name(:Test)