diff --git a/lib/mom/block_compiler.rb b/lib/mom/block_compiler.rb index e68a90a5..ee305245 100644 --- a/lib/mom/block_compiler.rb +++ b/lib/mom/block_compiler.rb @@ -28,17 +28,17 @@ module Mom # or then the methods arg or frame def slot_type_for(name) if index = @callable.arguments_type.variable_index(name) - return ["arg#{index}".to_sym] - elsif @callable.frame_type.variable_index(name) - slot_def = [:frame] + slot_def = ["arg#{index}".to_sym] + elsif index = @callable.frame_type.variable_index(name) + slot_def = ["local#{index}".to_sym] elsif index = @method.arguments_type.variable_index(name) - return [:caller , :caller , "arg#{index}".to_sym] - elsif @method.frame_type.variable_index(name) - slot_def = [:caller ,:caller , :frame ] + slot_def = [:caller , :caller , "arg#{index}".to_sym] + elsif index = @method.frame_type.variable_index(name) + slot_def = [:caller ,:caller , "local#{index}".to_sym ] elsif raise "no variable #{name} , need to resolve at runtime" end - slot_def << name + return slot_def end diff --git a/lib/mom/method_compiler.rb b/lib/mom/method_compiler.rb index b67bdf50..bb103cff 100644 --- a/lib/mom/method_compiler.rb +++ b/lib/mom/method_compiler.rb @@ -71,7 +71,9 @@ module Mom if index = @callable.arguments_type.variable_index(name) return ["arg#{index}".to_sym] end - [:frame , name] + index = @callable.frame_type.variable_index(name) + raise "no such local or argument #{name}" unless index + return ["local#{index}".to_sym] end def add_block_compiler(compiler) diff --git a/lib/parfait/message.rb b/lib/parfait/message.rb index 7011c0e3..42f96975 100644 --- a/lib/parfait/message.rb +++ b/lib/parfait/message.rb @@ -16,14 +16,17 @@ module Parfait # :caller => :Message , :name => :Word , :arguments => :NamedList attr :type, :next_message - attr :receiver , :frame + attr :receiver attr :return_address, :return_value attr :caller , :method attr :arguments_given attr :arg1 , :arg2, :arg3, :arg4, :arg5, :arg6 + attr :locals_used + attr :local1 , :local2, :local3, :local4, :local5, :local6 ,:local7,:local8 + attr :local9 ,:local10, :local11 , :local12, :local13, :local14 def self.type_length - 16 + 31 end def self.memory_size 32 @@ -31,10 +34,13 @@ module Parfait def self.args_start_at Parfait.object_space.get_type_by_class_name(:Message).variable_index(:arguments_given) end + def self.locals_start_at + Parfait.object_space.get_type_by_class_name(:Message).variable_index(:locals_used) + end def initialize( ) super() - self.frame = NamedList.new() + self.locals_used = Parfait::Integer.new(0) self.arguments_given = Parfait::Integer.new(0) end public :initialize diff --git a/lib/parfait/space.rb b/lib/parfait/space.rb index 59198850..8c77ae47 100644 --- a/lib/parfait/space.rb +++ b/lib/parfait/space.rb @@ -58,8 +58,11 @@ module Parfait end def init_message_chain( message ) + prev = nil while(message) message.initialize + message.caller = prev if prev + prev = message message = message.next_message end end