From 3d113b4d83c890105b7041d9aef8f244aef2e422 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sun, 12 Aug 2018 13:10:44 +0300 Subject: [PATCH] fix more of the changed names add a few self. --- lib/mom/instruction/resolve_method.rb | 2 +- lib/parfait/space.rb | 2 +- lib/parfait/type.rb | 10 +++++----- lib/risc/parfait_boot.rb | 4 ++-- lib/risc/position/code_listener.rb | 12 ++++++------ test/risc/position/test_code_listener1.rb | 6 +++--- test/risc/position/test_code_position.rb | 4 ++-- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/mom/instruction/resolve_method.rb b/lib/mom/instruction/resolve_method.rb index 67cd6ff5..df008c4e 100644 --- a/lib/mom/instruction/resolve_method.rb +++ b/lib/mom/instruction/resolve_method.rb @@ -55,7 +55,7 @@ module Mom if_zero ok_label - callable_method << callable_method[:next] + callable_method << callable_method[:next_callable] branch while_start_label add_code exit_label diff --git a/lib/parfait/space.rb b/lib/parfait/space.rb index 20bf3c94..34586b91 100644 --- a/lib/parfait/space.rb +++ b/lib/parfait/space.rb @@ -77,7 +77,7 @@ module Parfait # hand out a return address for use as constant the address is added def get_address addr = next_address - next_address = next_address.next_integer + self.next_address = next_address.next_integer addr end diff --git a/lib/parfait/type.rb b/lib/parfait/type.rb index 95186cc8..78a0595a 100644 --- a/lib/parfait/type.rb +++ b/lib/parfait/type.rb @@ -127,16 +127,16 @@ module Parfait def remove_method( method_name ) raise "No such method #{method_name} in #{self.name}" unless methods if( methods.name == method_name) - self.methods = methods.next + self.methods = methods.next_callable return true end method = methods - while(method && method.next) - if( method.next.name == method_name) - method.set_next( method.next.next ) + while(method && method.next_callable) + if( method.next_callable.name == method_name) + method.set_next( method.next_callable.next_callable ) return true else - method = method.next + method = method.next_callable end end raise "No such method #{method_name} in #{self.name}" diff --git a/lib/risc/parfait_boot.rb b/lib/risc/parfait_boot.rb index d495884e..d51c5a39 100644 --- a/lib/risc/parfait_boot.rb +++ b/lib/risc/parfait_boot.rb @@ -135,12 +135,12 @@ module Parfait {BinaryCode: {next_code: :BinaryCode} , Block: {binary: :BinaryCode, next_callable: :Block, arguments_type: :Type , self_type: :Type, frame_type: :Type, - name: :Word } , + name: :Word , blocks: :Block } , CacheEntry: {cached_type: :Type , cached_method: :CallableMethod } , Callable: {binary: :BinaryCode,next_callable: :Callable , arguments_type: :Type , self_type: :Type, frame_type: :Type, - name: :Word } , + name: :Word , blocks: :Block } , CallableMethod: {binary: :BinaryCode, next_callable: :CallableMethod , arguments_type: :Type , self_type: :Type, frame_type: :Type , name: :Word , blocks: :Block} , diff --git a/lib/risc/position/code_listener.rb b/lib/risc/position/code_listener.rb index 72e3d0c5..0d0a9ae9 100644 --- a/lib/risc/position/code_listener.rb +++ b/lib/risc/position/code_listener.rb @@ -16,17 +16,17 @@ module Risc def position_inserted(position) Position.log.debug "extending one at #{position}" - pos = CodeListener.init( position.object.next , @platform) + pos = CodeListener.init( position.object.next_code , @platform) raise "HI #{position}" unless position.valid? return unless position.valid? - Position.log.debug "insert #{position.object.next.object_id.to_s(16)}" + Position.log.debug "insert #{position.object.next_code.object_id.to_s(16)}" pos.set( position + position.object.padded_length) set_jump_for(position) end def position_changed(position) Position.log.debug "Code changed #{position}" - nekst = position.object.next + nekst = position.object.next_code if( nekst ) nekst_pos = Position.get(nekst) Position.log.debug "Code changed, setting next #{position}" @@ -47,8 +47,8 @@ module Risc def set_jump_for(position) at = position.at code = position.object - return unless code.next #dont jump beyond and - jump = Branch.new("BinaryCode #{at.to_s(16)}" , code.next) + return unless code.next_code #dont jump beyond and + jump = Branch.new("BinaryCode #{at.to_s(16)}" , code.next_code) translator = @platform.translator cpu_jump = translator.translate(jump) pos = at + code.padded_length - cpu_jump.byte_length @@ -66,7 +66,7 @@ module Risc position = Position.get_or_create(code) first = position unless first position.position_listener(CodeListener.new(platform)) - code = code.next + code = code.next_code end first end diff --git a/test/risc/position/test_code_listener1.rb b/test/risc/position/test_code_listener1.rb index 0de1f523..3c341f57 100644 --- a/test/risc/position/test_code_listener1.rb +++ b/test/risc/position/test_code_listener1.rb @@ -14,18 +14,18 @@ module Risc def test_listener_after_extend CodeListener.init(@binary,:interpreter).set(10) @binary.extend_one - pos = Position.get(@binary.next) + pos = Position.get(@binary.next_code) assert_equal CodeListener , pos.event_table[:position_changed].first.class end def test_valid_pos_for_extended @binary.extend_one CodeListener.init(@binary,:interpreter).set(10) - assert Position.get(@binary.next).valid? + assert Position.get(@binary.next_code).valid? end def test_extend_sets_next_pos CodeListener.init(@binary,:interpreter).set(10) @binary.extend_one - assert Position.get(@binary.next).valid? + assert Position.get(@binary.next_code).valid? end def test_extends_creates_jump CodeListener.init(@binary,:interpreter).set(10) diff --git a/test/risc/position/test_code_position.rb b/test/risc/position/test_code_position.rb index 98e1a364..d302f479 100644 --- a/test/risc/position/test_code_position.rb +++ b/test/risc/position/test_code_position.rb @@ -13,12 +13,12 @@ module Risc def test_bin_propagates_existing @binary.extend_to(16) CodeListener.init( @binary , :interpreter).set(0) - assert_equal @binary.padded_length , Position.get(@binary.next).at + assert_equal @binary.padded_length , Position.get(@binary.next_code).at end def test_bin_propagates_after CodeListener.init( @binary , :interpreter).set(0) @binary.extend_to(16) - assert_equal @binary.padded_length , Position.get(@binary.next).at + assert_equal @binary.padded_length , Position.get(@binary.next_code).at end end end