fix that silly mistake that made the percentage plummet

mostly due to the fact that object is a hash now,
not array. Took a while though
This commit is contained in:
Torsten Ruger
2015-07-21 19:41:30 +03:00
parent 2d0424a370
commit e3577d18af
11 changed files with 28 additions and 29 deletions

View File

@ -93,6 +93,7 @@ module Virtual
# Objects are data and get assembled after functions
def add_object o
return false if @objects[o.object_id]
raise "adding non parfait #{o.class}" unless o.is_a? Parfait::Object or o.is_a? Symbol
@objects[o.object_id] = o
true
end

View File

@ -25,7 +25,7 @@ class Symbol
end
def get_layout
l = Virtual.machine.space.classes[:Word].object_layout
puts "LL #{l.class}"
#puts "LL #{l.class}"
l
end
def word_length
@ -42,7 +42,7 @@ class Symbol
pos = cache_positions[self]
if pos == nil
str = "position accessed but not set, "
str += "Machine has object=#{Virtual.machine.objects.include?(self)} "
str += "Machine has object=#{Virtual.machine.objects.has_key?(self.object_id)} "
raise str + " for Symbol:#{self}"
end
pos
@ -168,7 +168,7 @@ module Parfait
# name comes in as a ruby @var name
def instance_variable_get name
var = get_instance_variable name.to_s[1 .. -1].to_sym
puts "getting #{name} #{var}"
#puts "getting #{name} #{var}"
var
end
end

View File

@ -12,17 +12,17 @@ module Virtual
return unless Virtual.machine.add_object object
#puts "adding #{object.class}"
return unless object.respond_to? :has_layout?
unless object.has_layout?
object.init_layout
end
if( object.is_a? Parfait::Method)
object.source.constants.each{|c| keep(c) }
object.source.constants.each{|c|
puts "keeping constant #{c.class}"
keep(c)
}
end
layout = object.get_layout
keep layout
#puts "Layout #{layout.object_class.name} #{Machine.instance.objects.include?(layout)}"
#puts "Layout #{layout.object_class.name} #{Machine.instance.objects.has_key?(layout.object_id)}"
layout.object_instance_names.each do |name|
inst = object.instance_variable_get "@#{name}".to_sym
inst = object.get_instance_variable name
keep inst
end
if object.is_a? Parfait::List

View File

@ -3,7 +3,7 @@ require_relative "type"
module Positioned
def position
if @position.nil?
str = "IN machine #{Virtual.machine.objects.include?(self)}, at #{self.object_id.to_s(16)}\n"
str = "IN machine #{Virtual.machine.objects.has_key?(self.object_id)}, 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