From 01151b4ba733a7245562fd645876bafb6eb0c70a Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Wed, 21 Mar 2018 22:05:51 +0530 Subject: [PATCH] make continue labels unique --- lib/mom/instruction/simple_call.rb | 2 +- test/mom/test_send_dynamic.rb | 2 +- test/mom/test_send_simple.rb | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/mom/instruction/simple_call.rb b/lib/mom/instruction/simple_call.rb index 8802cadb..d4dab021 100644 --- a/lib/mom/instruction/simple_call.rb +++ b/lib/mom/instruction/simple_call.rb @@ -21,7 +21,7 @@ module Mom # return_address of the next_message, for the ReturnSequence to pick it up. def to_risc(compiler) jump_address = compiler.use_reg(:int) - return_label = Risc::Label.new(self,"continue") + return_label = Risc::Label.new(self,"continue_#{object_id}") save_return = SlotLoad.new([:message,:next_message,:return_address],[return_label]) moves = save_return.to_risc(compiler) moves << Risc.slot_to_reg(self, :message , :next_message , Risc.message_reg) diff --git a/test/mom/test_send_dynamic.rb b/test/mom/test_send_dynamic.rb index f5f58d3a..f4a94e89 100644 --- a/test/mom/test_send_dynamic.rb +++ b/test/mom/test_send_dynamic.rb @@ -32,7 +32,7 @@ module Risc def test_cache_check produced = produce_body assert_equal NotSame , produced.next(3).class - assert produced.next(34) , produced.next(3).label + assert_equal produced.next(34) , produced.next(3).label end def test_check_resolve produced = produce_body diff --git a/test/mom/test_send_simple.rb b/test/mom/test_send_simple.rb index c9f2d07b..7c027630 100644 --- a/test/mom/test_send_simple.rb +++ b/test/mom/test_send_simple.rb @@ -21,6 +21,10 @@ module Risc assert_equal FunctionCall , produced.next(19).class assert_equal :mod4 , produced.next(19).method.name end + def test_check_continue + produced = produce_body + assert produced.next(20).name.start_with?("continue_") + end def test_load_label produced = produce_body assert_equal Label , produced.next(14).constant.known_object.class