diff --git a/lib/risc.rb b/lib/risc.rb index e987d5c6..40fa9a4e 100644 --- a/lib/risc.rb +++ b/lib/risc.rb @@ -20,7 +20,7 @@ module Risc # module method to reset, and init def self.boot! Position.clear_positions -# Builtin.boot_functions + Builtin.boot_functions end end diff --git a/test/vool/class_send/helper.rb b/test/vool/class_send/helper.rb index 51d92d8b..b303ac62 100644 --- a/test/vool/class_send/helper.rb +++ b/test/vool/class_send/helper.rb @@ -4,12 +4,13 @@ module Vool # relies on @ins and receiver_type method module ClassHarness - include MomCompile + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) - #Risc::Builtin.boot_functions - @ins = compile_first_method( send_method ) + Risc.boot! + @compiler = compile_first_method( send_method ) + @ins = @compiler.mom_instructions.next end def test_first_not_array @@ -19,7 +20,7 @@ module Vool assert_equal Mom::MessageSetup , @ins.class , @ins end def test_two_instructions_are_returned - assert_equal 3 , @ins.length , @ins + assert_equal 6 , @ins.length , @ins end def test_receiver_move_class assert_equal Mom::ArgumentTransfer, @ins.next(1).class @@ -37,7 +38,8 @@ module Vool assert_equal Parfait::CallableMethod, @ins.next(2).method.class end def test_array - check_array [Mom::MessageSetup,Mom::ArgumentTransfer,Mom::SimpleCall] , @ins + check_array [MessageSetup,ArgumentTransfer,SimpleCall,Label, + ReturnSequence , Label] , @ins end end diff --git a/test/vool/class_send/test_class_def.rb b/test/vool/class_send/test_class_def.rb index f75139c0..00d4056f 100644 --- a/test/vool/class_send/test_class_def.rb +++ b/test/vool/class_send/test_class_def.rb @@ -17,16 +17,8 @@ module Vool end def setup - statements = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_vool(class_main) - assert_equal Vool::ClassStatement, statements.class - ret = statements.to_mom(nil) - assert_equal Parfait::Class , statements.clazz.class , statements - @method = statements.clazz.get_method(:main) - assert_equal Parfait::VoolMethod , @method.class - assert_equal Mom::MomCompiler , ret.class - compiler = ret.method_compilers.find{|c| c.get_method.name == :main } - assert_equal Risc::MethodCompiler , compiler.class - @ins = @method.source.to_mom( compiler ) + ret = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(class_main) + @ins = ret.compilers.first.mom_instructions.next end def test_any @@ -35,7 +27,7 @@ module Vool def test_no_arg assert_equal Mom::ArgumentTransfer, @ins.next(1).class - assert_equal 0, @ins.next(1).arguments.length + assert_equal 1, @ins.next(1).arguments.length end def test_call_two assert_equal SimpleCall, @ins.next(2).class diff --git a/test/vool/class_send/test_harness.rb b/test/vool/class_send/test_harness.rb index d12f52c7..11527c37 100644 --- a/test/vool/class_send/test_harness.rb +++ b/test/vool/class_send/test_harness.rb @@ -2,7 +2,6 @@ require_relative "helper" module Vool class ClassSendHarness < MiniTest::Test - include MomCompile include ClassHarness def send_method diff --git a/test/vool/class_send/test_send_class.rb b/test/vool/class_send/test_send_class.rb index fef6aa62..fcf6318f 100644 --- a/test/vool/class_send/test_send_class.rb +++ b/test/vool/class_send/test_send_class.rb @@ -3,7 +3,6 @@ require_relative "helper" module Vool class TestSendClassMom < MiniTest::Test include ClassHarness - include Mom def send_method "Object.get_internal_word(0)" diff --git a/test/vool/send/helper.rb b/test/vool/send/helper.rb index 84f7798f..04651c92 100644 --- a/test/vool/send/helper.rb +++ b/test/vool/send/helper.rb @@ -4,27 +4,29 @@ module Vool # relies on @ins and receiver_type method module SimpleSendHarness include VoolCompile + include Mom def setup Parfait.boot!(Parfait.default_test_options) - #Risc::Builtin.boot_functions - @ins = compile_first_method( send_method ) + Risc::Builtin.boot_functions + @compiler = compile_first_method( send_method ) + @ins = @compiler.mom_instructions.next end def test_first_not_array assert Array != @ins.class , @ins end def test_class_compiles - assert_equal Mom::MessageSetup , @ins.class , @ins + assert_equal MessageSetup , @ins.class , @ins end def test_two_instructions_are_returned - assert_equal 3 , @ins.length , @ins + assert_equal 6 , @ins.length , @ins end def test_receiver_move_class - assert_equal Mom::ArgumentTransfer, @ins.next(1).class + assert_equal ArgumentTransfer, @ins.next(1).class end def test_receiver_move - assert_equal Mom::SlotDefinition, @ins.next.receiver.class + assert_equal SlotDefinition, @ins.next.receiver.class end def test_receiver type , value = receiver @@ -32,13 +34,14 @@ module Vool assert_equal value, @ins.next.receiver.known_object.value end def test_call_is - assert_equal Mom::SimpleCall, @ins.next(2).class + assert_equal SimpleCall, @ins.next(2).class end def test_call_has_method assert_equal Parfait::CallableMethod, @ins.next(2).method.class end def test_array - check_array [Mom::MessageSetup,Mom::ArgumentTransfer,Mom::SimpleCall] , @ins + check_array [MessageSetup,ArgumentTransfer,SimpleCall,Label, ReturnSequence , + Label] , @ins end end end diff --git a/test/vool/send/test_send_args_send.rb b/test/vool/send/test_send_args_send.rb index b76afde8..de04c079 100644 --- a/test/vool/send/test_send_args_send.rb +++ b/test/vool/send/test_send_args_send.rb @@ -2,8 +2,7 @@ require_relative "helper" module Vool class TestSendArgsSendMom < MiniTest::Test - include MomCompile - include Mom + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) @@ -14,7 +13,8 @@ module Vool def test_array check_array [MessageSetup, ArgumentTransfer, SimpleCall, SlotLoad, MessageSetup , - ArgumentTransfer, SimpleCall, SlotLoad] , @ins + ArgumentTransfer, SimpleCall, SlotLoad ,Label, ReturnSequence , + Label] , @ins end def test_one_call diff --git a/test/vool/send/test_send_cached_simple.rb b/test/vool/send/test_send_cached_simple.rb index 78334a20..7e9f4318 100644 --- a/test/vool/send/test_send_cached_simple.rb +++ b/test/vool/send/test_send_cached_simple.rb @@ -2,34 +2,34 @@ require_relative "../helper" module Vool class TestSendCachedSimpleMom < MiniTest::Test - include MomCompile - include Mom + include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) @compiler = compile_first_method( "a = 5; a.div4") @ins = @compiler.mom_instructions.next end - def pest_check_type + def test_check_type assert_equal NotSameCheck , @ins.next.class , @ins end - def pest_type_update + def test_type_update load = @ins.next(2) assert_equal :message , load.right.known_object , load assert_equal :frame , load.right.slots[0] , load assert_equal :a , load.right.slots[1] , load assert_equal :type , load.right.slots[2] , load end - def pest_check_resolve_call + def test_check_resolve_call assert_equal ResolveMethod , @ins.next(3).class , @ins end - def pest_dynamic_call_last - assert_equal DynamicCall , @ins.last.class , @ins + def test_dynamic_call_last + assert_equal DynamicCall , @ins.next(7).class , @ins end - def pest_array + def test_array check_array [SlotLoad, NotSameCheck, SlotLoad, ResolveMethod, Label, MessageSetup , - ArgumentTransfer, DynamicCall] , @ins + ArgumentTransfer, DynamicCall, Label, ReturnSequence , + Label] , @ins end end diff --git a/test/vool/send/test_send_self.rb b/test/vool/send/test_send_self.rb index 8d782a23..89134a52 100644 --- a/test/vool/send/test_send_self.rb +++ b/test/vool/send/test_send_self.rb @@ -3,7 +3,6 @@ require_relative "helper" module Vool class TestSendSelfMom < MiniTest::Test include SimpleSendHarness - include Mom def send_method "self.get_internal_word(0)" diff --git a/test/vool/send/test_send_simple_args.rb b/test/vool/send/test_send_simple_args.rb index 948c6bac..4b32aa23 100644 --- a/test/vool/send/test_send_simple_args.rb +++ b/test/vool/send/test_send_simple_args.rb @@ -20,7 +20,8 @@ module Vool assert_equal 2, @ins.next(1).arguments[1].right.known_object.value end def test_array - check_array [Mom::MessageSetup,Mom::ArgumentTransfer,Mom::SimpleCall] , @ins + check_array [MessageSetup,ArgumentTransfer,SimpleCall, Label, ReturnSequence , + Label] , @ins end end end