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