clean up booting

many machine boot became obsolete
or just neede parfait to boot
actual linker functionality pending
This commit is contained in:
Torsten Ruger
2018-07-01 14:12:42 +03:00
parent e75aef933d
commit c947c27a14
32 changed files with 71 additions and 62 deletions

View File

@ -29,7 +29,7 @@ module Risc
end
def produce_instructions
assert @expect , "No output given"
RubyX::RubyXCompiler.ruby_to_binary as_test_main , :interpreter
RubyX::RubyXCompiler.new(as_test_main).ruby_to_binary( :interpreter)
test = Parfait.object_space.get_class_by_name :Test
test.instance_type.get_method(:main).cpu_instructions
end

View File

@ -4,7 +4,7 @@ module Mom
class TestSlotDefinitionConstant < MiniTest::Test
def setup
Risc.machine.boot
Parfait.boot!
@compiler = CompilerMock.new
@definition = SlotDefinition.new(StringConstant.new("hi") , [])
@instruction = @definition.to_register(@compiler , InstructionMock.new)

View File

@ -3,7 +3,7 @@ require_relative "helper"
module Mom
class TestSlotDefinitionKnown1 < MiniTest::Test
def setup
Risc.machine.boot
Parfait.boot!
@compiler = CompilerMock.new
@definition = SlotDefinition.new(:message , :caller)
@instruction = @definition.to_register(@compiler , InstructionMock.new)

View File

@ -3,7 +3,7 @@ require_relative "helper"
module Mom
class TestSlotDefinitionKnown2 < MiniTest::Test
def setup
Risc.machine.boot
Parfait.boot!
@compiler = CompilerMock.new
@definition = SlotDefinition.new(:message , [:caller , :type])
@instruction = @definition.to_register(@compiler , InstructionMock.new)

View File

@ -4,7 +4,7 @@ module Mom
class TestSlotLoad1 < MiniTest::Test
def setup
Risc.machine.boot
Parfait.boot!
@load = SlotLoad.new( [:message, :caller] , [:message,:type] )
@compiler = CompilerMock.new
@instruction = @load.to_risc(@compiler)

View File

@ -5,7 +5,7 @@ module Mom
def setup
Parfait.boot!
Risc.machine.boot
Risc.boot!
@load = SlotLoad.new( [:message, :caller] , [:message, :caller , :type] )
@compiler = CompilerMock.new
@instruction = @load.to_risc(@compiler)

View File

@ -18,11 +18,27 @@ module Mom
def test_has_translate
assert @comp.translate(:interpreter)
end
end
class TestClassCompilerTranslate < MiniTest::Test
include MomCompile
def setup
Parfait.boot!
@comp = compile_mom( "class Test ; def main(); return 1; end; end;")
@trans = @comp.translate(:interpreter)
end
def test_translate_class
assert_equal Array , @comp.translate(:interpreter).class
assert_equal Array , @trans.class
end
def test_translate_assemblers
assert_equal Risc::Assembler , @comp.translate(:interpreter).first.class
assert_equal Risc::Assembler , @trans.first.class
end
def test_assembler_code
assert_equal Risc::Label , @trans.first.instructions.class
end
def test_assembler_assembled
assert_equal Risc::LoadConstant , @trans.first.instructions.next.class
end
end
end