From 3895ac624c4ad3ba130d2263ad8bea37a0ad8563 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Thu, 22 Oct 2015 11:48:03 +0300 Subject: [PATCH] fix offsets, debugging revealed them to be 1 off --- lib/parfait/frame.rb | 2 +- lib/parfait/message.rb | 2 +- test/compiler/statements/test_assign.rb | 8 ++++---- test/compiler/statements/test_call.rb | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/parfait/frame.rb b/lib/parfait/frame.rb index ab8cb7ad..707fa602 100644 --- a/lib/parfait/frame.rb +++ b/lib/parfait/frame.rb @@ -29,7 +29,7 @@ module Parfait attribute :next_frame def self.offset - Space.object_space.get_class_by_name(:Frame).object_layout.object_instance_length + 1 + Space.object_space.get_class_by_name(:Frame).object_layout.object_instance_length end end diff --git a/lib/parfait/message.rb b/lib/parfait/message.rb index aba80e20..d33067a7 100644 --- a/lib/parfait/message.rb +++ b/lib/parfait/message.rb @@ -30,7 +30,7 @@ module Parfait end def self.offset - Space.object_space.get_class_by_name(:Message).object_layout.object_instance_length + 1 + Space.object_space.get_class_by_name(:Message).object_layout.object_instance_length end end end diff --git a/test/compiler/statements/test_assign.rb b/test/compiler/statements/test_assign.rb index 3d63d11d..75c3f72b 100644 --- a/test/compiler/statements/test_assign.rb +++ b/test/compiler/statements/test_assign.rb @@ -73,7 +73,7 @@ HERE was = check get = was[0].codes[5] assert_equal GetSlot , get.class - assert_equal 2, get.index , "Get to frame index must be offset, not #{get.index}" + assert_equal 3, get.index , "Get to frame index must be offset, not #{get.index}" end def test_assign_arg @@ -89,7 +89,7 @@ HERE was = check set = was[0].codes[2] assert_equal SetSlot , set.class - assert_equal 8, set.index , "Set to args index must be offset, not #{set.index}" + assert_equal 9, set.index , "Set to args index must be offset, not #{set.index}" end def test_assign_int @@ -104,7 +104,7 @@ HERE was = check set = was[0].codes[3] assert_equal SetSlot , set.class - assert_equal 2, set.index , "Set to frame index must be offset, not #{set.index}" + assert_equal 3, set.index , "Set to frame index must be offset, not #{set.index}" end def test_arg_get @@ -122,7 +122,7 @@ HERE was = check get = was[0].codes[1] assert_equal GetSlot , get.class - assert_equal 8, get.index , "Get to frame index must be offset, not #{get.index}" + assert_equal 9, get.index , "Get to frame index must be offset, not #{get.index}" end end end diff --git a/test/compiler/statements/test_call.rb b/test/compiler/statements/test_call.rb index 7373d533..6a2f8256 100644 --- a/test/compiler/statements/test_call.rb +++ b/test/compiler/statements/test_call.rb @@ -100,7 +100,7 @@ HERE was = check set = was[0].codes[7] assert_equal SetSlot , set.class - assert_equal 8, set.index , "Set to message must be offset, not #{set.index}" + assert_equal 9, set.index , "Set to message must be offset, not #{set.index}" end end end