diff --git a/lib/rubyx/rubyx_compiler.rb b/lib/rubyx/rubyx_compiler.rb index 1c7e6a5a..19389b16 100644 --- a/lib/rubyx/rubyx_compiler.rb +++ b/lib/rubyx/rubyx_compiler.rb @@ -19,8 +19,8 @@ module RubyX attr_reader :vool # initialize boots Parfait and Risc (ie load Builin) - def initialize - Parfait.boot! + def initialize(options) + Parfait.boot!(options) Risc.boot! end @@ -96,8 +96,8 @@ module RubyX end - def self.ruby_to_binary( ruby , platform) - compiler = RubyXCompiler.new + def self.ruby_to_binary( ruby , platform , options) + compiler = RubyXCompiler.new(options) compiler.ruby_to_vool(ruby) # integrate other sources into vool tree diff --git a/lib/rubyx/rubyxc.rb b/lib/rubyx/rubyxc.rb index f0cecd08..3483e11b 100644 --- a/lib/rubyx/rubyxc.rb +++ b/lib/rubyx/rubyxc.rb @@ -22,7 +22,7 @@ class RubyXC < Thor end puts "compiling #{file}" - linker = ::RubyX::RubyXCompiler.new.ruby_to_binary( ruby , :arm ) + linker = ::RubyX::RubyXCompiler.new({}).ruby_to_binary( ruby , :arm ) writer = Elf::ObjectWriter.new(linker) outfile = file.split("/").last.gsub(".rb" , ".o") diff --git a/test/arm/helper.rb b/test/arm/helper.rb index c0d49fbb..446c2ed1 100644 --- a/test/arm/helper.rb +++ b/test/arm/helper.rb @@ -15,7 +15,7 @@ module Arm end module ArmHelper def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @machine = Arm::ArmMachine @binary = FakeBin.new Risc::Position.clear_positions diff --git a/test/arm/test_call.rb b/test/arm/test_call.rb index 1581af7d..5441f8e1 100644 --- a/test/arm/test_call.rb +++ b/test/arm/test_call.rb @@ -25,7 +25,7 @@ module Arm assert_nil code.branch_to end def test_method_call - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) bin = Parfait::BinaryCode.new(1) Risc::Position.new(bin).set(0x20) code = @machine.call( bin ,{} )#this jumps to the next instruction diff --git a/test/arm/test_translator.rb b/test/arm/test_translator.rb index 33d1bf5b..447db0b3 100644 --- a/test/arm/test_translator.rb +++ b/test/arm/test_translator.rb @@ -4,7 +4,7 @@ module Arm class TestTranslator < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @jump = Risc::DynamicJump.new("" , :r1) @codes = Translator.new.translate @jump end diff --git a/test/elf/helper.rb b/test/elf/helper.rb index e45a5555..bdcbd0eb 100644 --- a/test/elf/helper.rb +++ b/test/elf/helper.rb @@ -17,7 +17,7 @@ module Elf in_space("def main(arg);#{input};end") end def check(input, file) - linker = RubyX::RubyXCompiler.new.ruby_to_binary( input , :arm ) + linker = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_binary( input , :arm ) writer = Elf::ObjectWriter.new(linker) writer.save "test/#{file}.o" end diff --git a/test/elf/test_zero.rb b/test/elf/test_zero.rb index 242883d7..c6c006ca 100644 --- a/test/elf/test_zero.rb +++ b/test/elf/test_zero.rb @@ -6,7 +6,7 @@ module Elf def setup super - @linker = RubyX::RubyXCompiler.new.ruby_to_risc(as_main("return 1"),:arm) + @linker = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_risc(as_main("return 1"),:arm) @linker.position_all @linker.create_binary end diff --git a/test/mom/helper.rb b/test/mom/helper.rb index d1028648..d8fac328 100644 --- a/test/mom/helper.rb +++ b/test/mom/helper.rb @@ -29,7 +29,7 @@ module Risc end def produce_instructions assert @expect , "No output given" - linker = RubyX::RubyXCompiler.new.ruby_to_risc(as_test_main,:interpreter) + linker = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_risc(as_test_main,:interpreter) compiler = linker.assemblers.find{|c| c.callable.name == :main and c.callable.self_type.object_class.name == :Test} compiler.instructions end diff --git a/test/mom/instruction/test_slot_definition1.rb b/test/mom/instruction/test_slot_definition1.rb index 4b5a5392..189c4aea 100644 --- a/test/mom/instruction/test_slot_definition1.rb +++ b/test/mom/instruction/test_slot_definition1.rb @@ -4,7 +4,7 @@ module Mom class TestSlotDefinitionConstant < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @compiler = Risc::FakeCompiler.new @definition = SlotDefinition.new(StringConstant.new("hi") , []) @register = @definition.to_register(@compiler , InstructionMock.new) diff --git a/test/mom/instruction/test_slot_definition2.rb b/test/mom/instruction/test_slot_definition2.rb index 94ab0943..49f72eaa 100644 --- a/test/mom/instruction/test_slot_definition2.rb +++ b/test/mom/instruction/test_slot_definition2.rb @@ -3,7 +3,7 @@ require_relative "helper" module Mom class TestSlotDefinitionKnown1 < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @compiler = Risc::FakeCompiler.new @definition = SlotDefinition.new(:message , :caller) @register = @definition.to_register(@compiler , "fake source") diff --git a/test/mom/instruction/test_slot_definition3.rb b/test/mom/instruction/test_slot_definition3.rb index 9b3f5e39..521ff3da 100644 --- a/test/mom/instruction/test_slot_definition3.rb +++ b/test/mom/instruction/test_slot_definition3.rb @@ -3,7 +3,7 @@ require_relative "helper" module Mom class TestSlotDefinitionKnown2 < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @compiler = Risc::FakeCompiler.new @definition = SlotDefinition.new(:message , [:caller , :type]) @register = @definition.to_register(@compiler , InstructionMock.new) diff --git a/test/mom/instruction/test_slot_load1.rb b/test/mom/instruction/test_slot_load1.rb index 6736a9dc..66e9fbb0 100644 --- a/test/mom/instruction/test_slot_load1.rb +++ b/test/mom/instruction/test_slot_load1.rb @@ -4,7 +4,7 @@ module Mom class TestSlotLoad1 < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) load = SlotLoad.new( [:message, :caller] , [:message,:type] ) @compiler = Risc::FakeCompiler.new load.to_risc(@compiler) diff --git a/test/mom/instruction/test_slot_load2.rb b/test/mom/instruction/test_slot_load2.rb index 1d7dad14..3f8f3dd3 100644 --- a/test/mom/instruction/test_slot_load2.rb +++ b/test/mom/instruction/test_slot_load2.rb @@ -4,7 +4,7 @@ module Mom class TestSlotLoad2 < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @compiler = Risc::FakeCompiler.new load = SlotLoad.new( [:message, :caller, :type] , [:message, :caller , :type] ) load.to_risc(@compiler) diff --git a/test/mom/test_block_statement.rb b/test/mom/test_block_statement.rb index 239c253a..f79a9fbb 100644 --- a/test/mom/test_block_statement.rb +++ b/test/mom/test_block_statement.rb @@ -6,7 +6,7 @@ module Vool include MomCompile def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ret = compile_mom( as_test_main("self.main {|elem| elem = 5 } ")) end def test_is_compiler @@ -22,7 +22,7 @@ module Vool class TestBlockLocal < MiniTest::Test include MomCompile def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ret = compile_mom( as_test_main("self.main {|elem| local = 5 } ")) @block = @ret.method_compilers.first.get_method.blocks end @@ -43,7 +43,7 @@ module Vool include MomCompile def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) end def test_method_arg_compiles ret = compile_mom( as_test_main("self.main {|elem| arg = 5 } ")) diff --git a/test/mom/test_class_statement.rb b/test/mom/test_class_statement.rb index f2de9ada..b3f48a50 100644 --- a/test/mom/test_class_statement.rb +++ b/test/mom/test_class_statement.rb @@ -6,7 +6,7 @@ module Vool include MomCompile def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ret = compile_mom( as_test_main("return 1")) end diff --git a/test/mom/test_mom_compiler.rb b/test/mom/test_mom_compiler.rb index 5a501df9..5ba6c0c3 100644 --- a/test/mom/test_mom_compiler.rb +++ b/test/mom/test_mom_compiler.rb @@ -5,7 +5,7 @@ module Mom include MomCompile def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @comp = compile_mom( "class Test ; def main(); return 'Hi'; end; end;") end diff --git a/test/mom/test_mom_compiler1.rb b/test/mom/test_mom_compiler1.rb index e37e6985..402238a7 100644 --- a/test/mom/test_mom_compiler1.rb +++ b/test/mom/test_mom_compiler1.rb @@ -5,7 +5,7 @@ module Mom include MomCompile def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @comp = compile_mom( "class Test ; def main(); main{return 'Ho'};return 'Hi'; end; end;") @linker = @comp.translate(:interpreter) end diff --git a/test/parfait/test_factory.rb b/test/parfait/test_factory.rb index 658f4bc0..0d1095f7 100644 --- a/test/parfait/test_factory.rb +++ b/test/parfait/test_factory.rb @@ -23,6 +23,16 @@ module Parfait def test_get_next_object assert_equal Parfait::Integer , @factory.get_next_object.class end + def test_default_page + assert_equal 1024 , Factory.page_size + end + def test_default_reserve + assert_equal 10 , Factory.reserve_size + end + def test_set_page + assert_equal 10 , Factory.page_size = 10 + Factory.page_size = 1024 + end def test_first_is_reserve @factory.get_next_object assert_equal Parfait::Integer , @factory.reserve.class diff --git a/test/parfait/test_word.rb b/test/parfait/test_word.rb index c0964ca9..3a876ffd 100644 --- a/test/parfait/test_word.rb +++ b/test/parfait/test_word.rb @@ -4,7 +4,7 @@ module Parfait class TestEmptyWord < ParfaitTest def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @word = Parfait::Word.new(0) end def test_word_create diff --git a/test/risc/position/helper.rb b/test/risc/position/helper.rb index c33346d6..0add812b 100644 --- a/test/risc/position/helper.rb +++ b/test/risc/position/helper.rb @@ -21,7 +21,7 @@ module Risc end class DummyPlatform def self.boot - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc.boot! end def translator diff --git a/test/risc/position/test_branch_listener.rb b/test/risc/position/test_branch_listener.rb index 0426237e..691f4d0e 100644 --- a/test/risc/position/test_branch_listener.rb +++ b/test/risc/position/test_branch_listener.rb @@ -4,7 +4,7 @@ require 'minitest/mock' module Risc class TestBranchListenerBooted < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc.boot! @binary = Parfait::BinaryCode.new(1) @bin_pos = CodeListener.init(@binary,:interpreter).set(0) diff --git a/test/risc/position/test_code_listener.rb b/test/risc/position/test_code_listener.rb index d8bff78b..5db256c1 100644 --- a/test/risc/position/test_code_listener.rb +++ b/test/risc/position/test_code_listener.rb @@ -3,7 +3,7 @@ require_relative "helper" module Risc class TestCodeListener < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @binary = Parfait::BinaryCode.new(1) @method = Parfait.object_space.types.values.first.methods @label = Risc.label("hi","ho") diff --git a/test/risc/position/test_code_listener1.rb b/test/risc/position/test_code_listener1.rb index 3c341f57..dccfdb5f 100644 --- a/test/risc/position/test_code_listener1.rb +++ b/test/risc/position/test_code_listener1.rb @@ -3,7 +3,7 @@ require_relative "helper" module Risc class TestCodeListenerFull < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc.boot! @linker = Mom::MomCompiler.new.translate(:interpreter) @binary = Parfait::BinaryCode.new(1) diff --git a/test/risc/position/test_code_position.rb b/test/risc/position/test_code_position.rb index d302f479..0e4349cd 100644 --- a/test/risc/position/test_code_position.rb +++ b/test/risc/position/test_code_position.rb @@ -3,7 +3,7 @@ require_relative "helper" module Risc class TestPositionTranslated < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc.boot! @binary = Parfait::BinaryCode.new(1) @method = Parfait.object_space.types.values.first.methods diff --git a/test/risc/position/test_instruction_listener.rb b/test/risc/position/test_instruction_listener.rb index 54fdea58..f2a91ab8 100644 --- a/test/risc/position/test_instruction_listener.rb +++ b/test/risc/position/test_instruction_listener.rb @@ -3,7 +3,7 @@ require_relative "helper" module Risc class TestInstructionListener < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @binary = Parfait::BinaryCode.new(1) @bin_pos = Position.new(@binary).set(0) @instruction = DummyInstruction.new(DummyInstruction.new) diff --git a/test/risc/position/test_label_listener.rb b/test/risc/position/test_label_listener.rb index aebf7345..859ddd0e 100644 --- a/test/risc/position/test_label_listener.rb +++ b/test/risc/position/test_label_listener.rb @@ -4,7 +4,7 @@ module Risc class TestLabelListener < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @label = Label.new("Hi","Ho" , FakeAddress.new(5)) @label_pos = Position.new(@label ).set(4) @code = Parfait::BinaryCode.new(1) diff --git a/test/risc/position/test_position.rb b/test/risc/position/test_position.rb index 42b360f1..39f69e35 100644 --- a/test/risc/position/test_position.rb +++ b/test/risc/position/test_position.rb @@ -14,7 +14,7 @@ module Risc assert !@pos.valid? end def test_next_slot - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) mov = Arm::ArmMachine.mov(:r1 , :r1) position = Position.new(mov ).set(0) assert_equal 4, position.next_slot diff --git a/test/risc/position/test_position3.rb b/test/risc/position/test_position3.rb index de04e8ad..5a4060fe 100644 --- a/test/risc/position/test_position3.rb +++ b/test/risc/position/test_position3.rb @@ -3,7 +3,7 @@ require_relative "helper" module Risc class TestMachinePositions < MiniTest::Test def setup_for(platform) - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc.boot! @linker = Mom::MomCompiler.new.translate(platform) @linker.position_all diff --git a/test/risc/test_builder.rb b/test/risc/test_builder.rb index 11847dc2..e0fcf969 100644 --- a/test/risc/test_builder.rb +++ b/test/risc/test_builder.rb @@ -4,7 +4,7 @@ module Risc class TestCodeBuilder < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc.boot! init = Parfait.object_space.get_init @builder = Risc::MethodCompiler.new( init ).builder(init) diff --git a/test/risc/test_builder1.rb b/test/risc/test_builder1.rb index 95442b7b..c132fb5c 100644 --- a/test/risc/test_builder1.rb +++ b/test/risc/test_builder1.rb @@ -4,7 +4,7 @@ module Risc class TestCompilerBuilder < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc.boot! @init = Parfait.object_space.get_init @compiler = Risc::MethodCompiler.new( @init ) diff --git a/test/risc/test_builder2.rb b/test/risc/test_builder2.rb index 28b52e2a..8f6feb15 100644 --- a/test/risc/test_builder2.rb +++ b/test/risc/test_builder2.rb @@ -4,7 +4,7 @@ module Risc class TestBuilderInfer < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc.boot! @init = Parfait.object_space.get_init @compiler = Risc::MethodCompiler.new( @init ) diff --git a/test/risc/test_builtin.rb b/test/risc/test_builtin.rb index 06248df5..e1b4e020 100644 --- a/test/risc/test_builtin.rb +++ b/test/risc/test_builtin.rb @@ -4,7 +4,7 @@ module Risc class TestBuiltinFunction < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) end def test_has_boot_function assert Builtin.boot_functions diff --git a/test/risc/test_collector.rb b/test/risc/test_collector.rb index d67e1f84..61926aeb 100644 --- a/test/risc/test_collector.rb +++ b/test/risc/test_collector.rb @@ -4,7 +4,7 @@ module Risc class TestCollector < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc.boot! @linker = Mom::MomCompiler.new.translate(:arm) end diff --git a/test/risc/test_interpreter.rb b/test/risc/test_interpreter.rb index 0a75fdbf..255989f8 100644 --- a/test/risc/test_interpreter.rb +++ b/test/risc/test_interpreter.rb @@ -3,7 +3,7 @@ require_relative "helper" module Risc class TestInterpreterBasics < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc.boot! @linker = Mom::MomCompiler.new.translate(:interpreter) end diff --git a/test/risc/test_interpreter_platform.rb b/test/risc/test_interpreter_platform.rb index bcb81875..ba4e2774 100644 --- a/test/risc/test_interpreter_platform.rb +++ b/test/risc/test_interpreter_platform.rb @@ -21,7 +21,7 @@ module Risc class TestIdentityTranslator < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc.boot! @translator = IdentityTranslator.new end diff --git a/test/risc/test_linker.rb b/test/risc/test_linker.rb index 80f94c22..51f2c2d9 100644 --- a/test/risc/test_linker.rb +++ b/test/risc/test_linker.rb @@ -4,7 +4,7 @@ module Risc class TestLinkerObjects < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc.boot! @linker = Mom::MomCompiler.new.translate(:arm) end @@ -19,7 +19,7 @@ module Risc end class TestLinkerInit < MiniTest::Test def setup - @linker = RubyX::RubyXCompiler.new.ruby_to_binary("class Space;def main;return 1;end;end",:arm) + @linker = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_binary("class Space;def main;return 1;end;end",:arm) end def test_pos_cpu assert_equal 0 , Position.get(@linker.cpu_init).at diff --git a/test/risc/test_linker1.rb b/test/risc/test_linker1.rb index 4f34ea8d..8d846477 100644 --- a/test/risc/test_linker1.rb +++ b/test/risc/test_linker1.rb @@ -4,7 +4,7 @@ module Risc class TestMachinePos < MiniTest::Test def setup code = "class Space; def main(arg);a = 1;return a;end;end" - @linker = RubyX::RubyXCompiler.new.ruby_to_risc(code,:arm) + @linker = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_risc(code,:arm) @linker.position_all end def test_positions_set diff --git a/test/risc/test_method_compiler.rb b/test/risc/test_method_compiler.rb index e8e988c9..b791ecb2 100644 --- a/test/risc/test_method_compiler.rb +++ b/test/risc/test_method_compiler.rb @@ -8,12 +8,12 @@ module Risc end def in_test_vool(str) - vool = RubyX::RubyXCompiler.new.ruby_to_vool(in_Test(str)) + vool = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_vool(in_Test(str)) vool.to_mom(nil) vool end def in_test_mom(str) - RubyX::RubyXCompiler.new(in_Test(str)).ruby_to_mom() + FIXMERubyX::RubyXCompiler.new(in_Test(str)).ruby_to_mom() end def create_method(body = "@ivar = 5") in_test_vool("def meth; #{body};end") @@ -64,7 +64,7 @@ module Risc assert_equal 2 , method.frame_type.variable_index(:a) end def constant_setup(input) - mom = RubyX::RubyXCompiler.new.ruby_to_mom(in_Test(input)) + mom = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(in_Test(input)) assert_equal Mom::MomCompiler , mom.class compiler = mom.method_compilers.first assert_equal MethodCompiler , compiler.class diff --git a/test/risc/test_padding.rb b/test/risc/test_padding.rb index 93dbf95c..1144a446 100644 --- a/test/risc/test_padding.rb +++ b/test/risc/test_padding.rb @@ -4,7 +4,7 @@ module Risc class TestPadding < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) end def test_small diff --git a/test/risc/test_parfait_adapter.rb b/test/risc/test_parfait_adapter.rb index 01b23296..ae00142a 100644 --- a/test/risc/test_parfait_adapter.rb +++ b/test/risc/test_parfait_adapter.rb @@ -4,7 +4,7 @@ module Parfait class TestAdapter < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) end def test_list_create_from_array diff --git a/test/risc/test_register_value.rb b/test/risc/test_register_value.rb index 708dd43a..55fa698b 100644 --- a/test/risc/test_register_value.rb +++ b/test/risc/test_register_value.rb @@ -10,7 +10,7 @@ module Risc class TestRegisterValue < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @r0 = RegisterValue.new(:r0 , :Message) @r1 = RegisterValue.new(:r1 , :Space) @r2 = RegisterValue.new(:r1 , :Factory) diff --git a/test/risc/test_register_value1.rb b/test/risc/test_register_value1.rb index d8932410..18c17e9f 100644 --- a/test/risc/test_register_value1.rb +++ b/test/risc/test_register_value1.rb @@ -4,7 +4,7 @@ module Risc class TestRegisterValue1 < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @r0 = RegisterValue.new(:r0 , :Message) @r1 = RegisterValue.new(:r1 , :Space) @compiler = FakeCompiler.new diff --git a/test/risc/test_text_writer.rb b/test/risc/test_text_writer.rb index ff49825a..fe6c931a 100644 --- a/test/risc/test_text_writer.rb +++ b/test/risc/test_text_writer.rb @@ -4,7 +4,7 @@ module Risc class TestTextWriter < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc.boot! @linker = Mom::MomCompiler.new.translate(:arm) end @@ -19,7 +19,7 @@ module Risc class TestTextWriterPositions < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc.boot! @linker = Mom::MomCompiler.new.translate(:arm) @linker.position_all diff --git a/test/risc/test_translator.rb b/test/risc/test_translator.rb index d3feb2e2..35805da3 100644 --- a/test/risc/test_translator.rb +++ b/test/risc/test_translator.rb @@ -4,7 +4,7 @@ module Risc class TestTranslator < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @translator = Arm::Translator.new end diff --git a/test/ruby/helper.rb b/test/ruby/helper.rb index 6ce5e69a..d07efeee 100644 --- a/test/ruby/helper.rb +++ b/test/ruby/helper.rb @@ -3,14 +3,14 @@ require_relative "../helper" module Ruby module RubyTests def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) end def compile(input) RubyCompiler.compile(input) end def ruby_to_vool(input) - RubyXCompiler.new(input).ruby_to_vool + FIXMERubyXCompiler.new(input).ruby_to_vool end end diff --git a/test/ruby/test_basic_values.rb b/test/ruby/test_basic_values.rb index 92d10616..b5b2c8d3 100644 --- a/test/ruby/test_basic_values.rb +++ b/test/ruby/test_basic_values.rb @@ -51,7 +51,7 @@ module Ruby include RubyTests def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) end def compile_const( input ) lst = compile( input ) @@ -83,7 +83,7 @@ module Ruby include RubyTests def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) end def compile_const( input ) lst = compile( input ) diff --git a/test/ruby/test_send_statement1.rb b/test/ruby/test_send_statement1.rb index 0cdc7441..17d0439f 100644 --- a/test/ruby/test_send_statement1.rb +++ b/test/ruby/test_send_statement1.rb @@ -67,7 +67,7 @@ module Ruby include RubyTests def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) end def test_int_receiver diff --git a/test/rubyx/helper.rb b/test/rubyx/helper.rb index ede5697b..8d1f8fb4 100644 --- a/test/rubyx/helper.rb +++ b/test/rubyx/helper.rb @@ -1,6 +1,7 @@ require_relative "../helper" module RubyX + module RubyXHelper def setup end @@ -9,10 +10,10 @@ module RubyX mom.translate(platform) end def ruby_to_vool(input) - RubyXCompiler.new.ruby_to_vool(input) + RubyXCompiler.new(RubyX.default_test_options).ruby_to_vool(input) end def ruby_to_mom(input) - RubyXCompiler.new.ruby_to_mom(input) + RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(input) end def compile_in_test( input ) vool = ruby_to_vool in_Test(input) diff --git a/test/rubyx/test_rubyx_compiler.rb b/test/rubyx/test_rubyx_compiler.rb index c2e1a432..56eb2aff 100644 --- a/test/rubyx/test_rubyx_compiler.rb +++ b/test/rubyx/test_rubyx_compiler.rb @@ -22,7 +22,7 @@ module RubyX end def test_space_is_unchanged_by_compile - compiler = RubyXCompiler.new + compiler = RubyXCompiler.new(RubyX.default_test_options) space1 = Parfait.object_space.get_class_by_name(:Space) compiler.ruby_to_vool "class Space ;end" space2 = Parfait.object_space.get_class_by_name(:Space) @@ -30,7 +30,7 @@ module RubyX end def test_space_type_is_unchanged_by_compile - compiler = RubyXCompiler.new + compiler = RubyXCompiler.new(RubyX.default_test_options) space1 = Parfait.object_space.get_type_by_class_name(:Space) compiler.ruby_to_vool "class Space ;end" space2 = Parfait.object_space.get_type_by_class_name(:Space) diff --git a/test/rubyx/test_rubyx_compiler1.rb b/test/rubyx/test_rubyx_compiler1.rb index f449180f..39264425 100644 --- a/test/rubyx/test_rubyx_compiler1.rb +++ b/test/rubyx/test_rubyx_compiler1.rb @@ -25,7 +25,7 @@ module RubyX end def test_space_type_is_unchanged_by_compile - compiler = RubyXCompiler.new + compiler = RubyXCompiler.new(RubyX.default_test_options) space1 = Parfait.object_space.get_type_by_class_name(:Space) compiler.ruby_to_vool "class Space ;end" space2 = Parfait.object_space.get_type_by_class_name(:Space) diff --git a/test/rubyx/test_rubyx_compiler3.rb b/test/rubyx/test_rubyx_compiler3.rb index e971fd9c..d70cf64b 100644 --- a/test/rubyx/test_rubyx_compiler3.rb +++ b/test/rubyx/test_rubyx_compiler3.rb @@ -9,23 +9,23 @@ module RubyX "class Space ; def #{name}(arg);return arg;end; end" end def test_return_linker - @linker = RubyXCompiler.ruby_to_binary(space_source_for("main"), :interpreter) + @linker = RubyXCompiler.ruby_to_binary(space_source_for("main"), :interpreter , RubyX.default_test_options) assert_equal Risc::Linker , @linker.class end def test_one_vool_call - compiler = RubyXCompiler.new + compiler = RubyXCompiler.new(RubyX.default_test_options) compiler.ruby_to_vool(space_source_for("main")) assert_equal Vool::ClassStatement , compiler.vool.class end def test_two_vool_calls - compiler = RubyXCompiler.new + compiler = RubyXCompiler.new(RubyX.default_test_options) compiler.ruby_to_vool(space_source_for("main")) compiler.ruby_to_vool(space_source_for("twain")) assert_equal Vool::ScopeStatement , compiler.vool.class assert_equal 2 , compiler.vool.length end def test_bin_two_sources - compiler = RubyXCompiler.new + compiler = RubyXCompiler.new(RubyX.default_test_options) compiler.ruby_to_vool(space_source_for("main")) compiler.ruby_to_vool(space_source_for("twain")) linker = compiler.to_binary(:interpreter) diff --git a/test/support/compiling.rb b/test/support/compiling.rb index b1ee6ddf..171724f6 100644 --- a/test/support/compiling.rb +++ b/test/support/compiling.rb @@ -22,7 +22,7 @@ module MomCompile include ScopeHelper def compile_method(input) - statements = RubyX::RubyXCompiler.new.ruby_to_vool(input) + statements = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_vool(input) assert statements.is_a?(Vool::ClassStatement) ret = statements.to_mom(nil) assert_equal Parfait::Class , statements.clazz.class , statements @@ -50,7 +50,7 @@ module MomCompile block.body.to_mom(block_c) end def compile_mom(input) - RubyX::RubyXCompiler.new.ruby_to_mom(input) + RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(input) end def check_array( should , is ) diff --git a/test/support/options.rb b/test/support/options.rb new file mode 100644 index 00000000..d49b01bd --- /dev/null +++ b/test/support/options.rb @@ -0,0 +1,11 @@ +module Parfait + def self.default_test_options + {} + end +end + +module RubyX + def self.default_test_options + { parfait: Parfait.default_test_options} + end +end diff --git a/test/support/parfait_test.rb b/test/support/parfait_test.rb index a79ece1f..b6931ab0 100644 --- a/test/support/parfait_test.rb +++ b/test/support/parfait_test.rb @@ -2,7 +2,7 @@ module Parfait class ParfaitTest < MiniTest::Test def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @space = Parfait.object_space end def make_method diff --git a/test/support/risc_interpreter.rb b/test/support/risc_interpreter.rb index 042fa1b0..8e3ddf01 100644 --- a/test/support/risc_interpreter.rb +++ b/test/support/risc_interpreter.rb @@ -7,7 +7,8 @@ module Risc include ScopeHelper def setup - @linker = RubyX::RubyXCompiler.new.ruby_to_binary(@string_input, :interpreter) + compiler = RubyX::RubyXCompiler.new(RubyX.default_test_options) + @linker = compiler.ruby_to_binary(@string_input, :interpreter) @interpreter = Interpreter.new(@linker) @interpreter.start_program end diff --git a/test/vool/blocks/test_assign.rb b/test/vool/blocks/test_assign.rb index 7db7b0ab..d8d2624c 100644 --- a/test/vool/blocks/test_assign.rb +++ b/test/vool/blocks/test_assign.rb @@ -5,7 +5,7 @@ module VoolBlocks include MomCompile def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ins = compile_first_block( "local = 5") end @@ -32,7 +32,7 @@ module VoolBlocks class TestAssignMomInstanceToLocal < MiniTest::Test include MomCompile def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ins = compile_first_block( "local = @a" , "@a = 5") #second arg in method scope end def test_class_compiles @@ -50,7 +50,7 @@ module VoolBlocks include MomCompile def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ins = compile_first_block( "arg = 5") end @@ -68,7 +68,7 @@ module VoolBlocks class TestAssignMomToInstance < MiniTest::Test include MomCompile def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) end def test_assigns_const @ins = compile_first_block( "@a = 5") diff --git a/test/vool/blocks/test_if_condition.rb b/test/vool/blocks/test_if_condition.rb index 83f7dbc1..9ee3696c 100644 --- a/test/vool/blocks/test_if_condition.rb +++ b/test/vool/blocks/test_if_condition.rb @@ -6,7 +6,7 @@ module VoolBlocks include Mom def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc::Builtin.boot_functions @ins = compile_first_block( "if(5.div4) ; @a = 6 ; else; @a = 5 ; end") end diff --git a/test/vool/blocks/test_while_simple.rb b/test/vool/blocks/test_while_simple.rb index 97dd454b..8c6d53a2 100644 --- a/test/vool/blocks/test_while_simple.rb +++ b/test/vool/blocks/test_while_simple.rb @@ -6,7 +6,7 @@ module VoolBlocks include Mom def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ins = compile_first_block( "while(@a) ; @a = 5 ; end") end diff --git a/test/vool/send/helper.rb b/test/vool/send/helper.rb index ce211a62..bc89eb83 100644 --- a/test/vool/send/helper.rb +++ b/test/vool/send/helper.rb @@ -6,7 +6,7 @@ module Vool include MomCompile def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc::Builtin.boot_functions @ins = compile_first_method( send_method ) end diff --git a/test/vool/send/test_send_args_send.rb b/test/vool/send/test_send_args_send.rb index d93bc01a..fec22686 100644 --- a/test/vool/send/test_send_args_send.rb +++ b/test/vool/send/test_send_args_send.rb @@ -6,7 +6,7 @@ module Vool include Mom def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc.boot! @ins = compile_first_method( "a = main(1 + 2)" ) end diff --git a/test/vool/send/test_send_cached_simple.rb b/test/vool/send/test_send_cached_simple.rb index 7b7a3fc2..2e942f80 100644 --- a/test/vool/send/test_send_cached_simple.rb +++ b/test/vool/send/test_send_cached_simple.rb @@ -6,7 +6,7 @@ module Vool include Mom def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ins = compile_first_method( "a = 5; a.div4") end def test_check_type diff --git a/test/vool/test_assign.rb b/test/vool/test_assign.rb index d4866c50..0e942026 100644 --- a/test/vool/test_assign.rb +++ b/test/vool/test_assign.rb @@ -5,7 +5,7 @@ module Vool include MomCompile def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ins = compile_first_method( "local = 5") end @@ -36,7 +36,7 @@ module Vool class TestAssignMomInstanceToLocal < MiniTest::Test include MomCompile def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ins = compile_first_method( "@a = 5 ; local = @a") end def test_class_compiles @@ -49,7 +49,7 @@ module Vool include MomCompile def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ins = compile_first_method( "arg = 5") end @@ -73,7 +73,7 @@ module Vool class TestAssignMomToInstance < MiniTest::Test include MomCompile def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) end def test_assigns_const @ins = compile_first_method( "@a = 5") diff --git a/test/vool/test_if_condition.rb b/test/vool/test_if_condition.rb index 19d4ec4f..71d12c8d 100644 --- a/test/vool/test_if_condition.rb +++ b/test/vool/test_if_condition.rb @@ -6,7 +6,7 @@ module Vool include Mom def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc::Builtin.boot_functions @ins = compile_first_method( "if(5.div4) ; @a = 6 ; else; @a = 5 ; end") end diff --git a/test/vool/test_if_no_else.rb b/test/vool/test_if_no_else.rb index 61ef702f..6a47ec7a 100644 --- a/test/vool/test_if_no_else.rb +++ b/test/vool/test_if_no_else.rb @@ -7,7 +7,7 @@ module Vool include Mom def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ins = compile_first_method( "if(@a) ; @a = 5 ; end") end diff --git a/test/vool/test_if_simple.rb b/test/vool/test_if_simple.rb index 1405beee..c4db5392 100644 --- a/test/vool/test_if_simple.rb +++ b/test/vool/test_if_simple.rb @@ -7,7 +7,7 @@ module Vool include Mom def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ins = compile_first_method( "if(@a) ; @a = 5 ; else; @a = 6 ; end") end diff --git a/test/vool/test_ivar.rb b/test/vool/test_ivar.rb index 0a12941b..9dd2d159 100644 --- a/test/vool/test_ivar.rb +++ b/test/vool/test_ivar.rb @@ -5,7 +5,7 @@ module Vool include MomCompile def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ins = compile_first_method( "@a = 5") end diff --git a/test/vool/test_local_assignment.rb b/test/vool/test_local_assignment.rb index 2a16d934..7f526014 100644 --- a/test/vool/test_local_assignment.rb +++ b/test/vool/test_local_assignment.rb @@ -5,7 +5,7 @@ module Vool include MomCompile def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ins = compile_first_method( "a = 5") end diff --git a/test/vool/test_return.rb b/test/vool/test_return.rb index fa8af33f..89c9d39e 100644 --- a/test/vool/test_return.rb +++ b/test/vool/test_return.rb @@ -6,7 +6,7 @@ module Vool include Mom def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @inst = compile_first_method( "return 5") end @@ -43,7 +43,7 @@ module Vool include Mom def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc.boot! @ins = compile_first_method( "return 5.div4") end diff --git a/test/vool/test_while_condition.rb b/test/vool/test_while_condition.rb index 77f4f36a..06066eb0 100644 --- a/test/vool/test_while_condition.rb +++ b/test/vool/test_while_condition.rb @@ -7,7 +7,7 @@ module Vool include Mom def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) Risc::Builtin.boot_functions @ins = compile_first_method( "while(5.div4) ; 5.div4 ; end") end diff --git a/test/vool/test_while_simple.rb b/test/vool/test_while_simple.rb index 3b8345b4..34d649b3 100644 --- a/test/vool/test_while_simple.rb +++ b/test/vool/test_while_simple.rb @@ -6,7 +6,7 @@ module Vool include Mom def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ins = compile_first_method( "while(@a) ; @a = 5 ; end") end diff --git a/test/vool/test_yield_statement.rb b/test/vool/test_yield_statement.rb index e619c1c4..209be194 100644 --- a/test/vool/test_yield_statement.rb +++ b/test/vool/test_yield_statement.rb @@ -59,7 +59,7 @@ module Vool include YieldBasics def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ins = compile_first_method( "return yield(1)" ) end @@ -83,7 +83,7 @@ module Vool include Mom include YieldBasics def setup - Parfait.boot! + Parfait.boot!(Parfait.default_test_options) @ins = compile_first_method( "return yield" ) end def test_array