make continue labels unique

This commit is contained in:
Torsten Ruger 2018-03-21 22:05:51 +05:30
parent e0dd4e0ad7
commit 01151b4ba7
3 changed files with 6 additions and 2 deletions

View File

@ -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)

View File

@ -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

View File

@ -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