From eea92399eea346beb65c2e2fba32d66bd074c114 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Fri, 6 Apr 2018 23:11:08 +0300 Subject: [PATCH] concludes static message setup --- lib/mom/instruction/message_setup.rb | 10 +++--- test/mom/send/test_setup_simple.rb | 49 +++++++++++++++++++++++----- 2 files changed, 47 insertions(+), 12 deletions(-) diff --git a/lib/mom/instruction/message_setup.rb b/lib/mom/instruction/message_setup.rb index 9046e7e5..5f085ed6 100644 --- a/lib/mom/instruction/message_setup.rb +++ b/lib/mom/instruction/message_setup.rb @@ -49,18 +49,20 @@ module Mom message[:next_message] << next_message next_message[:caller] << message + type << typed_method[:arguments_type] named_list << next_message[:arguments] - type << typed_method[:arguments_type] named_list[:type] << type + type << typed_method[:frame_type] named_list << next_message[:frame] - type << typed_method[:arguments_type] named_list[:type] << type - name << typed_method[:arguments_type] - named_list[:type] << name + name << typed_method[:name] + next_message[:name] << name #store next.next back into space + #FIXME in a multithreaded future this should be done soon after getting + # the first_message, using lock free compare and swap. Now saving regs next_message << next_message[:next_message] space[:first_message] << next_message end diff --git a/test/mom/send/test_setup_simple.rb b/test/mom/send/test_setup_simple.rb index ca0a94f8..860e6a43 100644 --- a/test/mom/send/test_setup_simple.rb +++ b/test/mom/send/test_setup_simple.rb @@ -36,20 +36,53 @@ module Risc sl = @produced.next( 3 ) assert_reg_to_slot( sl , :r3 , :r0 , 2 ) end - def pest_store_message_in_current + def test_store_caller_in_message sl = @produced.next( 4 ) - assert_reg_to_slot( sl , :r4 , :r3 , 7 ) + assert_reg_to_slot( sl , :r0 , :r3 , 7 ) end - def pest_store_current_message + + def test_get_args_type #from method in r1 sl = @produced.next( 5 ) - assert_reg_to_slot( sl , :r2 , :r0 , 2 ) + assert_slot_to_reg( sl , :r1 , 7 , :r4 ) + end + def test_get_args #from message + sl = @produced.next( 6 ) + assert_slot_to_reg( sl , :r3 , 9 , :r5 ) + end + def test_store_type_in_args + sl = @produced.next( 7 ) + assert_reg_to_slot( sl , :r4 , :r5 , 1 ) end - - def pest_load_next_message - sl = @produced.next( 3 ) - assert_slot_to_reg( sl , :r2 , 2 , :r4 ) + def test_get_frame_type #from method in r1 + sl = @produced.next( 8 ) + assert_slot_to_reg( sl , :r1 , 9 , :r4 ) + end + def test_get_frame #from message + sl = @produced.next( 9 ) + assert_slot_to_reg( sl , :r3 , 4 , :r5 ) + end + def test_store_type_in_frame + sl = @produced.next( 10 ) + assert_reg_to_slot( sl , :r4 , :r5 , 1 ) end + def test_get_name + sl = @produced.next( 11 ) + assert_slot_to_reg( sl , :r1 , 2 , :r6 ) + end + def test_store_name_in_message + sl = @produced.next( 12 ) + assert_reg_to_slot( sl , :r6 , :r3 , 8 ) + end + + def test_get_next_next #reduce onto itself + sl = @produced.next( 13 ) + assert_slot_to_reg( sl , :r3 , 2 , :r3 ) + end + def test_store_next_next_in_space + sl = @produced.next( 14 ) + assert_reg_to_slot( sl , :r3 , :r2 , 4 ) + end end end