diff --git a/lib/soml/compiler/assignment.rb b/lib/soml/compiler/assignment.rb index 507297e3..24dbef03 100644 --- a/lib/soml/compiler/assignment.rb +++ b/lib/soml/compiler/assignment.rb @@ -11,14 +11,14 @@ module Soml code = nil if( index = @method.has_arg(name)) # TODO, check type @method.arguments[index].type - code = Register.set_slot(statement , v , :message , index + Parfait::Message.offset ) + code = Register.set_slot(statement , v , :message , Parfait::Message.get_indexed(index) ) else # or a local so it is in the frame index = @method.has_local( name ) if(index) # TODO, check type @method.locals[index].type frame = use_reg(:Frame) add_code Register.get_slot(statement , :message , :frame , frame ) - code = Register.set_slot(statement , v , frame , index + Parfait::Frame.offset ) + code = Register.set_slot(statement , v , frame , Parfait::Frame.get_indexed(index) ) end end if( code ) diff --git a/lib/soml/compiler/call_site.rb b/lib/soml/compiler/call_site.rb index 644be01b..0a434958 100644 --- a/lib/soml/compiler/call_site.rb +++ b/lib/soml/compiler/call_site.rb @@ -35,7 +35,7 @@ module Soml val = process( arg) raise "Not register #{val}" unless val.is_a?(Register::RegisterValue) # which we load int the new_message at the argument's index (the one comes from c index) - set = Register.set_slot( statement , val , :new_message , i + 1 + Parfait::Message.offset) + set = Register.set_slot( statement , val , :new_message , Parfait::Message.get_indexed(i+1)) add_code set end diff --git a/lib/soml/compiler/name_expression.rb b/lib/soml/compiler/name_expression.rb index 5d553d5a..14a6c7a6 100644 --- a/lib/soml/compiler/name_expression.rb +++ b/lib/soml/compiler/name_expression.rb @@ -15,7 +15,7 @@ module Soml # either an argument, so it's stored in message if( index = @method.has_arg(name)) ret = use_reg @method.arguments[index].type - add_code Register.get_slot(statement , :message , index + Parfait::Message.offset , ret ) + add_code Register.get_slot(statement , :message , Parfait::Message.get_indexed(index), ret ) return ret else # or a local so it is in the frame index = @method.has_local( name ) @@ -23,7 +23,7 @@ module Soml frame = use_reg :Frame add_code Register.get_slot(statement , :message , :frame , frame ) ret = use_reg @method.locals[index].type - add_code Register.get_slot(statement , frame , index + Parfait::Frame.offset , ret ) + add_code Register.get_slot(statement , frame , Parfait::Frame.get_indexed(index), ret ) return ret end end diff --git a/test/compiler/statements/test_assign.rb b/test/compiler/statements/test_assign.rb index 0e3209ad..8fd8f90d 100644 --- a/test/compiler/statements/test_assign.rb +++ b/test/compiler/statements/test_assign.rb @@ -78,11 +78,11 @@ HERE end def test_assign_arg - Register.machine.space.get_main.arguments.push Parfait::Variable.new(:Integer , :bar) + Register.machine.space.get_main.arguments.push Parfait::Variable.new(:Integer , :blar) @string_input = <= 1 end