From 05669065cabbba6e9a5637381c2313264dd27feb Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sat, 30 Jun 2018 23:26:28 +0300 Subject: [PATCH] back to method_compiler it is what it is --- lib/mom/instruction/instruction.rb | 2 +- lib/parfait/vool_method.rb | 2 +- lib/risc.rb | 2 +- lib/risc/builder.rb | 2 +- lib/risc/builtin/compile_helper.rb | 2 +- lib/risc/builtin/object.rb | 2 +- lib/risc/{risc_compiler.rb => method_compiler.rb} | 4 ++-- test/risc/test_builder.rb | 4 ++-- test/risc/test_builtin.rb | 2 +- test/risc/{test_risc_compiler.rb => test_method_compiler.rb} | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) rename lib/risc/{risc_compiler.rb => method_compiler.rb} (97%) rename test/risc/{test_risc_compiler.rb => test_method_compiler.rb} (98%) diff --git a/lib/mom/instruction/instruction.rb b/lib/mom/instruction/instruction.rb index e82ea018..6e7bcba0 100644 --- a/lib/mom/instruction/instruction.rb +++ b/lib/mom/instruction/instruction.rb @@ -18,7 +18,7 @@ module Mom # In other words Mom is the higher abstraction and so mom instructions convert # to many (1-10) risc instructions # - # The argument that is passed is a RiscCompiler, which has the method and some + # The argument that is passed is a MethodCompiler, which has the method and some # state about registers used. (also provides helpers to generate risc instructions) def to_risc(compiler) raise self.class.name + "_todo" diff --git a/lib/parfait/vool_method.rb b/lib/parfait/vool_method.rb index 43264ecf..06ef0b57 100644 --- a/lib/parfait/vool_method.rb +++ b/lib/parfait/vool_method.rb @@ -36,7 +36,7 @@ module Parfait def compile_to_risc(for_type) typed_method = create_typed_method(for_type) head = source.to_mom( typed_method ) - compiler = Risc::RiscCompiler.new( typed_method ) + compiler = Risc::MethodCompiler.new( typed_method ) compiler.add_mom(head) head # return for testing end diff --git a/lib/risc.rb b/lib/risc.rb index 449d7def..e4583c56 100644 --- a/lib/risc.rb +++ b/lib/risc.rb @@ -25,7 +25,7 @@ require_relative "risc/platform" require "parfait" require_relative "risc/parfait_adapter" require_relative "risc/machine" -require_relative "risc/risc_compiler" +require_relative "risc/method_compiler" class Fixnum def fits_u8? diff --git a/lib/risc/builder.rb b/lib/risc/builder.rb index 32f585de..4f3c4ee4 100644 --- a/lib/risc/builder.rb +++ b/lib/risc/builder.rb @@ -236,7 +236,7 @@ module Risc end end - # A CompilerBuilder adds the generated code to the RiscCompiler. + # A CompilerBuilder adds the generated code to the MethodCompiler. # class CompilerBuilder < Builder # add code straight to the compiler diff --git a/lib/risc/builtin/compile_helper.rb b/lib/risc/builtin/compile_helper.rb index 2cc4e3c4..43a2b93d 100644 --- a/lib/risc/builtin/compile_helper.rb +++ b/lib/risc/builtin/compile_helper.rb @@ -6,7 +6,7 @@ module Risc def compiler_for( clazz_name , method_name , arguments , locals = {}) frame = Parfait::NamedList.type_for( locals ) args = Parfait::NamedList.type_for( arguments ) - RiscCompiler.compiler_for_class(clazz_name , method_name , args, frame ) + MethodCompiler.compiler_for_class(clazz_name , method_name , args, frame ) end end diff --git a/lib/risc/builtin/object.rb b/lib/risc/builtin/object.rb index 4b90dec8..c2672455 100644 --- a/lib/risc/builtin/object.rb +++ b/lib/risc/builtin/object.rb @@ -46,7 +46,7 @@ module Risc # it isn't really a function, ie it is jumped to (not called), exits and may not return # so it is responsible for initial setup def __init__ context - compiler = RiscCompiler.compiler_for_class(:Object,:__init__ , + compiler = MethodCompiler.compiler_for_class(:Object,:__init__ , Parfait::NamedList.type_for({}) , Parfait::NamedList.type_for({})) builder = compiler.compiler_builder(compiler.method) builder.build do diff --git a/lib/risc/risc_compiler.rb b/lib/risc/method_compiler.rb similarity index 97% rename from lib/risc/risc_compiler.rb rename to lib/risc/method_compiler.rb index bac5cf09..b97e3ece 100644 --- a/lib/risc/risc_compiler.rb +++ b/lib/risc/method_compiler.rb @@ -1,10 +1,10 @@ module Risc - # RiscCompiler (old name) is used to generate risc instructions for methods + # MethodCompiler (old name) is used to generate risc instructions for methods # and to instantiate the methods correctly. Most of the init is typed layer stuff, # but there is some logic too. - class RiscCompiler + class MethodCompiler def initialize( method ) @regs = [] diff --git a/test/risc/test_builder.rb b/test/risc/test_builder.rb index 1cc0183d..5761ba72 100644 --- a/test/risc/test_builder.rb +++ b/test/risc/test_builder.rb @@ -7,7 +7,7 @@ module Risc Parfait.boot! Risc.machine.boot init = Parfait.object_space.get_init - @builder = Risc::RiscCompiler.new( init ).code_builder(init) + @builder = Risc::MethodCompiler.new( init ).code_builder(init) @label = Risc.label("source","name") end def test_has_build @@ -104,7 +104,7 @@ module Risc Parfait.boot! Risc.machine.boot @init = Parfait.object_space.get_init - @builder = Risc::RiscCompiler.new( @init ).compiler_builder(@init) + @builder = Risc::MethodCompiler.new( @init ).compiler_builder(@init) end def test_inserts_built r1 = RegisterValue.new(:r1 , :Space) diff --git a/test/risc/test_builtin.rb b/test/risc/test_builtin.rb index 1f3b1ad4..06248df5 100644 --- a/test/risc/test_builtin.rb +++ b/test/risc/test_builtin.rb @@ -16,7 +16,7 @@ module Risc assert_equal 23, Builtin.boot_functions.length end def test_boot_function_first - assert_equal RiscCompiler, Builtin.boot_functions.first.class + assert_equal MethodCompiler, Builtin.boot_functions.first.class end end end diff --git a/test/risc/test_risc_compiler.rb b/test/risc/test_method_compiler.rb similarity index 98% rename from test/risc/test_risc_compiler.rb rename to test/risc/test_method_compiler.rb index 9352e08f..b17cc257 100644 --- a/test/risc/test_risc_compiler.rb +++ b/test/risc/test_method_compiler.rb @@ -1,7 +1,7 @@ require_relative "helper" module Risc - class TestRiscCompiler < MiniTest::Test + class TestMethodCompiler < MiniTest::Test include ScopeHelper def setup