fix bug where layout wasn't initialized
This commit is contained in:
parent
3e9e650764
commit
bea10cc560
@ -14,6 +14,7 @@
|
||||
module Parfait
|
||||
class Module < Object
|
||||
def initialize name , superclass
|
||||
super()
|
||||
@name = name
|
||||
@instance_methods = []
|
||||
@name = name
|
||||
|
@ -43,6 +43,11 @@ module Parfait
|
||||
|
||||
# private
|
||||
def set_layout(layout)
|
||||
if( internal_object_get(LAYOUT_INDEX) )
|
||||
#TODO find out wat these objects are
|
||||
# puts "Layout was set for #{self.class}"
|
||||
return
|
||||
end
|
||||
internal_object_set(LAYOUT_INDEX , layout)
|
||||
end
|
||||
|
||||
|
@ -179,15 +179,19 @@ module Register
|
||||
pad_after( count )
|
||||
end
|
||||
|
||||
def assemble_String( str )
|
||||
str = str.string if str.is_a? Parfait::Word
|
||||
str = str.to_s if str.is_a? Symbol
|
||||
def assemble_BinaryCode code
|
||||
assemble_String code
|
||||
end
|
||||
|
||||
def assemble_String( string )
|
||||
str = string.to_s if string.is_a? Parfait::Word
|
||||
str = string.to_s if str.is_a? Symbol
|
||||
word = (str.length + 7) / 32 # all object are multiple of 8 words (7 for header)
|
||||
raise "String too long (implement split string!) #{word}" if word > 15
|
||||
# first line is integers, convention is that following lines are the same
|
||||
TYPE_LENGTH.times { word = ((word << TYPE_BITS) + TYPE_INT) }
|
||||
@stream.write_uint32( word )
|
||||
write_ref_for( str.layout[:names] ) #ref
|
||||
write_ref_for( string.get_layout ) #ref
|
||||
@stream.write str
|
||||
pad_after(str.length)
|
||||
#puts "String (#{slot.mem_length}) stream #{@stream.mem_length.to_s(16)}"
|
||||
|
@ -26,7 +26,7 @@ module Virtual
|
||||
layouts = { "Word" => [] ,
|
||||
"List" => [] ,
|
||||
"Message" => [],
|
||||
"BinaryCode" => [],
|
||||
"BinaryCode" => [],
|
||||
"Space" => ["classes","objects","frames","messages","next_message","next_frame"],
|
||||
"Frame" => ["locals" , "tmps" ],
|
||||
"Layout" => ["object_class"] ,
|
||||
@ -51,6 +51,7 @@ module Virtual
|
||||
clazz.object_layout.add_instance_variable Virtual.new_word(var_name)
|
||||
end
|
||||
end
|
||||
|
||||
# now store the classes so we can hand them out later during object creation
|
||||
# this can not be done earlier, as parfait objects are all the time created and would
|
||||
# lookup half created class info
|
||||
@ -61,11 +62,9 @@ module Virtual
|
||||
class_mappings["Object"] = value_classes[3] #need for further booting
|
||||
|
||||
# add space and instances which get created before the objects list
|
||||
@space.add_object @space
|
||||
@space.add_object @space.classes
|
||||
@space.add_object @space.classes.keys
|
||||
@space.add_object @space.classes.values
|
||||
@space.add_object @space.objects
|
||||
[@space,@space.classes,@space.classes.keys, @space.classes.values,@space.objects].each do |o|
|
||||
@space.add_object o
|
||||
end
|
||||
|
||||
@space.late_init
|
||||
|
||||
|
@ -11,7 +11,10 @@ module FakeMem
|
||||
@length = -1
|
||||
if Parfait::Space.object_space and Parfait::Space.object_space.objects
|
||||
Parfait::Space.object_space.add_object self
|
||||
end #Note: the else is handled in boot, by ading the space "by hand", as it slips though
|
||||
else
|
||||
#Note: the else is handled in boot, by ading the space "by hand", as it slips though
|
||||
#puts "Got away #{self.class}"
|
||||
end
|
||||
init_layout if Virtual::Machine.instance.class_mappings
|
||||
end
|
||||
def init_layout
|
||||
|
Loading…
Reference in New Issue
Block a user