diff --git a/lib/parfait/class.rb b/lib/parfait/class.rb index f380880b..b8170fcb 100644 --- a/lib/parfait/class.rb +++ b/lib/parfait/class.rb @@ -62,7 +62,7 @@ module Parfait end @@CLAZZ = { :names => [:name , :super_class_name , :instance_methods] , :types => [Virtual::Reference,Virtual::Reference,Virtual::Reference]} - def layout + def old_layout @@CLAZZ end def mem_length diff --git a/lib/parfait/space.rb b/lib/parfait/space.rb index d39a1157..8619b7f8 100644 --- a/lib/parfait/space.rb +++ b/lib/parfait/space.rb @@ -37,7 +37,7 @@ module Parfait @@SPACE = { :names => [:classes,:objects,:symbols,:messages, :next_message , :next_frame] , :types => [Virtual::Reference,Virtual::Reference,Virtual::Reference,Virtual::Reference,Virtual::Reference]} - def layout + def old_layout @@SPACE end diff --git a/lib/parfait/word.rb b/lib/parfait/word.rb index 92559c10..41d53a56 100644 --- a/lib/parfait/word.rb +++ b/lib/parfait/word.rb @@ -8,6 +8,10 @@ module Parfait # Words are constant, maybe like js strings, ruby symbols # 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. class Word < Object # initialize with length. For now we try to keep all non-parfait (including String) out diff --git a/lib/virtual/compiled_method.rb b/lib/virtual/compiled_method.rb index afa48be9..a9c580cf 100644 --- a/lib/virtual/compiled_method.rb +++ b/lib/virtual/compiled_method.rb @@ -148,7 +148,7 @@ module Virtual Ast::NameExpression.new(name) end - def layout + def old_layout Virtual::Object.layout end # sugar to create instructions easily. diff --git a/lib/virtual/machine.rb b/lib/virtual/machine.rb index 55151eb4..deb02056 100644 --- a/lib/virtual/machine.rb +++ b/lib/virtual/machine.rb @@ -84,7 +84,7 @@ module Virtual def self.instance @instance ||= Machine.new end - + # for testing, make sure no old artefacts hang around #maybe should be moved to test dir def self.reboot @@ -143,6 +143,7 @@ module Virtual cl = @space.get_class_by_name( name ) cl.set_super_class(object_class) end + #boot_layouts end def boot # read all the files needed for a minimal system at compile diff --git a/lib/virtual/object.rb b/lib/virtual/object.rb index 3f1e0ac2..c7101334 100644 --- a/lib/virtual/object.rb +++ b/lib/virtual/object.rb @@ -48,7 +48,7 @@ module Virtual raise "abstract #{self.class}" end @@EMPTY = { :names => [] , :types => []} - def layout + def old_layout raise "Find me #{self}" self.class.layout end @@ -61,7 +61,7 @@ module Virtual # @@CLAZZ = { :names => [:name , :super_class_name , :instance_methods] , :types => [Virtual::Reference,Virtual::Reference,Virtual::Reference]} # @@SPACE = { :names => [:classes,:objects] , :types => [Virtual::Reference,Virtual::Reference]} - def layout_for(object) + def old_layout_for(object) case object when Array , Symbol , String , Virtual::CompiledMethod , Virtual::Block , Parfait::Word @@ARRAY @@ -91,7 +91,7 @@ module Virtual end ::Parfait::Message.class_eval do include Positioned - def layout + def old_layout Virtual::Object.layout end def mem_length @@ -100,7 +100,7 @@ end end ::Parfait::Frame.class_eval do include Positioned - def layout + def old_layout Virtual::Object.layout end def mem_length @@ -110,7 +110,7 @@ end Parfait::Dictionary.class_eval do include Positioned HASH = { :names => [:keys,:values] , :types => [Virtual::Reference,Virtual::Reference]} - def layout + def old_layout HASH end def mem_length @@ -119,7 +119,7 @@ Parfait::Dictionary.class_eval do end ::Parfait::List.class_eval do include Positioned - def layout + def old_layout Virtual::Object.layout end def mem_length @@ -128,7 +128,7 @@ end end ::Parfait::Word.class_eval do include Positioned - def layout + def old_layout Virtual::Object.layout end def mem_length diff --git a/test/fragments/test_string_class.rb b/test/fragments/test_string_class.rb index 9394124b..5eb3f035 100644 --- a/test/fragments/test_string_class.rb +++ b/test/fragments/test_string_class.rb @@ -31,7 +31,7 @@ class Object l = @layout return l.index_of(name) end - def layout() + def old_layout() return @layout end end