diff --git a/lib/parfait/list.rb b/lib/parfait/list.rb index 2f4a22ce..cdda6644 100644 --- a/lib/parfait/list.rb +++ b/lib/parfait/list.rb @@ -140,6 +140,14 @@ module Parfait end return true end + + # above, correct, implementation causes problems in the machine object space + # because when a second empty (newly created) list is added, it is not actually + # added as it exists already. TODO, but hack with below identity function + def == other + self.object_id == other.object_id + end + #many basic List functions can not be defined in ruby, such as # get/set/length/add/delete # so they must be defined as CompiledMethods in Builtin::Kernel diff --git a/lib/register/assembler.rb b/lib/register/assembler.rb index 2903eee2..b517296e 100644 --- a/lib/register/assembler.rb +++ b/lib/register/assembler.rb @@ -54,6 +54,7 @@ module Register begin link all= @machine.objects.sort{|a,b| a.position <=> b.position} + # debugging loop accesses all positions to force an error if it's not set all.each do |objekt| puts "Linked #{objekt.class}(#{objekt.object_id.to_s(16)}) at #{objekt.position.to_s(16)} / #{objekt.word_length.to_s(16)}" objekt.position diff --git a/lib/virtual/positioned.rb b/lib/virtual/positioned.rb index fee12094..0b9fac92 100644 --- a/lib/virtual/positioned.rb +++ b/lib/virtual/positioned.rb @@ -3,8 +3,8 @@ require_relative "type" module Positioned def position if @position.nil? - str = "IN machine #{Virtual.machine.objects.include?(self)}\n" - raise str + "position not set for #{self.class} at #{word_length} for #{self.inspect[0...100]}" + str = "IN machine #{Virtual.machine.objects.include?(self)}, at #{self.object_id.to_s(16)}\n" + raise str + "position not set for #{self.class} len #{word_length} for #{self.inspect[0...100]}" end @position end