found the culprit
This commit is contained in:
parent
500851d246
commit
fcb7f652eb
@ -97,7 +97,7 @@ module Risc
|
|||||||
def create_binary
|
def create_binary
|
||||||
objects.each do |id , method|
|
objects.each do |id , method|
|
||||||
next unless method.is_a? Parfait::TypedMethod
|
next unless method.is_a? Parfait::TypedMethod
|
||||||
puts "CODE1 #{method.name}:#{}"
|
puts "Binary for #{method.name}:#{}"
|
||||||
writer = BinaryWriter.new(method.binary)
|
writer = BinaryWriter.new(method.binary)
|
||||||
writer.assemble(method.cpu_instructions)
|
writer.assemble(method.cpu_instructions)
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require_relative "../helper"
|
require_relative "../helper"
|
||||||
|
|
||||||
module Risc
|
module Risc
|
||||||
class TestMachine < MiniTest::Test
|
class TestMachineObjects < MiniTest::Test
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@machine = Risc.machine.boot
|
@machine = Risc.machine.boot
|
||||||
@ -11,20 +11,18 @@ module Risc
|
|||||||
assert_equal Hash , objects.class
|
assert_equal Hash , objects.class
|
||||||
assert 350 < objects.length
|
assert 350 < objects.length
|
||||||
end
|
end
|
||||||
def test_position_length
|
end
|
||||||
|
class TestMachinePositions < MiniTest::Test
|
||||||
|
def setup
|
||||||
|
@machine = Risc.machine.boot
|
||||||
@machine.position_all
|
@machine.position_all
|
||||||
objects = @machine.objects
|
|
||||||
assert_equal Hash , objects.class
|
|
||||||
assert 350 < objects.length
|
|
||||||
end
|
end
|
||||||
def test_has_positions
|
def test_has_positions
|
||||||
@machine.position_all
|
|
||||||
@machine.objects.each do |id,obj|
|
@machine.objects.each do |id,obj|
|
||||||
assert Positioned.position(obj)
|
assert Positioned.position(obj)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def test_binary
|
def test_binary
|
||||||
@machine.position_all
|
|
||||||
@machine.create_binary
|
@machine.create_binary
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
require_relative "../helper"
|
require_relative "../helper"
|
||||||
|
|
||||||
|
class DevNull
|
||||||
|
def write_unsigned_int_32( _ );end
|
||||||
|
end
|
||||||
module Risc
|
module Risc
|
||||||
class TestTranslator < MiniTest::Test
|
class TestTranslator < MiniTest::Test
|
||||||
|
|
||||||
@ -14,8 +17,34 @@ module Risc
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_translate_space
|
def test_translate_space
|
||||||
@assembler = Assembler.new(@machine , Collector.collect_space)
|
|
||||||
assert @machine.translate_arm
|
assert @machine.translate_arm
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_no_loops_in_chain
|
||||||
|
@machine.position_all
|
||||||
|
init = Parfait.object_space.get_init
|
||||||
|
all = []
|
||||||
|
init.cpu_instructions.each do |ins|
|
||||||
|
assert !all.include?(ins)
|
||||||
|
all << ins
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_no_risc
|
||||||
|
@machine.translate_arm
|
||||||
|
@machine.position_all
|
||||||
|
@machine.objects.each do |id , method|
|
||||||
|
next unless method.is_a? Parfait::TypedMethod
|
||||||
|
next unless method.name == :__init__
|
||||||
|
method.cpu_instructions.each do |ins|
|
||||||
|
puts "INS #{ins}:#{}"
|
||||||
|
begin
|
||||||
|
ins.assemble(DevNull.new)
|
||||||
|
rescue LinkException
|
||||||
|
ins.assemble(DevNull.new)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user