diff --git a/lib/mom/instruction/message_setup.rb b/lib/mom/instruction/message_setup.rb index e1c7005a..ce5e5824 100644 --- a/lib/mom/instruction/message_setup.rb +++ b/lib/mom/instruction/message_setup.rb @@ -54,8 +54,7 @@ module Mom def get_message_to( builder ) builder.build do space << Parfait.object_space - space[:first_message] >> next_message - #risc << Risc.slot_to_reg(source + "get next message" , space , :first_message , message) + next_message << space[:first_message] end end def nnop diff --git a/lib/risc/risc_value.rb b/lib/risc/risc_value.rb index d556b83e..34cdab40 100644 --- a/lib/risc/risc_value.rb +++ b/lib/risc/risc_value.rb @@ -68,6 +68,8 @@ module Risc ins = Risc.load_constant("#{load.class} to #{self.type}" , load , self) when RiscValue ins = Risc.transfer("#{load.type} to #{self.type}" , load , self) + when RValue + load >> self else raise "not implemented" end diff --git a/test/risc/test_builder.rb b/test/risc/test_builder.rb index 86e7d046..d44ad916 100644 --- a/test/risc/test_builder.rb +++ b/test/risc/test_builder.rb @@ -35,6 +35,12 @@ module Risc assert_equal SlotToReg , built.class assert_equal :r1 , built.array.symbol end + def test_returns_slot_reverse + r2 = RiscValue.new(:r2 , :Message) + built = @builder.build{ r2 << space[:first_message] } + assert_equal SlotToReg , built.class + assert_equal :r1 , built.array.symbol + end def test_reuses_names r1 = RiscValue.new(:r1 , :Space) built = @builder.build{ space << r1 ; space << r1}