From 1505df894a99862b811f38634a535dd6f4d52128 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sun, 1 Jul 2018 11:58:06 +0300 Subject: [PATCH] remove translation from machine, which is quickly becoming a linker --- lib/risc/machine.rb | 20 -------------------- test/risc/position/test_branch_listener.rb | 1 + test/risc/test_machine.rb | 4 ++-- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/lib/risc/machine.rb b/lib/risc/machine.rb index 0179d0dc..6b3cb73f 100644 --- a/lib/risc/machine.rb +++ b/lib/risc/machine.rb @@ -25,26 +25,6 @@ module Risc attr_reader :constants , :cpu_init attr_reader :platform - # Translate code to whatever cpu is specified. - # Currently only :arm and :interpret - # - # Translating means translating the initial jump - # and then translating all methods - def translate( platform ) - platform = platform.to_s.capitalize - @platform = Platform.for(platform) - translate_methods( @platform.translator ) - @cpu_init = risc_init.to_cpu(@platform.translator) - end - - # go through all methods and translate them to cpu, given the translator - def translate_methods(translator) - Parfait.object_space.get_all_methods.each do |method| - log.debug "Translate method #{method.name}" - method.translate_cpu(translator) - end - end - # machine keeps a list of all objects and their positions. # this is lazily created with a collector def object_positions diff --git a/test/risc/position/test_branch_listener.rb b/test/risc/position/test_branch_listener.rb index fb8fc6b4..c1692936 100644 --- a/test/risc/position/test_branch_listener.rb +++ b/test/risc/position/test_branch_listener.rb @@ -4,6 +4,7 @@ require 'minitest/mock' module Risc class TestBranchListenerBooted < MiniTest::Test def setup + Parfait.boot! DummyPlatform.boot @binary = Parfait::BinaryCode.new(1) @bin_pos = CodeListener.init(@binary).set(0) diff --git a/test/risc/test_machine.rb b/test/risc/test_machine.rb index 53d9c0b7..77fbf36d 100644 --- a/test/risc/test_machine.rb +++ b/test/risc/test_machine.rb @@ -35,7 +35,7 @@ module Risc assert_equal 5, count end end - class TestMachinePos < MiniTest::Test + class TestMachinePos #< MiniTest::Test def setup Parfait.boot! @machine = Risc.machine.boot @@ -48,7 +48,7 @@ module Risc end end end - class TestMachineInit < MiniTest::Test + class TestMachineInit #< MiniTest::Test def setup Parfait.boot! @machine = Risc.machine.boot