rename register to risc

seems to fit the layer much better as we really have a very reduced
instruction set
This commit is contained in:
Torsten Ruger
2017-01-19 09:02:29 +02:00
parent da5823a1a0
commit aa79e41d1c
127 changed files with 348 additions and 346 deletions

View File

@ -3,6 +3,8 @@ require "register/interpreter"
require "parser/ruby22"
require "yaml"
# An experiment to find out how much ruby there is to achieve bootstrap
#
class Walker < AST::Processor
def initialize collector
@collector = collector

View File

@ -1,12 +1,12 @@
require_relative '../helper'
require "register/interpreter"
require "risc/interpreter"
require "parser/ruby22"
module Rubyx
module RubyxTests
include CompilerHelper
include Register::InterpreterHelpers
subs = ObjectSpace.each_object(Class).select { |klass| klass < Register::Instruction }
include Risc::InterpreterHelpers
subs = ObjectSpace.each_object(Class).select { |klass| klass < Risc::Instruction }
subs.each do |clazz|
name = clazz.to_s
next if name.include?("Arm")

View File

@ -3,17 +3,17 @@ require_relative 'helper'
module Rubyx
class TestRubyHello < MiniTest::Test
include RubyxTests
Branch = Register::Branch
Label = Register::Label
Branch = Risc::Branch
Label = Risc::Label
def setup
@string_input = as_main '"Hello there".putstring'
Register.machine.boot
Risc.machine.boot
# do_clean_compile
RubyCompiler.compile @string_input
Register::Collector.collect_space
@interpreter = Register::Interpreter.new
@interpreter.start Register.machine.init
Risc::Collector.collect_space
@interpreter = Risc::Interpreter.new
@interpreter.start Risc.machine.init
end
def test_chain
@ -22,16 +22,16 @@ module Rubyx
LoadConstant, RegToSlot, FunctionCall, Label, LoadConstant,
SlotToReg, RegToSlot, SlotToReg, LoadConstant, RegToSlot,
LoadConstant, RegToSlot, LoadConstant, SlotToReg, RegToSlot,
LoadConstant, RegToSlot, RegisterTransfer, FunctionCall, Label,
LoadConstant, RegToSlot, RiscTransfer, FunctionCall, Label,
LoadConstant, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
RegisterTransfer, Syscall, RegisterTransfer, RegisterTransfer, RegToSlot,
Label, FunctionReturn, RegisterTransfer, SlotToReg, SlotToReg,
Label, FunctionReturn, RegisterTransfer, Syscall, NilClass]
RiscTransfer, Syscall, RiscTransfer, RiscTransfer, RegToSlot,
Label, FunctionReturn, RiscTransfer, SlotToReg, SlotToReg,
Label, FunctionReturn, RiscTransfer, Syscall, NilClass]
end
def test_overflow
instruction = ticks( 24 )
assert_equal Register::FunctionCall , instruction.class
assert_equal Risc::FunctionCall , instruction.class
assert_equal :putstring , instruction.method.name
end

View File

@ -5,7 +5,7 @@ module Rubyx
class TestLocalsCollector < MiniTest::Test
def setup
Register.machine.boot unless Register.machine.booted
Risc.machine.boot unless Risc.machine.booted
end
def parse_collect( input )

View File

@ -5,7 +5,7 @@ module Rubyx
class TestMethodCollector < MiniTest::Test
def setup
Register.machine.boot unless Register.machine.booted
Risc.machine.boot unless Risc.machine.booted
end
def parse_collect( input )

View File

@ -5,7 +5,7 @@ module Rubyx
class TestNormalizer < MiniTest::Test
def setup
Register.machine.boot unless Register.machine.booted
Risc.machine.boot unless Risc.machine.booted
end
def test_no_thing

View File

@ -5,7 +5,7 @@ module Rubyx
class TestTypeCollector < MiniTest::Test
def setup
Register.machine.boot
Risc.machine.boot
end
def parse_collect( input )

View File

@ -4,7 +4,7 @@ module Rubyx
class TestCompiler < MiniTest::Test
def setup
Register.machine.boot
Risc.machine.boot
end
def test_doesnt_create_existing_clas

View File

@ -5,7 +5,7 @@ module Rubyx
include CompilerHelper
def setup
Register.machine.boot
Risc.machine.boot
end
def create_method