diff --git a/lib/risc/parfait_boot.rb b/lib/risc/parfait_boot.rb index e2094122..2511edaf 100644 --- a/lib/risc/parfait_boot.rb +++ b/lib/risc/parfait_boot.rb @@ -55,10 +55,8 @@ module Parfait boot_boot_space( types ) classes = boot_classes( types ) fix_types( types , classes ) - if( page = options[:page_size]) - Factory.page_size = page - PUTS "PAGE #{page}" - end + page = options[:factory] || 1024 + Factory.page_size = page space = Space.new( classes ) Parfait.set_object_space( space ) end diff --git a/lib/rubyx/rubyx_compiler.rb b/lib/rubyx/rubyx_compiler.rb index 19389b16..9635869b 100644 --- a/lib/rubyx/rubyx_compiler.rb +++ b/lib/rubyx/rubyx_compiler.rb @@ -20,7 +20,7 @@ module RubyX # initialize boots Parfait and Risc (ie load Builin) def initialize(options) - Parfait.boot!(options) + Parfait.boot!(options[:parfait] || {}) Risc.boot! end diff --git a/test/mains/test_new.rb b/test/mains/test_new.rb index c1dfb5c5..74989e57 100644 --- a/test/mains/test_new.rb +++ b/test/mains/test_new.rb @@ -5,7 +5,7 @@ module Mains include Risc::Ticker def setup - @string_input = as_main("a = 1011 ; while(a>0) ; a = a - 1 ; end ; return a") + @string_input = as_main("a = 37 ; while(a>0) ; a = a - 1 ; end ; return a") super end def test_chain # max 1011 iterations on 1014 integers (1024 - 10 reserve) diff --git a/test/parfait/test_factory.rb b/test/parfait/test_factory.rb index 0d1095f7..db086cfe 100644 --- a/test/parfait/test_factory.rb +++ b/test/parfait/test_factory.rb @@ -23,8 +23,8 @@ 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 + def test_default_test_page + assert_equal 20 , Factory.page_size end def test_default_reserve assert_equal 10 , Factory.reserve_size @@ -37,15 +37,6 @@ module Parfait @factory.get_next_object assert_equal Parfait::Integer , @factory.reserve.class end - def test_chain_length - count = 0 - start = @factory.get_next_object - while( start ) - start = start.next_integer - count += 1 - end - assert_equal 1024 - 10 , count - end def test_reserve_length count = 0 start = @factory.get_next_object @@ -56,5 +47,23 @@ module Parfait end assert_equal 11 , count end + class BigFactoryTest < BigParfaitTest + def setup + super + @factory = Factory.new Parfait.object_space.get_type_by_class_name(:Integer) + end + def test_chain_length + count = 0 + start = @factory.get_next_object + while( start ) + start = start.next_integer + count += 1 + end + assert_equal 1024 - 10 , count + end + def test_default_page + assert_equal 1024 , Factory.page_size + end + end end end diff --git a/test/parfait/test_space.rb b/test/parfait/test_space.rb index ef5d01ea..249194d3 100644 --- a/test/parfait/test_space.rb +++ b/test/parfait/test_space.rb @@ -117,15 +117,6 @@ module Parfait def test_has_next_address assert_equal Parfait::ReturnAddress , @space.get_next_for(:ReturnAddress).class end - def test_address_count - addr = @space.get_next_for(:ReturnAddress) - count = 0 - while(addr) - count += 1 - addr = addr.next_integer - end - assert_equal 1014, count - end def test_has_message_factory ints = @space.get_factory_for(:Message) assert_equal Factory , ints.class @@ -138,16 +129,6 @@ module Parfait def test_has_next_message assert_equal Parfait::Message , @space.get_next_for(:Message).class end - def test_message_count - mess = @space.get_next_for(:Message) - count = 0 - while(mess) - count += 1 - assert mess.frame - mess = mess.next_message - end - assert_equal 1014, count - end def test_create_class assert @space.create_class( :NewClass ) end @@ -191,4 +172,26 @@ module Parfait end end end + class BigTestSpace < BigParfaitTest + def test_address_count + addr = @space.get_next_for(:ReturnAddress) + count = 0 + while(addr) + count += 1 + addr = addr.next_integer + end + assert_equal 1014, count + end + def test_message_count + mess = @space.get_next_for(:Message) + count = 0 + while(mess) + count += 1 + assert mess.frame + mess = mess.next_message + end + assert_equal 1014, count + end + end + end diff --git a/test/risc/interpreter/calling/test_minus.rb b/test/risc/interpreter/calling/test_minus.rb index 65e784f3..eac087e5 100644 --- a/test/risc/interpreter/calling/test_minus.rb +++ b/test/risc/interpreter/calling/test_minus.rb @@ -41,7 +41,7 @@ module Risc ret = main_ticks(68) assert_equal FunctionReturn , ret.class assert_equal :r1 , ret.register.symbol - assert_equal 175116 , @interpreter.get_register(ret.register) + assert_equal 22284 , @interpreter.get_register(ret.register) end end end diff --git a/test/risc/test_interpreter.rb b/test/risc/test_interpreter.rb index 255989f8..89077d93 100644 --- a/test/risc/test_interpreter.rb +++ b/test/risc/test_interpreter.rb @@ -54,7 +54,7 @@ module Risc end def test_pc1 @interpreter.tick - assert_equal 174552 , @interpreter.pc + assert_equal 21688 , @interpreter.pc end def test_tick2 @interpreter.tick @@ -68,7 +68,7 @@ module Risc def test_pc2 @interpreter.tick @interpreter.tick - assert_equal 174556 , @interpreter.pc + assert_equal 21692 , @interpreter.pc end def test_tick_14_jump 14.times {@interpreter.tick} diff --git a/test/risc/test_linker.rb b/test/risc/test_linker.rb index 51f2c2d9..03917738 100644 --- a/test/risc/test_linker.rb +++ b/test/risc/test_linker.rb @@ -25,7 +25,7 @@ module Risc assert_equal 0 , Position.get(@linker.cpu_init).at end def test_cpu_at - assert_equal "0x2b90c" , Position.get(@linker.cpu_init.first).to_s + assert_equal "0x4f1c" , Position.get(@linker.cpu_init.first).to_s end def test_cpu_label assert_equal Position , Position.get(@linker.cpu_init.first).class diff --git a/test/support/options.rb b/test/support/options.rb index d49b01bd..a390ee20 100644 --- a/test/support/options.rb +++ b/test/support/options.rb @@ -1,11 +1,36 @@ module Parfait def self.default_test_options - {} + { + factory: 20, + } + end + def self.interpreter_test_options + { + factory: 50, + } + end + def self.full_test_options + { + factory: 1024, + } end end module RubyX def self.default_test_options - { parfait: Parfait.default_test_options} + { + parfait: Parfait.default_test_options + } + end + def self.full_test_options + { + parfait: Parfait.full_test_options + } + end + def self.interpreter_test_options + { + parfait: Parfait.interpreter_test_options, + platform: :interpreter + } end end diff --git a/test/support/parfait_test.rb b/test/support/parfait_test.rb index b6931ab0..a123d8e0 100644 --- a/test/support/parfait_test.rb +++ b/test/support/parfait_test.rb @@ -12,4 +12,10 @@ module Parfait @method = Parfait::CallableMethod.new( :meth , @obj , @args , @frame) end end + class BigParfaitTest < ParfaitTest + def setup + Parfait.boot!(Parfait.full_test_options) + @space = Parfait.object_space + end + end end diff --git a/test/support/risc_interpreter.rb b/test/support/risc_interpreter.rb index 8e3ddf01..3150594a 100644 --- a/test/support/risc_interpreter.rb +++ b/test/support/risc_interpreter.rb @@ -7,7 +7,7 @@ module Risc include ScopeHelper def setup - compiler = RubyX::RubyXCompiler.new(RubyX.default_test_options) + compiler = RubyX::RubyXCompiler.new(RubyX.interpreter_test_options) @linker = compiler.ruby_to_binary(@string_input, :interpreter) @interpreter = Interpreter.new(@linker) @interpreter.start_program