don't collect labels anymore
don’t need, use binary code as the methods jump point
This commit is contained in:
parent
4253d7a6b9
commit
4069397fca
@ -12,10 +12,6 @@ module Risc
|
|||||||
def self.keep( object , depth )
|
def self.keep( object , depth )
|
||||||
return if object.nil?
|
return if object.nil?
|
||||||
return unless add_object( object , depth )
|
return unless add_object( object , depth )
|
||||||
# probably should make labels or even instructions derive from Parfait::Object, but . .
|
|
||||||
if object.is_a? Risc::Label
|
|
||||||
object.each { |l| self.add_object(l ,depth) if l.is_a? Risc::Label}
|
|
||||||
end
|
|
||||||
return unless object.respond_to? :has_type?
|
return unless object.respond_to? :has_type?
|
||||||
type = object.get_type
|
type = object.get_type
|
||||||
keep(type , depth + 1)
|
keep(type , depth + 1)
|
||||||
@ -36,9 +32,10 @@ module Risc
|
|||||||
def self.add_object( objekt , depth)
|
def self.add_object( objekt , depth)
|
||||||
return false if @objects[objekt.object_id]
|
return false if @objects[objekt.object_id]
|
||||||
return true if objekt.is_a? Fixnum
|
return true if objekt.is_a? Fixnum
|
||||||
|
return true if objekt.is_a?( Risc::Label)
|
||||||
#puts message(objekt , depth)
|
#puts message(objekt , depth)
|
||||||
#puts "ADD #{objekt.inspect}, #{objekt.name}" if objekt.is_a? Parfait::TypedMethod
|
#puts "ADD #{objekt.inspect}, #{objekt.name}" if objekt.is_a? Parfait::TypedMethod
|
||||||
unless objekt.is_a?( Parfait::Object) or objekt.is_a?( Symbol) or objekt.is_a?( Risc::Label)
|
unless objekt.is_a?( Parfait::Object) or objekt.is_a?( Symbol)
|
||||||
raise "adding non parfait #{objekt.class}:#{objekt}"
|
raise "adding non parfait #{objekt.class}:#{objekt}"
|
||||||
end
|
end
|
||||||
#raise "Method #{objekt.name}" if objekt.is_a? Parfait::TypedMethod
|
#raise "Method #{objekt.name}" if objekt.is_a? Parfait::TypedMethod
|
||||||
|
@ -96,6 +96,7 @@ module Risc
|
|||||||
def boot
|
def boot
|
||||||
initialize
|
initialize
|
||||||
@objects = nil
|
@objects = nil
|
||||||
|
@translated = false
|
||||||
boot_parfait!
|
boot_parfait!
|
||||||
@risc_init = Branch.new( "__initial_branch__" , Parfait.object_space.get_init.risc_instructions )
|
@risc_init = Branch.new( "__initial_branch__" , Parfait.object_space.get_init.risc_instructions )
|
||||||
@booted = true
|
@booted = true
|
||||||
|
@ -9,16 +9,22 @@ module Risc
|
|||||||
|
|
||||||
def test_simple_collect
|
def test_simple_collect
|
||||||
objects = Risc::Collector.collect_space
|
objects = Risc::Collector.collect_space
|
||||||
assert ((350 < objects.length) or (430 > objects.length)) , objects.length.to_s
|
assert ((400 < objects.length) or (450 > objects.length)) , objects.length.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_collect_all_types
|
def test_collect_all_types
|
||||||
objects = Risc::Collector.collect_space
|
Risc::Collector.collect_space.each do |id, objekt|
|
||||||
objects.each do |id, objekt|
|
|
||||||
next unless objekt.is_a?( Parfait::Type )
|
next unless objekt.is_a?( Parfait::Type )
|
||||||
assert Parfait.object_space.get_type_for( objekt.hash ) , objekt.hash
|
assert Parfait.object_space.get_type_for( objekt.hash ) , objekt.hash
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_allowed_types
|
||||||
|
Risc::Collector.collect_space.each do |id, objekt|
|
||||||
|
next if objekt.is_a?( Parfait::Object )
|
||||||
|
next if objekt.is_a?( Symbol )
|
||||||
|
assert_equal 1 , objekt.class
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -10,14 +10,20 @@ module Risc
|
|||||||
def test_objects
|
def test_objects
|
||||||
objects = @machine.objects
|
objects = @machine.objects
|
||||||
assert_equal Hash , objects.class
|
assert_equal Hash , objects.class
|
||||||
assert 400 < objects.length
|
assert 350 < objects.length
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_position
|
def test_position_length
|
||||||
@machine.position_all
|
@machine.position_all
|
||||||
objects = @machine.objects
|
objects = @machine.objects
|
||||||
assert_equal Hash , objects.class
|
assert_equal Hash , objects.class
|
||||||
assert 400 < objects.length
|
assert 350 < objects.length
|
||||||
|
end
|
||||||
|
def test_has_positions
|
||||||
|
@machine.position_all
|
||||||
|
@machine.objects.each do |id,obj|
|
||||||
|
assert Positioned.position(obj)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user