fix bug where layout wasn't initialized
This commit is contained in:
parent
3e9e650764
commit
bea10cc560
@ -14,6 +14,7 @@
|
|||||||
module Parfait
|
module Parfait
|
||||||
class Module < Object
|
class Module < Object
|
||||||
def initialize name , superclass
|
def initialize name , superclass
|
||||||
|
super()
|
||||||
@name = name
|
@name = name
|
||||||
@instance_methods = []
|
@instance_methods = []
|
||||||
@name = name
|
@name = name
|
||||||
|
@ -43,6 +43,11 @@ module Parfait
|
|||||||
|
|
||||||
# private
|
# private
|
||||||
def set_layout(layout)
|
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)
|
internal_object_set(LAYOUT_INDEX , layout)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -179,15 +179,19 @@ module Register
|
|||||||
pad_after( count )
|
pad_after( count )
|
||||||
end
|
end
|
||||||
|
|
||||||
def assemble_String( str )
|
def assemble_BinaryCode code
|
||||||
str = str.string if str.is_a? Parfait::Word
|
assemble_String code
|
||||||
str = str.to_s if str.is_a? Symbol
|
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)
|
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
|
raise "String too long (implement split string!) #{word}" if word > 15
|
||||||
# first line is integers, convention is that following lines are the same
|
# first line is integers, convention is that following lines are the same
|
||||||
TYPE_LENGTH.times { word = ((word << TYPE_BITS) + TYPE_INT) }
|
TYPE_LENGTH.times { word = ((word << TYPE_BITS) + TYPE_INT) }
|
||||||
@stream.write_uint32( word )
|
@stream.write_uint32( word )
|
||||||
write_ref_for( str.layout[:names] ) #ref
|
write_ref_for( string.get_layout ) #ref
|
||||||
@stream.write str
|
@stream.write str
|
||||||
pad_after(str.length)
|
pad_after(str.length)
|
||||||
#puts "String (#{slot.mem_length}) stream #{@stream.mem_length.to_s(16)}"
|
#puts "String (#{slot.mem_length}) stream #{@stream.mem_length.to_s(16)}"
|
||||||
|
@ -51,6 +51,7 @@ module Virtual
|
|||||||
clazz.object_layout.add_instance_variable Virtual.new_word(var_name)
|
clazz.object_layout.add_instance_variable Virtual.new_word(var_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# now store the classes so we can hand them out later during object creation
|
# 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
|
# this can not be done earlier, as parfait objects are all the time created and would
|
||||||
# lookup half created class info
|
# lookup half created class info
|
||||||
@ -61,11 +62,9 @@ module Virtual
|
|||||||
class_mappings["Object"] = value_classes[3] #need for further booting
|
class_mappings["Object"] = value_classes[3] #need for further booting
|
||||||
|
|
||||||
# add space and instances which get created before the objects list
|
# add space and instances which get created before the objects list
|
||||||
@space.add_object @space
|
[@space,@space.classes,@space.classes.keys, @space.classes.values,@space.objects].each do |o|
|
||||||
@space.add_object @space.classes
|
@space.add_object o
|
||||||
@space.add_object @space.classes.keys
|
end
|
||||||
@space.add_object @space.classes.values
|
|
||||||
@space.add_object @space.objects
|
|
||||||
|
|
||||||
@space.late_init
|
@space.late_init
|
||||||
|
|
||||||
|
@ -11,7 +11,10 @@ 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
|
||||||
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
|
init_layout if Virtual::Machine.instance.class_mappings
|
||||||
end
|
end
|
||||||
def init_layout
|
def init_layout
|
||||||
|
Loading…
Reference in New Issue
Block a user