rename old layout()

new is called get_layout, but keep old around for
checking
This commit is contained in:
Torsten Ruger 2015-05-17 14:41:18 +03:00
parent 350d708fd3
commit 1114f06921
7 changed files with 17 additions and 12 deletions

View File

@ -62,7 +62,7 @@ module Parfait
end end
@@CLAZZ = { :names => [:name , :super_class_name , :instance_methods] , :types => [Virtual::Reference,Virtual::Reference,Virtual::Reference]} @@CLAZZ = { :names => [:name , :super_class_name , :instance_methods] , :types => [Virtual::Reference,Virtual::Reference,Virtual::Reference]}
def layout def old_layout
@@CLAZZ @@CLAZZ
end end
def mem_length def mem_length

View File

@ -37,7 +37,7 @@ module Parfait
@@SPACE = { :names => [:classes,:objects,:symbols,:messages, :next_message , :next_frame] , @@SPACE = { :names => [:classes,:objects,:symbols,:messages, :next_message , :next_frame] ,
:types => [Virtual::Reference,Virtual::Reference,Virtual::Reference,Virtual::Reference,Virtual::Reference]} :types => [Virtual::Reference,Virtual::Reference,Virtual::Reference,Virtual::Reference,Virtual::Reference]}
def layout def old_layout
@@SPACE @@SPACE
end end

View File

@ -8,6 +8,10 @@ module Parfait
# Words are constant, maybe like js strings, ruby symbols # Words are constant, maybe like js strings, ruby symbols
# Words are short, but may have spaces # Words are short, but may have spaces
# Words are objects, that means they carry Layout as index 0
# So all indexes are offset by one in the implementation
# Object length is measured in non-layout cells though
# big TODO , this has NO encoding, a char takes a machine word. Go fix. # big TODO , this has NO encoding, a char takes a machine word. Go fix.
class Word < Object class Word < Object
# initialize with length. For now we try to keep all non-parfait (including String) out # initialize with length. For now we try to keep all non-parfait (including String) out

View File

@ -148,7 +148,7 @@ module Virtual
Ast::NameExpression.new(name) Ast::NameExpression.new(name)
end end
def layout def old_layout
Virtual::Object.layout Virtual::Object.layout
end end
# sugar to create instructions easily. # sugar to create instructions easily.

View File

@ -143,6 +143,7 @@ module Virtual
cl = @space.get_class_by_name( name ) cl = @space.get_class_by_name( name )
cl.set_super_class(object_class) cl.set_super_class(object_class)
end end
#boot_layouts
end end
def boot def boot
# read all the files needed for a minimal system at compile # read all the files needed for a minimal system at compile

View File

@ -48,7 +48,7 @@ module Virtual
raise "abstract #{self.class}" raise "abstract #{self.class}"
end end
@@EMPTY = { :names => [] , :types => []} @@EMPTY = { :names => [] , :types => []}
def layout def old_layout
raise "Find me #{self}" raise "Find me #{self}"
self.class.layout self.class.layout
end end
@ -61,7 +61,7 @@ module Virtual
# @@CLAZZ = { :names => [:name , :super_class_name , :instance_methods] , :types => [Virtual::Reference,Virtual::Reference,Virtual::Reference]} # @@CLAZZ = { :names => [:name , :super_class_name , :instance_methods] , :types => [Virtual::Reference,Virtual::Reference,Virtual::Reference]}
# @@SPACE = { :names => [:classes,:objects] , :types => [Virtual::Reference,Virtual::Reference]} # @@SPACE = { :names => [:classes,:objects] , :types => [Virtual::Reference,Virtual::Reference]}
def layout_for(object) def old_layout_for(object)
case object case object
when Array , Symbol , String , Virtual::CompiledMethod , Virtual::Block , Parfait::Word when Array , Symbol , String , Virtual::CompiledMethod , Virtual::Block , Parfait::Word
@@ARRAY @@ARRAY
@ -91,7 +91,7 @@ module Virtual
end end
::Parfait::Message.class_eval do ::Parfait::Message.class_eval do
include Positioned include Positioned
def layout def old_layout
Virtual::Object.layout Virtual::Object.layout
end end
def mem_length def mem_length
@ -100,7 +100,7 @@ end
end end
::Parfait::Frame.class_eval do ::Parfait::Frame.class_eval do
include Positioned include Positioned
def layout def old_layout
Virtual::Object.layout Virtual::Object.layout
end end
def mem_length def mem_length
@ -110,7 +110,7 @@ end
Parfait::Dictionary.class_eval do Parfait::Dictionary.class_eval do
include Positioned include Positioned
HASH = { :names => [:keys,:values] , :types => [Virtual::Reference,Virtual::Reference]} HASH = { :names => [:keys,:values] , :types => [Virtual::Reference,Virtual::Reference]}
def layout def old_layout
HASH HASH
end end
def mem_length def mem_length
@ -119,7 +119,7 @@ Parfait::Dictionary.class_eval do
end end
::Parfait::List.class_eval do ::Parfait::List.class_eval do
include Positioned include Positioned
def layout def old_layout
Virtual::Object.layout Virtual::Object.layout
end end
def mem_length def mem_length
@ -128,7 +128,7 @@ end
end end
::Parfait::Word.class_eval do ::Parfait::Word.class_eval do
include Positioned include Positioned
def layout def old_layout
Virtual::Object.layout Virtual::Object.layout
end end
def mem_length def mem_length

View File

@ -31,7 +31,7 @@ class Object
l = @layout l = @layout
return l.index_of(name) return l.index_of(name)
end end
def layout() def old_layout()
return @layout return @layout
end end
end end