smaller clean-ups
This commit is contained in:
parent
4d0773ebae
commit
8413f6b470
@ -34,7 +34,7 @@ module Parfait
|
||||
end
|
||||
|
||||
# get a value fot the given key
|
||||
# key ientity is checked with == not === (ie equals not identity)
|
||||
# key identity is checked with == not === (ie equals not identity)
|
||||
# return nil if no such key
|
||||
def get(key)
|
||||
index = key_index(key)
|
||||
|
@ -40,7 +40,7 @@ module Parfait
|
||||
def create_instance_method name , arg_names
|
||||
clazz = Space.object_space.get_class_by_name(self.name)
|
||||
raise "??? #{self.name}" unless clazz
|
||||
Method.new( clazz , name , arg_names )
|
||||
Method.new_object( clazz , name , arg_names )
|
||||
end
|
||||
|
||||
# this needs to be done during booting as we can't have all the classes and superclassses
|
||||
@ -51,7 +51,7 @@ module Parfait
|
||||
end
|
||||
|
||||
def get_instance_method fname
|
||||
raise "uups #{fname}.#{fname.class}" unless fname.is_a? Word
|
||||
raise "uups #{fname}.#{fname.class}" unless fname.is_a?(Word) or fname.is_a?(String)
|
||||
@instance_methods.detect{ |fun| fun.name == fname }
|
||||
end
|
||||
|
||||
|
@ -47,8 +47,9 @@ module Parfait
|
||||
end
|
||||
|
||||
def get_layout()
|
||||
#puts "ME #{self.class}"
|
||||
return internal_object_get(LAYOUT_INDEX)
|
||||
l = internal_object_get(LAYOUT_INDEX)
|
||||
raise "No layout #{self.class}" unless l
|
||||
return l
|
||||
end
|
||||
|
||||
def get_instance_variables
|
||||
|
@ -40,7 +40,7 @@ module Parfait
|
||||
@frames = List.new_object
|
||||
@messages = List.new_object
|
||||
counter = 0
|
||||
while( counter < 100)
|
||||
while( counter < 5)
|
||||
@frames.push Frame.new_object
|
||||
@messages.push Message.new_object
|
||||
counter = counter + 1
|
||||
@ -65,12 +65,16 @@ module Parfait
|
||||
@objects.push o
|
||||
end
|
||||
|
||||
def get_main
|
||||
kernel = get_class_by_name "Kernel"
|
||||
kernel.get_instance_method "main"
|
||||
end
|
||||
|
||||
# this is the way to instantiate classes (not Parfait::Class.new)
|
||||
# so we get and keep exactly one per name
|
||||
def get_class_by_name name
|
||||
raise "uups #{name}.#{name.class}" unless name.is_a? Word
|
||||
raise "uups #{name}.#{name.class}" unless name.is_a?(Word) or name.is_a?(String)
|
||||
c = @classes[name]
|
||||
raise "uups " if name.is_a? String
|
||||
puts "MISS, no class #{name} #{name.class}" unless c # " #{@classes}"
|
||||
c
|
||||
end
|
||||
|
@ -59,7 +59,7 @@ module Virtual
|
||||
begin
|
||||
code.set_position( at)
|
||||
rescue => e
|
||||
puts "BLOCK #{self}"
|
||||
puts "BLOCK #{self.to_s[0..5000]}"
|
||||
raise e
|
||||
end
|
||||
raise code.inspect unless code.mem_length
|
||||
|
@ -11,10 +11,7 @@ module FakeMem
|
||||
@length = -1
|
||||
if Parfait::Space.object_space and Parfait::Space.object_space.objects
|
||||
Parfait::Space.object_space.add_object self
|
||||
else
|
||||
#TODO, must go through spce instance variables "by hand"
|
||||
puts "fixme, no layout for #{self.class.name}"
|
||||
end
|
||||
end #Note: the else is handled in boot, by ading the space "by hand", as it slips though
|
||||
init_layout if Virtual::Machine.instance.class_mappings
|
||||
end
|
||||
def init_layout
|
||||
@ -31,7 +28,7 @@ module FakeMem
|
||||
# resetting of position used to be error, but since relink and dynamic instruction size it is ok.
|
||||
# in measures (of 32)
|
||||
if @position != nil and ((@position - pos).abs > 32)
|
||||
raise "position set again #{pos}!=#{@position} for #{self}"
|
||||
raise "position set again #{pos}!=#{@position} for #{self.class}"
|
||||
end
|
||||
@position = pos
|
||||
end
|
||||
@ -95,7 +92,7 @@ module Parfait
|
||||
end
|
||||
class List
|
||||
def mem_length
|
||||
Virtual::Object.new.padded_words(length())
|
||||
padded_words(get_length())
|
||||
end
|
||||
def to_sof_node(writer , level , ref )
|
||||
Sof.array_to_sof_node(self , writer , level , ref )
|
||||
@ -122,7 +119,7 @@ module Parfait
|
||||
|
||||
class Word
|
||||
def mem_length
|
||||
Virtual::Object.new.padded(1 + length())
|
||||
padded(1 + length())
|
||||
end
|
||||
|
||||
def == other
|
||||
|
Loading…
Reference in New Issue
Block a user