diff --git a/Guardfile b/Guardfile index 247d971e..e5600fe7 100644 --- a/Guardfile +++ b/Guardfile @@ -30,7 +30,7 @@ guard :minitest , all_on_start: false do # with Minitest::Unit [ Dir["test/vool/send/test_*.rb"] ] } # message setup - watch(%r{^lib/mom/instruction/message_setup.rb}) { Dir["test/mom/send/test_setup*.rb"] } + watch(%r{^lib/slot_machine/instruction/message_setup.rb}) { Dir["test/slot_machine/send/test_setup*.rb"] } # mains test watch(%r{^test/mains/source/(.*)\.rb}) { "test/mains/test_interpreted.rb" } diff --git a/README.md b/README.md index 06abf46a..6dbaa2ec 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ X can be read as X times faster, or a decade away, depending on mindset. The last rewrite clarified the roles of the different layers of the system, see below. The overhaul is done and rubyx produces working binaries. -Processing goes through layers: Ruby --> Vool --> Mom --> Risc --> Arm --> binary . +Processing goes through layers: Ruby --> Vool --> SlotMachine --> Risc --> Arm --> binary . Currently most basic constructs work to some (usable) degree, ie if, while, assignment, ivars, calling and dynamic dispatch all work. Simple blocks, those @@ -38,15 +38,15 @@ Vool is Ruby without the fluff. No unless, no reverse if/while, no splats. Just oo. (Without this level the step down to the next layer was just too big) -### Mom +### SlotMachine The Minimal Object Machine layer is the first machine layer. This means it has instructions rather than statements. Instructions (in all machine layers) are a linked list. -Mom has no concept of memory yet, only objects. Data is transferred directly from object -to object with one of Mom's main instructions, the SlotLoad. +SlotMachine has no concept of memory yet, only objects. Data is transferred directly from object +to object with one of SlotMachine's main instructions, the SlotLoad. -Mainly Mom is an easy to understand step on the way down. A mix of oo and machine. In +Mainly SlotMachine is an easy to understand step on the way down. A mix of oo and machine. In practise it means that the amount of instructions that need to be generated in vool is much smaller (easier to understand) and the mapping down to risc is quite straightforward. @@ -63,7 +63,7 @@ Instructions are derived from a base class, so the instruction set is extensible way additional functionality may be added by external code. Risc knows memory and has a small set of registers. It allows memory to register transfer -and back, and inter register transfer. But has no memory to memory transfer like Mom. +and back, and inter register transfer. But has no memory to memory transfer like SlotMachine. ### Arm @@ -124,7 +124,7 @@ All Objects have a Type, as their first member (also integers!). The Type points Class that the object has in oo terms. Classes are defined by ruby code, but the methods of a Type (that are executed) are defined -by Mom and Risc only. +by SlotMachine and Risc only. ## Other diff --git a/lib/arm/instructions/instruction.rb b/lib/arm/instructions/instruction.rb index b6345a05..6372bfa6 100644 --- a/lib/arm/instructions/instruction.rb +++ b/lib/arm/instructions/instruction.rb @@ -13,7 +13,7 @@ module Arm @source = source @next = nekst return unless source - raise "Source must be string or Instruction, not #{source.class}" unless source.is_a?(String) or source.is_a?(Mom::Instruction) + raise "Source must be string or Instruction, not #{source.class}" unless source.is_a?(String) or source.is_a?(SlotMachine::Instruction) end attr_reader :source diff --git a/lib/parfait/vool_method.rb b/lib/parfait/vool_method.rb index 450c0bbb..3bf3df68 100644 --- a/lib/parfait/vool_method.rb +++ b/lib/parfait/vool_method.rb @@ -38,8 +38,8 @@ module Parfait callable_method = self_type.get_method(@name) #puts "Using #{name} for #{self_type.object_class.name}.#{self_type.hash}" unless callable_method raise "Callable not found #{@name}" unless callable_method - compiler = Mom::MethodCompiler.new( callable_method ) - head = @source.to_mom( compiler ) + compiler = SlotMachine::MethodCompiler.new( callable_method ) + head = @source.to_slot( compiler ) compiler.add_code(head) compiler end diff --git a/lib/risc/block_compiler.rb b/lib/risc/block_compiler.rb index 83c21a4b..9d733690 100644 --- a/lib/risc/block_compiler.rb +++ b/lib/risc/block_compiler.rb @@ -7,9 +7,9 @@ module Risc attr_reader :block , :risc_instructions , :constants , :in_method - def initialize( block , in_method , mom_label) + def initialize( block , in_method , slot_label) @in_method = in_method - super(block , mom_label) + super(block , slot_label) end def source_name diff --git a/lib/risc/builder.rb b/lib/risc/builder.rb index c63443f8..b4600561 100644 --- a/lib/risc/builder.rb +++ b/lib/risc/builder.rb @@ -204,18 +204,18 @@ module Risc # - setting up the next message # - moving receiver (factory) and arguments (none) # - issuing the call - # These steps shadow the MomInstructions MessageSetup, ArgumentTransfer and SimpleCall + # These steps shadow the SlotMachineInstructions MessageSetup, ArgumentTransfer and SimpleCall def call_get_more factory = Parfait.object_space.get_factory_for( :Integer ) calling = factory.get_type.get_method( :get_more ) calling = Parfait.object_space.get_method!(:Space,:main) #until we actually parse Factory raise "no main defined" unless calling - Mom::MessageSetup.new( calling ).build_with( self ) + SlotMachine::MessageSetup.new( calling ).build_with( self ) self.build do factory_reg! << factory message[:receiver] << factory_reg end - Mom::SimpleCall.new(calling).to_risc(compiler) + SlotMachine::SimpleCall.new(calling).to_risc(compiler) end end diff --git a/lib/risc/callable_compiler.rb b/lib/risc/callable_compiler.rb index acd8338e..1700e235 100644 --- a/lib/risc/callable_compiler.rb +++ b/lib/risc/callable_compiler.rb @@ -14,12 +14,12 @@ module Risc # Must pass the callable (method/block) # Also start instuction, usually a label is mandatory - def initialize( callable , mom_label) + def initialize( callable , slot_label) raise "No method" unless callable @callable = callable @regs = [] @constants = [] - @current = @risc_instructions = mom_label.risc_label(self) + @current = @risc_instructions = slot_label.risc_label(self) reset_regs end attr_reader :risc_instructions , :constants , :callable , :current diff --git a/lib/risc/instruction.rb b/lib/risc/instruction.rb index b6959141..ce232ec1 100644 --- a/lib/risc/instruction.rb +++ b/lib/risc/instruction.rb @@ -8,7 +8,7 @@ module Risc # # We can load and store their contents, move data between them and # access (get/set) memory at a constant offset from a register - # While Mom works with objects, the register machine has registers, + # While SlotMachine works with objects, the register machine has registers, # but we keep the names for better understanding, r2-5 are temporary/scratch # There is no direct memory access, only through registers # Constants can/must be loaded into registers before use @@ -27,7 +27,7 @@ module Risc @next = nekst return unless source raise "Source must be string or Instruction, not #{source.class}" unless source.is_a?(String) or - source.is_a?(Mom::Instruction) or source.is_a?(Parfait::Callable) + source.is_a?(SlotMachine::Instruction) or source.is_a?(Parfait::Callable) end attr_reader :source diff --git a/lib/risc/instructions/load_constant.rb b/lib/risc/instructions/load_constant.rb index 55cf20f3..4a043c6e 100644 --- a/lib/risc/instructions/load_constant.rb +++ b/lib/risc/instructions/load_constant.rb @@ -9,7 +9,7 @@ module Risc super(source) @register = register @constant = constant - raise "Not Constant #{constant}" if constant.is_a?(Mom::SlotDefinition) + raise "Not Constant #{constant}" if constant.is_a?(SlotMachine::SlotDefinition) raise "Not register #{register}" unless RegisterValue.look_like_reg(register) end attr_accessor :register , :constant diff --git a/lib/risc/method_compiler.rb b/lib/risc/method_compiler.rb index d4fe8010..85a37d75 100644 --- a/lib/risc/method_compiler.rb +++ b/lib/risc/method_compiler.rb @@ -7,8 +7,8 @@ module Risc # Methods starts with a Label, both in risc and mom. # Pass in the callable(method) and the mom label that the method starts with - def initialize( method , mom_label) - super(method , mom_label) + def initialize( method , slot_label) + super(method , slot_label) end def source_name diff --git a/lib/ruby/ruby_compiler.rb b/lib/ruby/ruby_compiler.rb index 8755e25f..4200bad4 100644 --- a/lib/ruby/ruby_compiler.rb +++ b/lib/ruby/ruby_compiler.rb @@ -24,7 +24,7 @@ module Ruby # # The next step is then to go to the vool level, which is # simpler, and then finally to compile - # to the next level down, MOM (Minimal Object Machine) + # to the next level down, SlotMachine (Minimal Object Machine) class RubyCompiler < AST::Processor include AST::Sexp diff --git a/lib/rubyx.rb b/lib/rubyx.rb index 36d1d80a..56d08fd8 100644 --- a/lib/rubyx.rb +++ b/lib/rubyx.rb @@ -3,7 +3,7 @@ require "rx-file" require_relative "util" require_relative "elf/object_writer" require_relative "risc" -require_relative "mom/mom" +require_relative "slot_machine/slot_machine" require_relative "arm/arm_machine" require_relative "arm/arm_platform" require_relative "vool/statement" diff --git a/lib/rubyx/rubyx_compiler.rb b/lib/rubyx/rubyx_compiler.rb index a11a72a4..1fcbb16d 100644 --- a/lib/rubyx/rubyx_compiler.rb +++ b/lib/rubyx/rubyx_compiler.rb @@ -35,7 +35,7 @@ module RubyX end # The highest level function creates binary code for the given ruby code - # for the given platform (see Platform). Binary code means that vool/mom/risc + # for the given platform (see Platform). Binary code means that vool/slot_machine/risc # are created and then assembled into BinaryCode objects. # (no executable is generated, only the binary code and objects needed for a binary) # @@ -67,11 +67,11 @@ module RubyX # Transform the incoming ruby source (string) to mom # - # The vool is stored using ruby_to_vool,the to_mom is called - # Return Mom Statement - def ruby_to_mom(ruby) + # The vool is stored using ruby_to_vool,the to_slot is called + # Return SlotMachine Statement + def ruby_to_slot(ruby) ruby_to_vool(ruby) - to_mom + to_slot end # Process previously stored vool source to binary. @@ -97,14 +97,14 @@ module RubyX # Process previously stored vool source to risc. # return a Risc::RiscCollection , a collection of MethodCompilers def to_risc() - mom = to_mom + mom = to_slot mom.to_risc() end # return mom for the previously stored vool source. - def to_mom + def to_slot @vool.to_parfait - @vool.to_mom(nil) + @vool.to_slot(nil) end # ruby_to_vool compiles the ruby to ast, and then to vool diff --git a/lib/mom/README.md b/lib/slot_machine/README.md similarity index 93% rename from lib/mom/README.md rename to lib/slot_machine/README.md index 93998794..13016e44 100644 --- a/lib/mom/README.md +++ b/lib/slot_machine/README.md @@ -1,4 +1,4 @@ -# MOM , Minimal Object Machine +# SlotMachine , Minimal Object Machine This layer sits between the language layer (vool) and the risc machine layer. It is meant to make the transition (between vool and risc) easier to understand. @@ -9,7 +9,7 @@ that everything in computing can be fixed by another layer :-) ## Recap -A little recap of why the transition was too steep will naturally reveal the design of MOM. +A little recap of why the transition was too steep will naturally reveal the design of SlotMachine. ### Structure @@ -34,7 +34,7 @@ used (stacks are messy, not oo) The *essential* step from vool to risc, is the one from a language to a machine. From statements that hang in the air, to an instruction set. -So to put a layer in the middle of those two, MOM will be: +So to put a layer in the middle of those two, SlotMachine will be: ### Linked list diff --git a/lib/mom/block_compiler.rb b/lib/slot_machine/block_compiler.rb similarity index 100% rename from lib/mom/block_compiler.rb rename to lib/slot_machine/block_compiler.rb diff --git a/lib/mom/callable_compiler.rb b/lib/slot_machine/callable_compiler.rb similarity index 100% rename from lib/mom/callable_compiler.rb rename to lib/slot_machine/callable_compiler.rb diff --git a/lib/mom/instruction.rb b/lib/slot_machine/instruction.rb similarity index 100% rename from lib/mom/instruction.rb rename to lib/slot_machine/instruction.rb diff --git a/lib/mom/instruction/argument_transfer.rb b/lib/slot_machine/instruction/argument_transfer.rb similarity index 100% rename from lib/mom/instruction/argument_transfer.rb rename to lib/slot_machine/instruction/argument_transfer.rb diff --git a/lib/mom/instruction/basic_values.rb b/lib/slot_machine/instruction/basic_values.rb similarity index 100% rename from lib/mom/instruction/basic_values.rb rename to lib/slot_machine/instruction/basic_values.rb diff --git a/lib/mom/instruction/block_yield.rb b/lib/slot_machine/instruction/block_yield.rb similarity index 100% rename from lib/mom/instruction/block_yield.rb rename to lib/slot_machine/instruction/block_yield.rb diff --git a/lib/mom/instruction/check.rb b/lib/slot_machine/instruction/check.rb similarity index 100% rename from lib/mom/instruction/check.rb rename to lib/slot_machine/instruction/check.rb diff --git a/lib/mom/instruction/dynamic_call.rb b/lib/slot_machine/instruction/dynamic_call.rb similarity index 100% rename from lib/mom/instruction/dynamic_call.rb rename to lib/slot_machine/instruction/dynamic_call.rb diff --git a/lib/mom/instruction/jump.rb b/lib/slot_machine/instruction/jump.rb similarity index 100% rename from lib/mom/instruction/jump.rb rename to lib/slot_machine/instruction/jump.rb diff --git a/lib/mom/instruction/label.rb b/lib/slot_machine/instruction/label.rb similarity index 100% rename from lib/mom/instruction/label.rb rename to lib/slot_machine/instruction/label.rb diff --git a/lib/mom/instruction/message_setup.rb b/lib/slot_machine/instruction/message_setup.rb similarity index 100% rename from lib/mom/instruction/message_setup.rb rename to lib/slot_machine/instruction/message_setup.rb diff --git a/lib/mom/instruction/not_same_check.rb b/lib/slot_machine/instruction/not_same_check.rb similarity index 100% rename from lib/mom/instruction/not_same_check.rb rename to lib/slot_machine/instruction/not_same_check.rb diff --git a/lib/mom/instruction/resolve_method.rb b/lib/slot_machine/instruction/resolve_method.rb similarity index 100% rename from lib/mom/instruction/resolve_method.rb rename to lib/slot_machine/instruction/resolve_method.rb diff --git a/lib/mom/instruction/return_jump.rb b/lib/slot_machine/instruction/return_jump.rb similarity index 100% rename from lib/mom/instruction/return_jump.rb rename to lib/slot_machine/instruction/return_jump.rb diff --git a/lib/mom/instruction/return_sequence.rb b/lib/slot_machine/instruction/return_sequence.rb similarity index 100% rename from lib/mom/instruction/return_sequence.rb rename to lib/slot_machine/instruction/return_sequence.rb diff --git a/lib/mom/instruction/simple_call.rb b/lib/slot_machine/instruction/simple_call.rb similarity index 100% rename from lib/mom/instruction/simple_call.rb rename to lib/slot_machine/instruction/simple_call.rb diff --git a/lib/mom/instruction/slot_definition.rb b/lib/slot_machine/instruction/slot_definition.rb similarity index 100% rename from lib/mom/instruction/slot_definition.rb rename to lib/slot_machine/instruction/slot_definition.rb diff --git a/lib/mom/instruction/slot_load.rb b/lib/slot_machine/instruction/slot_load.rb similarity index 100% rename from lib/mom/instruction/slot_load.rb rename to lib/slot_machine/instruction/slot_load.rb diff --git a/lib/mom/instruction/truth_check.rb b/lib/slot_machine/instruction/truth_check.rb similarity index 100% rename from lib/mom/instruction/truth_check.rb rename to lib/slot_machine/instruction/truth_check.rb diff --git a/lib/mom/macro/README.md b/lib/slot_machine/macro/README.md similarity index 100% rename from lib/mom/macro/README.md rename to lib/slot_machine/macro/README.md diff --git a/lib/mom/macro/comparison.rb b/lib/slot_machine/macro/comparison.rb similarity index 100% rename from lib/mom/macro/comparison.rb rename to lib/slot_machine/macro/comparison.rb diff --git a/lib/mom/macro/div10.rb b/lib/slot_machine/macro/div10.rb similarity index 100% rename from lib/mom/macro/div10.rb rename to lib/slot_machine/macro/div10.rb diff --git a/lib/mom/macro/div4.rb b/lib/slot_machine/macro/div4.rb similarity index 100% rename from lib/mom/macro/div4.rb rename to lib/slot_machine/macro/div4.rb diff --git a/lib/mom/macro/exit.rb b/lib/slot_machine/macro/exit.rb similarity index 100% rename from lib/mom/macro/exit.rb rename to lib/slot_machine/macro/exit.rb diff --git a/lib/mom/macro/get_internal_byte.rb b/lib/slot_machine/macro/get_internal_byte.rb similarity index 100% rename from lib/mom/macro/get_internal_byte.rb rename to lib/slot_machine/macro/get_internal_byte.rb diff --git a/lib/mom/macro/get_internal_word.rb b/lib/slot_machine/macro/get_internal_word.rb similarity index 100% rename from lib/mom/macro/get_internal_word.rb rename to lib/slot_machine/macro/get_internal_word.rb diff --git a/lib/mom/macro/init.rb b/lib/slot_machine/macro/init.rb similarity index 100% rename from lib/mom/macro/init.rb rename to lib/slot_machine/macro/init.rb diff --git a/lib/mom/macro/macro.rb b/lib/slot_machine/macro/macro.rb similarity index 100% rename from lib/mom/macro/macro.rb rename to lib/slot_machine/macro/macro.rb diff --git a/lib/mom/macro/method_missing.rb b/lib/slot_machine/macro/method_missing.rb similarity index 100% rename from lib/mom/macro/method_missing.rb rename to lib/slot_machine/macro/method_missing.rb diff --git a/lib/mom/macro/object.rb b/lib/slot_machine/macro/object.rb similarity index 100% rename from lib/mom/macro/object.rb rename to lib/slot_machine/macro/object.rb diff --git a/lib/mom/macro/operator.rb b/lib/slot_machine/macro/operator.rb similarity index 100% rename from lib/mom/macro/operator.rb rename to lib/slot_machine/macro/operator.rb diff --git a/lib/mom/macro/putstring.rb b/lib/slot_machine/macro/putstring.rb similarity index 100% rename from lib/mom/macro/putstring.rb rename to lib/slot_machine/macro/putstring.rb diff --git a/lib/mom/macro/set_internal_byte.rb b/lib/slot_machine/macro/set_internal_byte.rb similarity index 100% rename from lib/mom/macro/set_internal_byte.rb rename to lib/slot_machine/macro/set_internal_byte.rb diff --git a/lib/mom/macro/set_internal_word.rb b/lib/slot_machine/macro/set_internal_word.rb similarity index 100% rename from lib/mom/macro/set_internal_word.rb rename to lib/slot_machine/macro/set_internal_word.rb diff --git a/lib/mom/method_compiler.rb b/lib/slot_machine/method_compiler.rb similarity index 100% rename from lib/mom/method_compiler.rb rename to lib/slot_machine/method_compiler.rb diff --git a/lib/mom/mom_collection.rb b/lib/slot_machine/slot_collection.rb similarity index 84% rename from lib/mom/mom_collection.rb rename to lib/slot_machine/slot_collection.rb index 6021aa47..b72ed38a 100644 --- a/lib/mom/mom_collection.rb +++ b/lib/slot_machine/slot_collection.rb @@ -1,12 +1,12 @@ -module Mom - # The Compiler/Collection for the Mom level is a collection of Mom level Method +module SlotMachine + # The Compiler/Collection for the SlotMachine level is a collection of SlotMachine level Method # compilers These will transform to Risc MethodCompilers on the way down. # # As RubyCompiler pools source at the vool level, when several classes are compiled - # from vool to mom, several MomCompilers get instantiated. They must be merged before + # from vool to mom, several SlotMachineCompilers get instantiated. They must be merged before # proceeding with translate. Thus we have a append method. # - class MomCollection + class SlotCollection attr_reader :method_compilers # Initialize with an array of risc MethodCompilers @@ -19,8 +19,8 @@ module Mom def init_compilers return if @init_compilers @init_compilers = true - add_compiler MomCollection.create_init_compiler - add_compiler MomCollection.create_mm_compiler + add_compiler SlotCollection.create_init_compiler + add_compiler SlotCollection.create_mm_compiler self end @@ -40,7 +40,7 @@ module Mom self end - # Append another MomCompilers method_compilers to this one. + # Append another SlotMachineCompilers method_compilers to this one. def append(collection) @method_compilers.add_method_compiler( collection.method_compilers) self diff --git a/lib/mom/mom.rb b/lib/slot_machine/slot_machine.rb similarity index 71% rename from lib/mom/mom.rb rename to lib/slot_machine/slot_machine.rb index a39fcc61..bc9c2f86 100644 --- a/lib/mom/mom.rb +++ b/lib/slot_machine/slot_machine.rb @@ -7,12 +7,13 @@ # # ### Instruction based # -# So a machine rather than a language. No control structures, but compare and jump instructions. -# No send or call, just objects and jump. -# Machine capabilities (instructions) for basic operations. Use of macros for higher level. +# So a machine rather than a language. No control structures, but compare and jump +# instructions. No send or dynamic call, just objects and jump. +# Machine capabilities (instructions) for basic operations. +# Use of macros for higher level. require_relative "instruction.rb" -require_relative "mom_collection" +require_relative "slot_collection" require_relative "callable_compiler" require_relative "method_compiler" require_relative "block_compiler" diff --git a/lib/vool/README.md b/lib/vool/README.md index 2c5e8982..675803b8 100644 --- a/lib/vool/README.md +++ b/lib/vool/README.md @@ -12,7 +12,7 @@ Possibly later other languages can compile to this level and use rx-file as code Vool is a layer with concrete syntax tree, just like the ruby layer above. Vool is just simplified, without fluff, see below. -The next layer down is the Mom, Minimal object Machine, which uses an instruction list. +The next layer down is the SlotMachine, Minimal object Machine, which uses an instruction list. The nodes of the syntax tree are all the things one would expect from a language, if statements and the like. There is no context yet, and actual objects, @@ -33,4 +33,4 @@ existence of until, which really means if not. Other examples, some more impactf The compilation process ends up creating (parfait) objects to represent things like classes, types and constants. This is done in this layer, -on the way down to MOM (ie not during init) +on the way down to SlotMachine (ie not during init) diff --git a/lib/vool/assignment.rb b/lib/vool/assignment.rb index 35f138ed..c37882a1 100644 --- a/lib/vool/assignment.rb +++ b/lib/vool/assignment.rb @@ -30,13 +30,13 @@ module Vool # When the right hand side is a CallStatement, it must be compiled, before the assign # is executed # - # Derived classes do not implement to_mom, only slot_position - def to_mom(compiler) - to = Mom::SlotDefinition.new(:message , self.slot_position(compiler)) - from = @value.to_slot(compiler) - assign = Mom::SlotLoad.new(self,to,from) + # Derived classes do not implement to_slot, only slot_position + def to_slot(compiler) + to = SlotMachine::SlotDefinition.new(:message , self.slot_position(compiler)) + from = @value.to_slot_definition(compiler) + assign = SlotMachine::SlotLoad.new(self,to,from) return assign unless @value.is_a?(CallStatement) - @value.to_mom(compiler) << assign + @value.to_slot(compiler) << assign end end end diff --git a/lib/vool/basic_values.rb b/lib/vool/basic_values.rb index aaca4a23..078fc74e 100644 --- a/lib/vool/basic_values.rb +++ b/lib/vool/basic_values.rb @@ -9,8 +9,8 @@ module Vool def initialize(value) @value = value end - def to_slot(_) - return Mom::SlotDefinition.new(Mom::IntegerConstant.new(@value) , []) + def to_slot_definition(_) + return SlotMachine::SlotDefinition.new(SlotMachine::IntegerConstant.new(@value) , []) end def ct_type Parfait.object_space.get_type_by_class_name(:Integer) @@ -37,8 +37,8 @@ module Vool def ct_type Parfait.object_space.get_type_by_class_name(:True) end - def to_slot(_) - return Mom::SlotDefinition.new(Parfait.object_space.true_object , []) + def to_slot_definition(_) + return SlotMachine::SlotDefinition.new(Parfait.object_space.true_object , []) end def to_s(depth = 0) "true" @@ -49,8 +49,8 @@ module Vool def ct_type Parfait.object_space.get_type_by_class_name(:False) end - def to_slot(_) - return Mom::SlotDefinition.new(Parfait.object_space.false_object , []) + def to_slot_definition(_) + return SlotMachine::SlotDefinition.new(Parfait.object_space.false_object , []) end def to_s(depth = 0) "false" @@ -61,8 +61,8 @@ module Vool def ct_type Parfait.object_space.get_type_by_class_name(:Nil) end - def to_slot(_) - return Mom::SlotDefinition.new(Parfait.object_space.nil_object , []) + def to_slot_definition(_) + return SlotMachine::SlotDefinition.new(Parfait.object_space.nil_object , []) end def to_s(depth = 0) "nil" @@ -75,9 +75,9 @@ module Vool def initialize(type = nil) @my_type = type end - def to_slot(compiler) + def to_slot_definition(compiler) @my_type = compiler.receiver_type - Mom::SlotDefinition.new(:message , [:receiver]) + SlotMachine::SlotDefinition.new(:message , [:receiver]) end def ct_type @my_type @@ -91,8 +91,8 @@ module Vool def initialize(value) @value = value end - def to_slot(_) - return Mom::SlotDefinition.new(Mom::StringConstant.new(@value),[]) + def to_slot_definition(_) + return SlotMachine::SlotDefinition.new(SlotMachine::StringConstant.new(@value),[]) end def ct_type Parfait.object_space.get_type_by_class_name(:Word) diff --git a/lib/vool/call_statement.rb b/lib/vool/call_statement.rb index 6c2e25a3..ae1da4d8 100644 --- a/lib/vool/call_statement.rb +++ b/lib/vool/call_statement.rb @@ -10,8 +10,8 @@ module Vool # When used as right hand side, this tells what data to move to get the result into # a varaible. It is (off course) the return value of the message - def to_slot(_) - Mom::SlotDefinition.new(:message ,[ :return_value]) + def to_slot_definition(_) + SlotMachine::SlotDefinition.new(:message ,[ :return_value]) end def to_s(depth = 0) diff --git a/lib/vool/class_expression.rb b/lib/vool/class_expression.rb index b867601f..6f493606 100644 --- a/lib/vool/class_expression.rb +++ b/lib/vool/class_expression.rb @@ -42,21 +42,21 @@ module Vool # Other statements are not yet allowed (baring in mind that attribute # accessors are transformed to methods in the ruby layer ) # - # As there is no class equivalnet in code, a MomCollection is returned, - # which is just a list of Mom::MethodCompilers + # As there is no class equivalnet in code, a SlotCollection is returned, + # which is just a list of SlotMachine::MethodCompilers # The compilers help to transform the code further, into Risc next - def to_mom( _ ) + def to_slot( _ ) method_compilers = body.statements.collect do |node| case node when MethodExpression - node.to_mom(@clazz) + node.to_slot(@clazz) when ClassMethodExpression - node.to_mom(@clazz.single_class) + node.to_slot(@clazz.single_class) else raise "Only methods for now #{node.class}:#{node}" end end - Mom::MomCollection.new(method_compilers) + SlotMachine::SlotCollection.new(method_compilers) end # goes through the code looking for instance variables and their assignments. diff --git a/lib/vool/class_method_expression.rb b/lib/vool/class_method_expression.rb index c7cd3faf..cc2d805d 100644 --- a/lib/vool/class_method_expression.rb +++ b/lib/vool/class_method_expression.rb @@ -17,7 +17,7 @@ module Vool vool_m end - def to_mom(clazz) + def to_slot(clazz) raise "not singleton #{clazz.class}" unless clazz.class == Parfait::SingletonClass raise( "no class in #{self}") unless clazz method = clazz.get_instance_method(name ) diff --git a/lib/vool/if_statement.rb b/lib/vool/if_statement.rb index 5a8ded38..375d2f37 100644 --- a/lib/vool/if_statement.rb +++ b/lib/vool/if_statement.rb @@ -10,29 +10,29 @@ module Vool @if_false = if_false end - def to_mom( compiler ) - true_label = Mom::Label.new( self , "true_label_#{object_id.to_s(16)}") - false_label = Mom::Label.new( self , "false_label_#{object_id.to_s(16)}") - merge_label = Mom::Label.new( self , "merge_label_#{object_id.to_s(16)}") + def to_slot( compiler ) + true_label = SlotMachine::Label.new( self , "true_label_#{object_id.to_s(16)}") + false_label = SlotMachine::Label.new( self , "false_label_#{object_id.to_s(16)}") + merge_label = SlotMachine::Label.new( self , "merge_label_#{object_id.to_s(16)}") if @condition.is_a?(CallStatement) - head = @condition.to_mom(compiler) + head = @condition.to_slot(compiler) head << check_slot(compiler , false_label) else head = check_slot(compiler , false_label) end head << true_label - head << if_true.to_mom(compiler) if @if_true - head << Mom::Jump.new(merge_label) if @if_false + head << if_true.to_slot(compiler) if @if_true + head << SlotMachine::Jump.new(merge_label) if @if_false head << false_label - head << if_false.to_mom(compiler) if @if_false + head << if_false.to_slot(compiler) if @if_false head << merge_label if @if_false head end - # create the slot lazily, so to_mom gets called first + # create the slot lazily, so to_slot gets called first def check_slot(compiler , false_label) - Mom::TruthCheck.new(@condition.to_slot(compiler) , false_label) + SlotMachine::TruthCheck.new(@condition.to_slot_definition(compiler) , false_label) end def each(&block) diff --git a/lib/vool/lambda_expression.rb b/lib/vool/lambda_expression.rb index edef2376..524799b0 100644 --- a/lib/vool/lambda_expression.rb +++ b/lib/vool/lambda_expression.rb @@ -11,19 +11,19 @@ module Vool # because of normalization (of send), slot_definition is called first, # to assign the block to a variable. # - # This means we do the compiler here (rather than to_mom, which is in + # This means we do the compiler here (rather than to_slot, which is in # fact never called) - def to_slot(compiler) + def to_slot_definition(compiler) compile(compiler) unless @parfait_block - return Mom::SlotDefinition.new(Mom::LambdaConstant.new(parfait_block(compiler)) , []) + return SlotMachine::SlotDefinition.new(SlotMachine::LambdaConstant.new(parfait_block(compiler)) , []) end # create a block, a compiler for it, comile the bock and add the compiler(code) # to the method compiler for further processing def compile( compiler ) parfait_block = self.parfait_block(compiler) - block_compiler = Mom::BlockCompiler.new( parfait_block , compiler.get_method ) - head = body.to_mom( block_compiler ) + block_compiler = SlotMachine::BlockCompiler.new( parfait_block , compiler.get_method ) + head = body.to_slot( block_compiler ) block_compiler.add_code(head) compiler.add_method_compiler(block_compiler) nil diff --git a/lib/vool/macro_expression.rb b/lib/vool/macro_expression.rb index 03a69221..ef64f534 100644 --- a/lib/vool/macro_expression.rb +++ b/lib/vool/macro_expression.rb @@ -6,16 +6,16 @@ module Vool super(name , SelfExpression.new , arguments) end - def to_mom(compiler) + def to_slot(compiler) parts = name.to_s.split("_") - class_name = "Mom::#{parts.collect{|s| s.capitalize}.join}" + class_name = "SlotMachine::#{parts.collect{|s| s.capitalize}.join}" eval(class_name).new( self , *arguments) end # When used as right hand side, this tells what data to move to get the result into # a varaible. It is (off course) the return value of the message - def to_slot(_) - Mom::SlotDefinition.new(:message ,[ :return_value]) + def to_slot_definition(_) + SlotMachine::SlotDefinition.new(:message ,[ :return_value]) end def to_s(depth = 0) diff --git a/lib/vool/method_expression.rb b/lib/vool/method_expression.rb index de90548a..86c36208 100644 --- a/lib/vool/method_expression.rb +++ b/lib/vool/method_expression.rb @@ -22,8 +22,8 @@ module Vool vool_m end - # Creates the Mom::MethodCompiler that will do the next step - def to_mom(clazz) + # Creates the SlotMachine::MethodCompiler that will do the next step + def to_slot(clazz) raise( "no class in #{self}") unless clazz method = clazz.get_instance_method(@name) raise( "no method in #{@name} in #{clazz.name}") unless method diff --git a/lib/vool/return_statement.rb b/lib/vool/return_statement.rb index 2ea288de..cd5e90c9 100644 --- a/lib/vool/return_statement.rb +++ b/lib/vool/return_statement.rb @@ -16,14 +16,14 @@ module Vool # To return form a method in mom instructions we only need to do two things: # - store the given return value, this is a SlotMove # - activate return sequence (reinstantiate old message and jump to return address) - def to_mom( compiler ) + def to_slot( compiler ) if @return_value.is_a?(CallStatement) - ret = @return_value.to_mom(compiler) + ret = @return_value.to_slot(compiler) ret << slot_load(compiler) else ret = slot_load(compiler) end - ret << Mom::ReturnJump.new(self , compiler.return_label ) + ret << SlotMachine::ReturnJump.new(self , compiler.return_label ) end def to_s(depth = 0) @@ -31,8 +31,8 @@ module Vool end def slot_load(compiler) - Mom::SlotLoad.new( self , [:message , :return_value] , - @return_value.to_slot(compiler) ) + SlotMachine::SlotLoad.new( self , [:message , :return_value] , + @return_value.to_slot_definition(compiler) ) end end end diff --git a/lib/vool/send_statement.rb b/lib/vool/send_statement.rb index d31bf9b8..6e66e19a 100644 --- a/lib/vool/send_statement.rb +++ b/lib/vool/send_statement.rb @@ -28,7 +28,7 @@ module Vool # lazy init this, to keep the dependency (which goes to parfait and booting) at bay def dynamic_call - @dynamic ||= Mom::DynamicCall.new() + @dynamic ||= SlotMachine::DynamicCall.new() end # A Send breaks down to 2 steps: @@ -40,7 +40,7 @@ module Vool # So we check, and if find, add the source (vool_method) to the class and start # compiling the vool for the receiver_type # - def to_mom( compiler ) + def to_slot( compiler ) @receiver = SelfExpression.new(compiler.receiver_type) if @receiver.is_a?(SelfExpression) if(@receiver.ct_type) method = @receiver.ct_type.get_method(@name) @@ -66,18 +66,18 @@ module Vool end def message_setup(compiler,called_method) - setup = Mom::MessageSetup.new( called_method ) - mom_receive = @receiver.to_slot(compiler) + setup = SlotMachine::MessageSetup.new( called_method ) + mom_receive = @receiver.to_slot_definition(compiler) arg_target = [:message , :next_message ] args = [] @arguments.each_with_index do |arg , index| # +1 because of type - args << Mom::SlotLoad.new(self, arg_target + ["arg#{index+1}".to_sym] , arg.to_slot(compiler)) + args << SlotMachine::SlotLoad.new(self, arg_target + ["arg#{index+1}".to_sym] , arg.to_slot_definition(compiler)) end - setup << Mom::ArgumentTransfer.new(self, mom_receive , args ) + setup << SlotMachine::ArgumentTransfer.new(self, mom_receive , args ) end def simple_call(compiler, called_method) - message_setup(compiler,called_method) << Mom::SimpleCall.new(called_method) + message_setup(compiler,called_method) << SlotMachine::SimpleCall.new(called_method) end # this breaks cleanly into two parts: @@ -91,10 +91,10 @@ module Vool # if not, change and find method for the type (simple_call to resolve_method) # conceptually easy in ruby, but we have to compile that "easy" ruby def cache_check(compiler) - ok = Mom::Label.new(self,"cache_ok_#{self.object_id}") + ok = SlotMachine::Label.new(self,"cache_ok_#{self.object_id}") check = build_condition(ok, compiler) # if cached_type != current_type - check << Mom::SlotLoad.new(self,[dynamic_call.cache_entry, :cached_type] , receiver_type_definition(compiler)) - check << Mom::ResolveMethod.new(self, @name , dynamic_call.cache_entry ) + check << SlotMachine::SlotLoad.new(self,[dynamic_call.cache_entry, :cached_type] , receiver_type_definition(compiler)) + check << SlotMachine::ResolveMethod.new(self, @name , dynamic_call.cache_entry ) check << ok end @@ -111,14 +111,14 @@ module Vool private def receiver_type_definition(compiler) - defi = @receiver.to_slot(compiler) + defi = @receiver.to_slot_definition(compiler) defi.slots << :type defi end def build_condition(ok_label, compiler) - cached_type = Mom::SlotDefinition.new(dynamic_call.cache_entry , [:cached_type]) + cached_type = SlotMachine::SlotDefinition.new(dynamic_call.cache_entry , [:cached_type]) current_type = receiver_type_definition(compiler) - Mom::NotSameCheck.new(cached_type , current_type, ok_label) + SlotMachine::NotSameCheck.new(cached_type , current_type, ok_label) end end end diff --git a/lib/vool/statement.rb b/lib/vool/statement.rb index 266eaabb..7c0daee8 100644 --- a/lib/vool/statement.rb +++ b/lib/vool/statement.rb @@ -11,12 +11,12 @@ # data. Statements represent code whereas Expressions resolve to data. # (in ruby there are no pure statements, everthing resolves to data) # -# Vool resolves to Mom in the next step down. But it also the place where we create +# Vool resolves to SlotMachine in the next step down. But it also the place where we create # Parfait representations for the main oo players, ie classes and methods. # The protocol is thus two stage: # - first to_parfait with implicit side-effects of creating parfait objects that # are added to the Parfait object_space -# - second to_mom , which will return a mom version of the statement. This may be code +# - second to_slot , which will return a mom version of the statement. This may be code # or a compiler (for methods), or compiler collection (for classes) # module Vool @@ -43,7 +43,7 @@ module Vool # # The argument given most often is a compiler # The default implementation (this) is to raise an error - def to_mom( _ ) + def to_slot( _ ) raise "Not implemented for #{self}" end diff --git a/lib/vool/statements.rb b/lib/vool/statements.rb index 8f5a2d0a..b3170593 100644 --- a/lib/vool/statements.rb +++ b/lib/vool/statements.rb @@ -61,17 +61,17 @@ module Vool def to_parfait @statements.collect{|s| s.to_parfait} end - # to_mom all the statements. Append subsequent ones to the first, and return the + # to_slot all the statements. Append subsequent ones to the first, and return the # first. # - # For ClassStatements this creates and returns a MomCompiler + # For ClassStatements this creates and returns a SlotMachineCompiler # - def to_mom( compiler ) + def to_slot( compiler ) raise "Empty list ? #{statements.length}" if empty? stats = @statements.dup - first = stats.shift.to_mom(compiler) + first = stats.shift.to_slot(compiler) while( nekst = stats.shift ) - next_mom = nekst.to_mom(compiler) + next_mom = nekst.to_slot(compiler) first.append next_mom end first diff --git a/lib/vool/variables.rb b/lib/vool/variables.rb index 2d4dcfa5..03251818 100644 --- a/lib/vool/variables.rb +++ b/lib/vool/variables.rb @@ -10,9 +10,9 @@ module Vool class LocalVariable < Expression include Named - def to_slot(compiler) + def to_slot_definition(compiler) slot_def = compiler.slot_type_for(@name) - Mom::SlotDefinition.new(:message , slot_def) + SlotMachine::SlotDefinition.new(:message , slot_def) end def to_s(depth = 0) name.to_s @@ -24,8 +24,8 @@ module Vool class InstanceVariable < Expression include Named - def to_slot(_) - Mom::SlotDefinition.new(:message , [ :receiver , @name] ) + def to_slot_definition(_) + SlotMachine::SlotDefinition.new(:message , [ :receiver , @name] ) end # used to collect type information def add_ivar( array ) @@ -51,8 +51,8 @@ module Vool def ct_type get_named_class.single_class.instance_type end - def to_slot(_) - return Mom::SlotDefinition.new( get_named_class, []) + def to_slot_definition(_) + return SlotMachine::SlotDefinition.new( get_named_class, []) end def get_named_class Parfait.object_space.get_class_by_name(self.name) diff --git a/lib/vool/while_statement.rb b/lib/vool/while_statement.rb index 4622f064..404aa735 100644 --- a/lib/vool/while_statement.rb +++ b/lib/vool/while_statement.rb @@ -9,15 +9,15 @@ module Vool @body = body end - def to_mom( compiler ) - merge_label = Mom::Label.new(self, "merge_label_#{object_id.to_s(16)}") - cond_label = Mom::Label.new(self, "cond_label_#{object_id.to_s(16)}") + def to_slot( compiler ) + merge_label = SlotMachine::Label.new(self, "merge_label_#{object_id.to_s(16)}") + cond_label = SlotMachine::Label.new(self, "cond_label_#{object_id.to_s(16)}") codes = cond_label - codes << @hoisted.to_mom(compiler) if @hoisted - codes << @condition.to_mom(compiler) if @condition.is_a?(SendStatement) - codes << Mom::TruthCheck.new(condition.to_slot(compiler) , merge_label) - codes << @body.to_mom(compiler) - codes << Mom::Jump.new(cond_label) + codes << @hoisted.to_slot(compiler) if @hoisted + codes << @condition.to_slot(compiler) if @condition.is_a?(SendStatement) + codes << SlotMachine::TruthCheck.new(condition.to_slot_definition(compiler) , merge_label) + codes << @body.to_slot(compiler) + codes << SlotMachine::Jump.new(cond_label) codes << merge_label end diff --git a/lib/vool/yield_statement.rb b/lib/vool/yield_statement.rb index 1451b9a0..8d132664 100644 --- a/lib/vool/yield_statement.rb +++ b/lib/vool/yield_statement.rb @@ -5,7 +5,7 @@ module Vool # # On the ruby side, normalisation works pretty much the same too. # - # On the way down to Mom, small differences become abvious, as the block that is + # On the way down to SlotMachine, small differences become abvious, as the block that is # yielded to is an argument. Whereas in a send it is either statically known # or resolved and cached. Here it is dynamic, but sort of known dynamic. # All we do before calling it is check that it is the right type. @@ -14,8 +14,8 @@ module Vool # A Yield breaks down to 2 steps: # - Setting up the next message, with receiver, arguments, and (importantly) return address # - a SimpleCall, - def to_mom( compiler ) - @parfait_block = @block.to_mom(compiler) if @block + def to_slot( compiler ) + @parfait_block = @block.to_slot(compiler) if @block @receiver = SelfExpression.new(compiler.receiver_type) if @receiver.is_a?(SelfExpression) yield_call(compiler) end @@ -33,10 +33,10 @@ module Vool # this needs run-time variable resolution, which is just not done. # we brace ourselves with the check, and exit (later raise) if . . . def method_check(compiler) - ok_label = Mom::Label.new(self,"method_ok_#{self.object_id}") - compile_method = Mom::SlotDefinition.new( compiler.get_method , []) - runtime_method = Mom::SlotDefinition.new( :message , [ :method] ) - check = Mom::NotSameCheck.new(compile_method , runtime_method, ok_label) + ok_label = SlotMachine::Label.new(self,"method_ok_#{self.object_id}") + compile_method = SlotMachine::SlotDefinition.new( compiler.get_method , []) + runtime_method = SlotMachine::SlotDefinition.new( :message , [ :method] ) + check = SlotMachine::NotSameCheck.new(compile_method , runtime_method, ok_label) # TODO? Maybe create mom instructions for this #builder = compiler.builder("yield") #Risc::Macro.exit_sequence(builder) @@ -48,15 +48,15 @@ module Vool # we do a message setup, arg transfer and the a arg_yield (which is similar to dynamic_call) def yield_arg_block(compiler) arg_index = compiler.get_method.arguments_type.get_length - 1 - setup = Mom::MessageSetup.new( arg_index ) - mom_receive = @receiver.to_slot(compiler) + setup = SlotMachine::MessageSetup.new( arg_index ) + mom_receive = @receiver.to_slot_definition(compiler) arg_target = [:message , :next_message ] args = [] @arguments.each_with_index do |arg , index| # +1 because of type - args << Mom::SlotLoad.new(self, arg_target + ["arg#{index+1}".to_sym] , arg.to_slot(compiler)) + args << SlotMachine::SlotLoad.new(self, arg_target + ["arg#{index+1}".to_sym] , arg.to_slot_definition(compiler)) end - setup << Mom::ArgumentTransfer.new( self , mom_receive , args ) - setup << Mom::BlockYield.new( self , arg_index ) + setup << SlotMachine::ArgumentTransfer.new( self , mom_receive , args ) + setup << SlotMachine::BlockYield.new( self , arg_index ) end end diff --git a/test/README.md b/test/README.md index 6ce9f502..d16e45ba 100644 --- a/test/README.md +++ b/test/README.md @@ -15,7 +15,7 @@ time comes to move to rubyx, less work. ruby test/test_all.rb '''' -### Parfait, Risc , Arm , Mom +### Parfait, Risc , Arm , SlotMachine Follow the directory structure of the source and may be called unit tests diff --git a/test/mom/test_class_statement.rb b/test/mom/test_class_statement.rb deleted file mode 100644 index 40fce4c5..00000000 --- a/test/mom/test_class_statement.rb +++ /dev/null @@ -1,24 +0,0 @@ - -require_relative "helper" - -module Vool - class TestClassStatementMom < MiniTest::Test - include MomCompile - - def setup - @ret = compile_mom( as_main("return 1")) - end - - def test_return_class - assert_equal Mom::MomCollection , @ret.class - end - def test_has_compilers - assert_equal Mom::MethodCompiler , @ret.method_compilers.class - end - - def test_constant - assert @ret.method_compilers.add_constant( Parfait::Integer.new(5) ) - end - - end -end diff --git a/test/risc/test_builder.rb b/test/risc/test_builder.rb index c319191f..128ac556 100644 --- a/test/risc/test_builder.rb +++ b/test/risc/test_builder.rb @@ -6,7 +6,7 @@ module Risc def setup Parfait.boot!(Parfait.default_test_options) Risc.boot! - label = Mom::Label.new( "source_name", "return_label") + label = SlotMachine::Label.new( "source_name", "return_label") @builder = Risc::MethodCompiler.new( FakeCallable.new ,label).builder("source") @label = Risc.label("source","name") @start = @builder.compiler.current diff --git a/test/risc/test_builder1.rb b/test/risc/test_builder1.rb index e376a6b6..485c1fb2 100644 --- a/test/risc/test_builder1.rb +++ b/test/risc/test_builder1.rb @@ -5,8 +5,8 @@ module Risc include Parfait::MethodHelper def setup Parfait.boot!(Parfait.default_test_options) - @method = Mom::MomCollection.compiler_for( :Space , :main,{},{}).callable - @compiler = Risc::MethodCompiler.new( @method , Mom::Label.new( "source_name", "return_label")) + @method = SlotMachine::SlotCollection.compiler_for( :Space , :main,{},{}).callable + @compiler = Risc::MethodCompiler.new( @method , SlotMachine::Label.new( "source_name", "return_label")) @builder = @compiler.builder(@method) end def test_inserts_built diff --git a/test/risc/test_builder2.rb b/test/risc/test_builder2.rb index 66c6dd45..d2fe0f26 100644 --- a/test/risc/test_builder2.rb +++ b/test/risc/test_builder2.rb @@ -7,7 +7,7 @@ module Risc Parfait.boot!(Parfait.default_test_options) Risc.boot! method = FakeCallable.new - @compiler = Risc::MethodCompiler.new( method, Mom::Label.new( "source_name", "return_label") ) + @compiler = Risc::MethodCompiler.new( method, SlotMachine::Label.new( "source_name", "return_label") ) @builder = @compiler.builder(method) end def test_list diff --git a/test/risc/test_callable_compiler.rb b/test/risc/test_callable_compiler.rb index db3dd02d..152832bd 100644 --- a/test/risc/test_callable_compiler.rb +++ b/test/risc/test_callable_compiler.rb @@ -12,7 +12,7 @@ module Risc def setup Parfait.boot!({}) - label = Mom::Label.new("hi","ho") + label = SlotMachine::Label.new("hi","ho") @compiler = FakeCallableCompiler.new(FakeCallable.new , label) end def test_ok @@ -25,7 +25,7 @@ module Risc assert_equal Label , @compiler.current.class assert_equal "ho" , @compiler.current.name end - def test_mom + def test_slot assert @compiler.risc_instructions end def test_const diff --git a/test/risc/test_method_compiler.rb b/test/risc/test_method_compiler.rb index 0e8ea341..7f3f5488 100644 --- a/test/risc/test_method_compiler.rb +++ b/test/risc/test_method_compiler.rb @@ -7,7 +7,7 @@ module Risc def setup code = in_Test("def meth; @ivar = 5;return ;end") rubyx = RubyX::RubyXCompiler.new(RubyX.default_test_options) - @compiler = rubyx.ruby_to_mom(code).compilers.to_risc + @compiler = rubyx.ruby_to_slot(code).compilers.to_risc end def test_compiles_risc assert_equal Risc::MethodCompiler , @compiler.class diff --git a/test/risc/test_risc_collection.rb b/test/risc/test_risc_collection.rb index cc6c9d4e..6817ee8d 100644 --- a/test/risc/test_risc_collection.rb +++ b/test/risc/test_risc_collection.rb @@ -1,11 +1,11 @@ require_relative "helper" module Risc - class TestMomCompilerTranslate < MiniTest::Test - include MomCompile + class TestSlotMachineCompilerTranslate < MiniTest::Test + include SlotMachineCompile def setup - @comp = compile_mom( "class Space ; def main(); main{return 'Ho'};return 'Hi'; end; end;") + @comp = compile_slot( "class Space ; def main(); main{return 'Ho'};return 'Hi'; end; end;") @linker = @comp.to_risc.translate(:interpreter) end diff --git a/test/risc/test_risc_compiler.rb b/test/risc/test_risc_compiler.rb index cc6c9d4e..6817ee8d 100644 --- a/test/risc/test_risc_compiler.rb +++ b/test/risc/test_risc_compiler.rb @@ -1,11 +1,11 @@ require_relative "helper" module Risc - class TestMomCompilerTranslate < MiniTest::Test - include MomCompile + class TestSlotMachineCompilerTranslate < MiniTest::Test + include SlotMachineCompile def setup - @comp = compile_mom( "class Space ; def main(); main{return 'Ho'};return 'Hi'; end; end;") + @comp = compile_slot( "class Space ; def main(); main{return 'Ho'};return 'Hi'; end; end;") @linker = @comp.to_risc.translate(:interpreter) end diff --git a/test/rubyx/helper.rb b/test/rubyx/helper.rb index bda9d5ba..a969ce2b 100644 --- a/test/rubyx/helper.rb +++ b/test/rubyx/helper.rb @@ -9,14 +9,14 @@ module RubyX options = RubyX.default_test_options.merge(options) RubyXCompiler.new(options).ruby_to_vool(input) end - def ruby_to_mom(input , options = {}) + def ruby_to_slot(input , options = {}) options = RubyX.default_test_options.merge(options) - RubyXCompiler.new(options).ruby_to_mom(input) + RubyXCompiler.new(options).ruby_to_slot(input) end def compile_in_test( input , options = {}) vool = ruby_to_vool(in_Test(input) , options) vool.to_parfait - vool.to_mom(nil) + vool.to_slot(nil) itest = Parfait.object_space.get_class_by_name(:Test) assert itest itest diff --git a/test/rubyx/macro/README.md b/test/rubyx/macro/README.md index 98bba947..6e81d946 100644 --- a/test/rubyx/macro/README.md +++ b/test/rubyx/macro/README.md @@ -10,10 +10,10 @@ On the way there, we start by Testing and moving the old ones. Since we want to to test some methods even after the move, without parsing/processing the whole of parfait we have to have a method of "injecting" the single? methods. -## Mom level +## SlotMachine level -There a re two test levels to every method. Mom being the first, where we basically just -see if the right Mom instruction has been generated +There a re two test levels to every method. SlotMachine being the first, where we basically just +see if the right SlotMachine instruction has been generated ## Risc diff --git a/test/rubyx/macro/helper.rb b/test/rubyx/macro/helper.rb index 12518024..04acfc6d 100644 --- a/test/rubyx/macro/helper.rb +++ b/test/rubyx/macro/helper.rb @@ -4,10 +4,10 @@ module RubyX module MacroHelper def setup whole ="class Space;def main(arg);return;end;end;" + source - @mom = RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(whole) + @mom = RubyXCompiler.new(RubyX.default_test_options).ruby_to_slot(whole) @mom.method_compilers - assert_equal Mom::MomCollection , @mom.class - assert_equal Mom::MethodCompiler , compiler.class + assert_equal SlotMachine::SlotCollection , @mom.class + assert_equal SlotMachine::MethodCompiler , compiler.class end def compiler @mom.method_compilers.last_compiler diff --git a/test/rubyx/macro/test_integer_comparison.rb b/test/rubyx/macro/test_integer_comparison.rb index da9cac0a..82c356ee 100644 --- a/test/rubyx/macro/test_integer_comparison.rb +++ b/test/rubyx/macro/test_integer_comparison.rb @@ -15,15 +15,15 @@ module RubyX end GET end - def test_mom_meth + def test_slot_meth assert_equal op , compiler.callable.name end def test_instr_len - assert_equal 7 , compiler.mom_instructions.length + assert_equal 7 , compiler.slot_instructions.length end def test_instr_op - assert_equal Mom::Comparison , compiler.mom_instructions.next.class - assert_equal op , compiler.mom_instructions.next.operator + assert_equal SlotMachine::Comparison , compiler.slot_instructions.next.class + assert_equal op , compiler.slot_instructions.next.operator end def test_risc assert_equal len , compiler.to_risc.risc_instructions.length diff --git a/test/rubyx/macro/test_integer_div10.rb b/test/rubyx/macro/test_integer_div10.rb index 997a03f7..e48f7cce 100644 --- a/test/rubyx/macro/test_integer_div10.rb +++ b/test/rubyx/macro/test_integer_div10.rb @@ -13,14 +13,14 @@ module RubyX end GET end - def test_mom_meth + def test_slot_meth assert_equal :div10 , compiler.callable.name end def test_instr_len - assert_equal 7 , compiler.mom_instructions.length + assert_equal 7 , compiler.slot_instructions.length end def test_instr_get - assert_equal Mom::Div10 , compiler.mom_instructions.next.class + assert_equal SlotMachine::Div10 , compiler.slot_instructions.next.class end def test_risc assert_equal 70 , compiler.to_risc.risc_instructions.length diff --git a/test/rubyx/macro/test_integer_div4.rb b/test/rubyx/macro/test_integer_div4.rb index 222c34c4..b742548b 100644 --- a/test/rubyx/macro/test_integer_div4.rb +++ b/test/rubyx/macro/test_integer_div4.rb @@ -13,14 +13,14 @@ module RubyX end GET end - def test_mom_meth + def test_slot_meth assert_equal :div4 , compiler.callable.name end def test_instr_len - assert_equal 7 , compiler.mom_instructions.length + assert_equal 7 , compiler.slot_instructions.length end def test_instr_get - assert_equal Mom::Div4 , compiler.mom_instructions.next.class + assert_equal SlotMachine::Div4 , compiler.slot_instructions.next.class end def test_risc assert_equal 41 , compiler.to_risc.risc_instructions.length diff --git a/test/rubyx/macro/test_integer_operator.rb b/test/rubyx/macro/test_integer_operator.rb index 577e7f6a..b7c46f1e 100644 --- a/test/rubyx/macro/test_integer_operator.rb +++ b/test/rubyx/macro/test_integer_operator.rb @@ -14,15 +14,15 @@ module RubyX end GET end - def test_mom_meth + def test_slot_meth assert_equal op , compiler.callable.name end def test_instr_len - assert_equal 7 , compiler.mom_instructions.length + assert_equal 7 , compiler.slot_instructions.length end def test_instr_op - assert_equal Mom::IntOperator , compiler.mom_instructions.next.class - assert_equal op , compiler.mom_instructions.next.operator + assert_equal SlotMachine::IntOperator , compiler.slot_instructions.next.class + assert_equal op , compiler.slot_instructions.next.operator end def test_risc assert_equal 42 , compiler.to_risc.risc_instructions.length diff --git a/test/rubyx/macro/test_object_exit.rb b/test/rubyx/macro/test_object_exit.rb index 139d923a..777fa4c6 100644 --- a/test/rubyx/macro/test_object_exit.rb +++ b/test/rubyx/macro/test_object_exit.rb @@ -13,14 +13,14 @@ module RubyX end GET end - def test_mom_meth + def test_slot_meth assert_equal :exit , compiler.callable.name end def test_instr_len - assert_equal 7 , compiler.mom_instructions.length + assert_equal 7 , compiler.slot_instructions.length end def test_instr_get - assert_equal Mom::Exit , compiler.mom_instructions.next.class + assert_equal SlotMachine::Exit , compiler.slot_instructions.next.class end def test_risc assert_equal 40 , compiler.to_risc.risc_instructions.length diff --git a/test/rubyx/macro/test_object_get.rb b/test/rubyx/macro/test_object_get.rb index ea14bd1d..8e59f14a 100644 --- a/test/rubyx/macro/test_object_get.rb +++ b/test/rubyx/macro/test_object_get.rb @@ -13,14 +13,14 @@ module RubyX end GET end - def test_mom_meth + def test_slot_meth assert_equal :get_internal_word , compiler.callable.name end def test_instr_len - assert_equal 7 , compiler.mom_instructions.length + assert_equal 7 , compiler.slot_instructions.length end def test_instr_get - assert_equal Mom::GetInternalWord , compiler.mom_instructions.next.class + assert_equal SlotMachine::GetInternalWord , compiler.slot_instructions.next.class end def test_risc assert_equal 18 , compiler.to_risc.risc_instructions.length diff --git a/test/rubyx/macro/test_object_init.rb b/test/rubyx/macro/test_object_init.rb index 21393491..144073f6 100644 --- a/test/rubyx/macro/test_object_init.rb +++ b/test/rubyx/macro/test_object_init.rb @@ -13,14 +13,14 @@ module RubyX end GET end - def test_mom_meth + def test_slot_meth assert_equal :__init , compiler.callable.name end def test_instr_len - assert_equal 7 , compiler.mom_instructions.length + assert_equal 7 , compiler.slot_instructions.length end def test_instr_get - assert_equal Mom::Init , compiler.mom_instructions.next.class + assert_equal SlotMachine::Init , compiler.slot_instructions.next.class end def test_risc assert_equal 31 , compiler.to_risc.risc_instructions.length diff --git a/test/rubyx/macro/test_object_missing.rb b/test/rubyx/macro/test_object_missing.rb index 53e5d609..c6895c85 100644 --- a/test/rubyx/macro/test_object_missing.rb +++ b/test/rubyx/macro/test_object_missing.rb @@ -13,14 +13,14 @@ module RubyX end GET end - def test_mom_meth + def test_slot_meth assert_equal :method_missing , compiler.callable.name end def test_instr_len - assert_equal 7 , compiler.mom_instructions.length + assert_equal 7 , compiler.slot_instructions.length end def test_instr_get - assert_equal Mom::MethodMissing , compiler.mom_instructions.next.class + assert_equal SlotMachine::MethodMissing , compiler.slot_instructions.next.class end def test_risc assert_equal 15 , compiler.to_risc.risc_instructions.length diff --git a/test/rubyx/macro/test_object_set.rb b/test/rubyx/macro/test_object_set.rb index 3f9eadbb..3484f78f 100644 --- a/test/rubyx/macro/test_object_set.rb +++ b/test/rubyx/macro/test_object_set.rb @@ -13,14 +13,14 @@ module RubyX end GET end - def test_mom_meth + def test_slot_meth assert_equal :set_internal_word , compiler.callable.name end def test_instr_len - assert_equal 7 , compiler.mom_instructions.length + assert_equal 7 , compiler.slot_instructions.length end def test_instr_get - assert_equal Mom::SetInternalWord , compiler.mom_instructions.next.class + assert_equal SlotMachine::SetInternalWord , compiler.slot_instructions.next.class end def test_risc assert_equal 19 , compiler.to_risc.risc_instructions.length diff --git a/test/rubyx/macro/test_word_get.rb b/test/rubyx/macro/test_word_get.rb index 180007ce..869bbe97 100644 --- a/test/rubyx/macro/test_word_get.rb +++ b/test/rubyx/macro/test_word_get.rb @@ -13,14 +13,14 @@ module RubyX end GET end - def test_mom_meth + def test_slot_meth assert_equal :get_internal_byte , compiler.callable.name end def test_instr_len - assert_equal 7 , compiler.mom_instructions.length + assert_equal 7 , compiler.slot_instructions.length end def test_instr_get - assert_equal Mom::GetInternalByte , compiler.mom_instructions.next.class + assert_equal SlotMachine::GetInternalByte , compiler.slot_instructions.next.class end def test_risc assert_equal 41 , compiler.to_risc.risc_instructions.length diff --git a/test/rubyx/macro/test_word_putstring.rb b/test/rubyx/macro/test_word_putstring.rb index 05b64f44..0ae0c2e7 100644 --- a/test/rubyx/macro/test_word_putstring.rb +++ b/test/rubyx/macro/test_word_putstring.rb @@ -13,14 +13,14 @@ module RubyX end GET end - def test_mom_meth + def test_slot_meth assert_equal :putstring , compiler.callable.name end def test_instr_len - assert_equal 7 , compiler.mom_instructions.length + assert_equal 7 , compiler.slot_instructions.length end def test_instr_get - assert_equal Mom::Putstring , compiler.mom_instructions.next.class + assert_equal SlotMachine::Putstring , compiler.slot_instructions.next.class end def test_risc assert_equal 44 , compiler.to_risc.risc_instructions.length diff --git a/test/rubyx/macro/test_word_set.rb b/test/rubyx/macro/test_word_set.rb index b5c5ab65..d5759a1d 100644 --- a/test/rubyx/macro/test_word_set.rb +++ b/test/rubyx/macro/test_word_set.rb @@ -13,14 +13,14 @@ module RubyX end GET end - def test_mom_meth + def test_slot_meth assert_equal :set_internal_byte , compiler.callable.name end def test_instr_len - assert_equal 7 , compiler.mom_instructions.length + assert_equal 7 , compiler.slot_instructions.length end def test_instr_get - assert_equal Mom::SetInternalByte , compiler.mom_instructions.next.class + assert_equal SlotMachine::SetInternalByte , compiler.slot_instructions.next.class end def test_risc assert_equal 20 , compiler.to_risc.risc_instructions.length diff --git a/test/rubyx/parfait/README.md b/test/rubyx/parfait/README.md index 75077fee..2cf08b1b 100644 --- a/test/rubyx/parfait/README.md +++ b/test/rubyx/parfait/README.md @@ -8,7 +8,7 @@ Since we need Parfait in the runtime, we need to parse it and compile it. And since it is early days, we expect errors at every level during this process, which means testing every layer for every file. -Rather than create parfait tests for every layer (ie in the vool/mom/risc directories) +Rather than create parfait tests for every layer (ie in the vool/slot_machine/risc directories) we have one file per parfait file here. Each file tests all layers. The usual workflow is to start with a new file and create tests for vool, mom, risc,binary diff --git a/test/rubyx/parfait/test_data_object.rb b/test/rubyx/parfait/test_data_object.rb index 4c148c9e..48818aed 100644 --- a/test/rubyx/parfait/test_data_object.rb +++ b/test/rubyx/parfait/test_data_object.rb @@ -27,9 +27,9 @@ module RubyX assert_equal :Data4 , vool[2].name assert_equal :Data8 , vool[3].name end - def test_mom - mom = @compiler.ruby_to_mom source - assert_equal Mom::MomCollection , mom.class + def test_slot + mom = @compiler.ruby_to_slot source + assert_equal SlotMachine::SlotCollection , mom.class end def test_risc risc = compiler.ruby_to_risc( get_preload("Space.main") + source) diff --git a/test/rubyx/parfait/test_integer.rb b/test/rubyx/parfait/test_integer.rb index 3dd3f0cf..a33facfc 100644 --- a/test/rubyx/parfait/test_integer.rb +++ b/test/rubyx/parfait/test_integer.rb @@ -25,12 +25,12 @@ module RubyX assert_equal :Data4 , vool[2].name assert_equal :Data8 , vool[3].name end - def test_mom + def test_slot vool = @compiler.ruby_to_vool source vool.to_parfait #puts vool - mom = vool.to_mom(nil) - assert_equal Mom::MomCollection , mom.class + mom = vool.to_slot(nil) + assert_equal SlotMachine::SlotCollection , mom.class end def est_risc risc = compiler.ruby_to_risc source diff --git a/test/rubyx/parfait/test_object.rb b/test/rubyx/parfait/test_object.rb index cd89f29d..d0f43445 100644 --- a/test/rubyx/parfait/test_object.rb +++ b/test/rubyx/parfait/test_object.rb @@ -18,9 +18,9 @@ module RubyX assert_equal Vool::ClassExpression , vool.class assert_equal :Object , vool.name end - def test_mom - mom = compiler.ruby_to_mom source - assert_equal Mom::MomCollection , mom.class + def test_slot + mom = compiler.ruby_to_slot source + assert_equal SlotMachine::SlotCollection , mom.class end def test_risc risc = compiler.ruby_to_risc( get_preload("Space.main") + source) diff --git a/test/rubyx/test_rubyx_compiler1.rb b/test/rubyx/test_rubyx_compiler1.rb index 39264425..940dafdd 100644 --- a/test/rubyx/test_rubyx_compiler1.rb +++ b/test/rubyx/test_rubyx_compiler1.rb @@ -1,24 +1,24 @@ require_relative "helper" module RubyX - class TestRubyXCompilerMom < MiniTest::Test + class TestRubyXCompilerSlotMachine < MiniTest::Test include ScopeHelper include RubyXHelper def test_creates_class_without_deriviation - ruby_to_mom "class Testing ; end" + ruby_to_slot "class Testing ; end" clazz = Parfait.object_space.get_class_by_name(:Testing) assert clazz , "No classes created" assert_equal :Object , clazz.super_class_name end def test_creates_class_deriviation - mom = ruby_to_mom "class Testing ; end" + mom = ruby_to_slot "class Testing ; end" assert mom , "No classes created" end def test_creates_class_with_deriviation - ruby_to_mom "class Test2 < List ;end" + ruby_to_slot "class Test2 < List ;end" clazz = Parfait.object_space.get_class_by_name(:Test2) assert clazz, "No classes created" assert_equal :List , clazz.super_class_name diff --git a/test/mom/helper.rb b/test/slot_machine/helper.rb similarity index 100% rename from test/mom/helper.rb rename to test/slot_machine/helper.rb diff --git a/test/mom/instruction/helper.rb b/test/slot_machine/instruction/helper.rb similarity index 87% rename from test/mom/instruction/helper.rb rename to test/slot_machine/instruction/helper.rb index 7b5b8b81..bab01a63 100644 --- a/test/mom/instruction/helper.rb +++ b/test/slot_machine/instruction/helper.rb @@ -1,13 +1,13 @@ require_relative '../helper' -module Mom +module SlotMachine class InstructionMock < Instruction def initialize super("mocking") end end - # Most MomInstructionTests test the risc instructions of the mom instruction + # Most SlotMachineInstructionTests test the risc instructions of the mom instruction # quite carefully, ie every instruction, every register. # # This is done with the assert methods in risc_assert @@ -16,7 +16,7 @@ module Mom # For working code, one can get a list of those instructions by using the all_str as message # Most tests will test for length and give the all_str as message to see where it went wrong # like: assert_equal 8 , all.length , all_str - class MomInstructionTest < MiniTest::Test + class SlotMachineInstructionTest < MiniTest::Test include Output def setup Parfait.boot!(Parfait.default_test_options) diff --git a/test/mom/instruction/test_argument_transfer.rb b/test/slot_machine/instruction/test_argument_transfer.rb similarity index 90% rename from test/mom/instruction/test_argument_transfer.rb rename to test/slot_machine/instruction/test_argument_transfer.rb index dc71ea13..fb8836f9 100644 --- a/test/mom/instruction/test_argument_transfer.rb +++ b/test/slot_machine/instruction/test_argument_transfer.rb @@ -1,7 +1,7 @@ require_relative "helper" -module Mom - class TestArgumentTransfer < MomInstructionTest +module SlotMachine + class TestArgumentTransfer < SlotMachineInstructionTest def instruction receiver = SlotDefinition.new(:message , [:receiver]) arg = SlotLoad.new("test", [:message, :caller] , [:message,:type] ) diff --git a/test/mom/instruction/test_block_yield.rb b/test/slot_machine/instruction/test_block_yield.rb similarity index 91% rename from test/mom/instruction/test_block_yield.rb rename to test/slot_machine/instruction/test_block_yield.rb index 8188c742..81f8e3a9 100644 --- a/test/mom/instruction/test_block_yield.rb +++ b/test/slot_machine/instruction/test_block_yield.rb @@ -1,7 +1,7 @@ require_relative "helper" -module Mom - class TesBlockYield < MomInstructionTest +module SlotMachine + class TesBlockYield < SlotMachineInstructionTest def instruction BlockYield.new("source",1) end diff --git a/test/mom/instruction/test_dynamic_call.rb b/test/slot_machine/instruction/test_dynamic_call.rb similarity index 91% rename from test/mom/instruction/test_dynamic_call.rb rename to test/slot_machine/instruction/test_dynamic_call.rb index 7c7c0985..b312cf46 100644 --- a/test/mom/instruction/test_dynamic_call.rb +++ b/test/slot_machine/instruction/test_dynamic_call.rb @@ -1,7 +1,7 @@ require_relative "helper" -module Mom - class TestDynamicCall < MomInstructionTest +module SlotMachine + class TestDynamicCall < SlotMachineInstructionTest def instruction DynamicCall.new(nil,nil) end diff --git a/test/mom/instruction/test_jump.rb b/test/slot_machine/instruction/test_jump.rb similarity index 79% rename from test/mom/instruction/test_jump.rb rename to test/slot_machine/instruction/test_jump.rb index 6b2ac19e..4a8c37c7 100644 --- a/test/mom/instruction/test_jump.rb +++ b/test/slot_machine/instruction/test_jump.rb @@ -1,7 +1,7 @@ require_relative "helper" -module Mom - class TestJump < MomInstructionTest +module SlotMachine + class TestJump < SlotMachineInstructionTest def instruction Jump.new( Label.new("ok" , "target")) end diff --git a/test/mom/instruction/test_message_setup.rb b/test/slot_machine/instruction/test_message_setup.rb similarity index 87% rename from test/mom/instruction/test_message_setup.rb rename to test/slot_machine/instruction/test_message_setup.rb index 9f67d3af..3be2fff3 100644 --- a/test/mom/instruction/test_message_setup.rb +++ b/test/slot_machine/instruction/test_message_setup.rb @@ -1,7 +1,7 @@ require_relative "helper" -module Mom - class TestMessageSetupInt < MomInstructionTest +module SlotMachine + class TestMessageSetupInt < SlotMachineInstructionTest def instruction MessageSetup.new( 1 ) end @@ -18,7 +18,7 @@ module Mom assert_reg_to_slot risc(3) , :r1 , :r2 , 7 end end - class TestMessageSetupCache < MomInstructionTest + class TestMessageSetupCache < SlotMachineInstructionTest include Parfait::MethodHelper def instruction diff --git a/test/mom/instruction/test_not_same_check.rb b/test/slot_machine/instruction/test_not_same_check.rb similarity index 88% rename from test/mom/instruction/test_not_same_check.rb rename to test/slot_machine/instruction/test_not_same_check.rb index 28b7af2b..fd4f5217 100644 --- a/test/mom/instruction/test_not_same_check.rb +++ b/test/slot_machine/instruction/test_not_same_check.rb @@ -1,7 +1,7 @@ require_relative "helper" -module Mom - class TestNotSameCheck < MomInstructionTest +module SlotMachine + class TestNotSameCheck < SlotMachineInstructionTest def instruction target = SlotDefinition.new(:message , :caller) NotSameCheck.new(target , target , Label.new("ok" , "target")) diff --git a/test/mom/instruction/test_resolve_method.rb b/test/slot_machine/instruction/test_resolve_method.rb similarity index 96% rename from test/mom/instruction/test_resolve_method.rb rename to test/slot_machine/instruction/test_resolve_method.rb index 410f9bbc..de6ec50f 100644 --- a/test/mom/instruction/test_resolve_method.rb +++ b/test/slot_machine/instruction/test_resolve_method.rb @@ -1,7 +1,7 @@ require_relative "helper" -module Mom - class TestResolveMethod < MomInstructionTest +module SlotMachine + class TestResolveMethod < SlotMachineInstructionTest include Parfait::MethodHelper def instruction diff --git a/test/mom/instruction/test_return_jump.rb b/test/slot_machine/instruction/test_return_jump.rb similarity index 78% rename from test/mom/instruction/test_return_jump.rb rename to test/slot_machine/instruction/test_return_jump.rb index 2ac7ef03..98487b05 100644 --- a/test/mom/instruction/test_return_jump.rb +++ b/test/slot_machine/instruction/test_return_jump.rb @@ -1,7 +1,7 @@ require_relative "helper" -module Mom - class TestReturnJump < MomInstructionTest +module SlotMachine + class TestReturnJump < SlotMachineInstructionTest def instruction ReturnJump.new("source",Label.new("ok" , "return")) end diff --git a/test/mom/instruction/test_return_sequence.rb b/test/slot_machine/instruction/test_return_sequence.rb similarity index 91% rename from test/mom/instruction/test_return_sequence.rb rename to test/slot_machine/instruction/test_return_sequence.rb index 0209a954..c19cb712 100644 --- a/test/mom/instruction/test_return_sequence.rb +++ b/test/slot_machine/instruction/test_return_sequence.rb @@ -1,7 +1,7 @@ require_relative "helper" -module Mom - class TestReturnSequence < MomInstructionTest +module SlotMachine + class TestReturnSequence < SlotMachineInstructionTest def instruction ReturnSequence.new("source") end diff --git a/test/mom/instruction/test_simple_call.rb b/test/slot_machine/instruction/test_simple_call.rb similarity index 91% rename from test/mom/instruction/test_simple_call.rb rename to test/slot_machine/instruction/test_simple_call.rb index 83c98d2c..bbada983 100644 --- a/test/mom/instruction/test_simple_call.rb +++ b/test/slot_machine/instruction/test_simple_call.rb @@ -1,7 +1,7 @@ require_relative "helper" -module Mom - class TestSimpleCall < MomInstructionTest +module SlotMachine + class TestSimpleCall < SlotMachineInstructionTest include Parfait::MethodHelper def instruction diff --git a/test/mom/instruction/test_slot_definition.rb b/test/slot_machine/instruction/test_slot_definition.rb similarity index 96% rename from test/mom/instruction/test_slot_definition.rb rename to test/slot_machine/instruction/test_slot_definition.rb index 7a94dfa3..986087c9 100644 --- a/test/mom/instruction/test_slot_definition.rb +++ b/test/slot_machine/instruction/test_slot_definition.rb @@ -1,6 +1,6 @@ require_relative "helper" -module Mom +module SlotMachine class TestSlotDefinitionBasics < MiniTest::Test def slot(slot = :caller) diff --git a/test/mom/instruction/test_slot_definition1.rb b/test/slot_machine/instruction/test_slot_definition1.rb similarity index 98% rename from test/mom/instruction/test_slot_definition1.rb rename to test/slot_machine/instruction/test_slot_definition1.rb index ef4f1449..6c38435f 100644 --- a/test/mom/instruction/test_slot_definition1.rb +++ b/test/slot_machine/instruction/test_slot_definition1.rb @@ -1,6 +1,6 @@ require_relative "helper" -module Mom +module SlotMachine class TestSlotDefinitionConstant < MiniTest::Test def setup diff --git a/test/mom/instruction/test_slot_definition2.rb b/test/slot_machine/instruction/test_slot_definition2.rb similarity index 97% rename from test/mom/instruction/test_slot_definition2.rb rename to test/slot_machine/instruction/test_slot_definition2.rb index 49f72eaa..a0ed1232 100644 --- a/test/mom/instruction/test_slot_definition2.rb +++ b/test/slot_machine/instruction/test_slot_definition2.rb @@ -1,6 +1,6 @@ require_relative "helper" -module Mom +module SlotMachine class TestSlotDefinitionKnown1 < MiniTest::Test def setup Parfait.boot!(Parfait.default_test_options) diff --git a/test/mom/instruction/test_slot_definition3.rb b/test/slot_machine/instruction/test_slot_definition3.rb similarity index 97% rename from test/mom/instruction/test_slot_definition3.rb rename to test/slot_machine/instruction/test_slot_definition3.rb index 521ff3da..48f5d352 100644 --- a/test/mom/instruction/test_slot_definition3.rb +++ b/test/slot_machine/instruction/test_slot_definition3.rb @@ -1,6 +1,6 @@ require_relative "helper" -module Mom +module SlotMachine class TestSlotDefinitionKnown2 < MiniTest::Test def setup Parfait.boot!(Parfait.default_test_options) diff --git a/test/mom/instruction/test_slot_load.rb b/test/slot_machine/instruction/test_slot_load.rb similarity index 97% rename from test/mom/instruction/test_slot_load.rb rename to test/slot_machine/instruction/test_slot_load.rb index 600daabd..c536ac44 100644 --- a/test/mom/instruction/test_slot_load.rb +++ b/test/slot_machine/instruction/test_slot_load.rb @@ -1,6 +1,6 @@ require_relative "helper" -module Mom +module SlotMachine class TestSlotLoadBasics < MiniTest::Test def test_ins_ok diff --git a/test/mom/instruction/test_slot_load1.rb b/test/slot_machine/instruction/test_slot_load1.rb similarity index 98% rename from test/mom/instruction/test_slot_load1.rb rename to test/slot_machine/instruction/test_slot_load1.rb index a3ce9139..641cc468 100644 --- a/test/mom/instruction/test_slot_load1.rb +++ b/test/slot_machine/instruction/test_slot_load1.rb @@ -1,6 +1,6 @@ require_relative "helper" -module Mom +module SlotMachine class TestSlotLoad1 < MiniTest::Test def setup diff --git a/test/mom/instruction/test_slot_load2.rb b/test/slot_machine/instruction/test_slot_load2.rb similarity index 98% rename from test/mom/instruction/test_slot_load2.rb rename to test/slot_machine/instruction/test_slot_load2.rb index 4a4aa637..1491ee20 100644 --- a/test/mom/instruction/test_slot_load2.rb +++ b/test/slot_machine/instruction/test_slot_load2.rb @@ -1,6 +1,6 @@ require_relative "helper" -module Mom +module SlotMachine class TestSlotLoad2 < MiniTest::Test def setup diff --git a/test/mom/instruction/test_slot_load3.rb b/test/slot_machine/instruction/test_slot_load3.rb similarity index 98% rename from test/mom/instruction/test_slot_load3.rb rename to test/slot_machine/instruction/test_slot_load3.rb index 20dd997d..e497748b 100644 --- a/test/mom/instruction/test_slot_load3.rb +++ b/test/slot_machine/instruction/test_slot_load3.rb @@ -1,6 +1,6 @@ require_relative "helper" -module Mom +module SlotMachine class TestSlotLoad3 < MiniTest::Test include Parfait::MethodHelper diff --git a/test/mom/instruction/test_truth_check.rb b/test/slot_machine/instruction/test_truth_check.rb similarity index 94% rename from test/mom/instruction/test_truth_check.rb rename to test/slot_machine/instruction/test_truth_check.rb index 12b2c785..34fc9b62 100644 --- a/test/mom/instruction/test_truth_check.rb +++ b/test/slot_machine/instruction/test_truth_check.rb @@ -1,7 +1,7 @@ require_relative "helper" -module Mom - class TestSameCheck < MomInstructionTest +module SlotMachine + class TestSameCheck < SlotMachineInstructionTest def instruction target = SlotDefinition.new(:message , :caller) TruthCheck.new(target , Label.new("ok" , "target")) diff --git a/test/mom/macro/README.md b/test/slot_machine/macro/README.md similarity index 100% rename from test/mom/macro/README.md rename to test/slot_machine/macro/README.md diff --git a/test/mom/macro/helper.rb b/test/slot_machine/macro/helper.rb similarity index 100% rename from test/mom/macro/helper.rb rename to test/slot_machine/macro/helper.rb diff --git a/test/mom/macro/test_comparison.rb b/test/slot_machine/macro/test_comparison.rb similarity index 81% rename from test/mom/macro/test_comparison.rb rename to test/slot_machine/macro/test_comparison.rb index 7921c4f8..f590a3d2 100644 --- a/test/mom/macro/test_comparison.rb +++ b/test/slot_machine/macro/test_comparison.rb @@ -1,14 +1,14 @@ require_relative "helper" -module Mom +module SlotMachine module Builtin class TestIntComp1Risc < BootTest def setup @method = get_compiler("Integer",:lt) end - def test_mom_length + def test_slot_length assert_equal :< , @method.callable.name - assert_equal 7 , @method.mom_instructions.length + assert_equal 7 , @method.slot_instructions.length end def test_compile assert_equal Risc::MethodCompiler , @method.to_risc.class @@ -21,9 +21,9 @@ module Mom def setup @method = get_compiler("Integer",:gt) end - def test_mom_length + def test_slot_length assert_equal :> , @method.callable.name - assert_equal 7 , @method.mom_instructions.length + assert_equal 7 , @method.slot_instructions.length end def test_compile assert_equal Risc::MethodCompiler , @method.to_risc.class diff --git a/test/mom/macro/test_div10.rb b/test/slot_machine/macro/test_div10.rb similarity index 80% rename from test/mom/macro/test_div10.rb rename to test/slot_machine/macro/test_div10.rb index db89b158..ed2785d6 100644 --- a/test/mom/macro/test_div10.rb +++ b/test/slot_machine/macro/test_div10.rb @@ -1,14 +1,14 @@ require_relative "helper" -module Mom +module SlotMachine module Builtin class TestIntDiv10Risc < BootTest def setup @method = get_compiler("Integer",:div10) end - def test_mom_length + def test_slot_length assert_equal :div10 , @method.callable.name - assert_equal 7 , @method.mom_instructions.length + assert_equal 7 , @method.slot_instructions.length end def test_compile assert_equal Risc::MethodCompiler , @method.to_risc.class diff --git a/test/mom/macro/test_div4.rb b/test/slot_machine/macro/test_div4.rb similarity index 82% rename from test/mom/macro/test_div4.rb rename to test/slot_machine/macro/test_div4.rb index a0689269..39d7c00d 100644 --- a/test/mom/macro/test_div4.rb +++ b/test/slot_machine/macro/test_div4.rb @@ -1,14 +1,14 @@ require_relative "helper" -module Mom +module SlotMachine module Builtin class TestIntDiv4Risc < BootTest def setup @method = get_compiler("Integer",:div4) end - def test_mom_length + def test_slot_length assert_equal :div4 , @method.callable.name - assert_equal 7 , @method.mom_instructions.length + assert_equal 7 , @method.slot_instructions.length end def test_compile assert_equal Risc::MethodCompiler , @method.to_risc.class diff --git a/test/mom/macro/test_exit.rb b/test/slot_machine/macro/test_exit.rb similarity index 81% rename from test/mom/macro/test_exit.rb rename to test/slot_machine/macro/test_exit.rb index 67097953..61049eff 100644 --- a/test/mom/macro/test_exit.rb +++ b/test/slot_machine/macro/test_exit.rb @@ -1,15 +1,15 @@ require_relative "helper" -module Mom +module SlotMachine module Builtin class TestObjectExitRisc < BootTest def setup super @method = get_compiler("Object",:exit) end - def test_mom_length + def test_slot_length assert_equal :exit , @method.callable.name - assert_equal 7 , @method.mom_instructions.length + assert_equal 7 , @method.slot_instructions.length end def test_compile assert_equal Risc::MethodCompiler , @method.to_risc.class diff --git a/test/mom/macro/test_get_internal_byte.rb b/test/slot_machine/macro/test_get_internal_byte.rb similarity index 81% rename from test/mom/macro/test_get_internal_byte.rb rename to test/slot_machine/macro/test_get_internal_byte.rb index 587a7eb4..fe80106b 100644 --- a/test/mom/macro/test_get_internal_byte.rb +++ b/test/slot_machine/macro/test_get_internal_byte.rb @@ -1,15 +1,15 @@ require_relative "helper" -module Mom +module SlotMachine module Builtin class TestWordGetRisc < BootTest def setup super @method = get_compiler("Word",:get) end - def test_mom_length + def test_slot_length assert_equal :get_internal_byte , @method.callable.name - assert_equal 7 , @method.mom_instructions.length + assert_equal 7 , @method.slot_instructions.length end def test_compile assert_equal Risc::MethodCompiler , @method.to_risc.class diff --git a/test/mom/macro/test_get_internal_word.rb b/test/slot_machine/macro/test_get_internal_word.rb similarity index 81% rename from test/mom/macro/test_get_internal_word.rb rename to test/slot_machine/macro/test_get_internal_word.rb index 371f8f22..27063b4a 100644 --- a/test/mom/macro/test_get_internal_word.rb +++ b/test/slot_machine/macro/test_get_internal_word.rb @@ -1,15 +1,15 @@ require_relative "helper" -module Mom +module SlotMachine module Builtin class TestWordGetRisc < BootTest def setup super @method = get_compiler("Object",:get) end - def test_mom_length + def test_slot_length assert_equal :get_internal_word , @method.callable.name - assert_equal 7 , @method.mom_instructions.length + assert_equal 7 , @method.slot_instructions.length end def test_compile assert_equal Risc::MethodCompiler , @method.to_risc.class diff --git a/test/mom/macro/test_init.rb b/test/slot_machine/macro/test_init.rb similarity index 67% rename from test/mom/macro/test_init.rb rename to test/slot_machine/macro/test_init.rb index 9a6a7043..5489538e 100644 --- a/test/mom/macro/test_init.rb +++ b/test/slot_machine/macro/test_init.rb @@ -1,16 +1,16 @@ require_relative "helper" -module Mom +module SlotMachine module Builtin class TestObjectInitRisc < BootTest def setup compiler = RubyX::RubyXCompiler.new(RubyX.default_test_options) - coll = compiler.ruby_to_mom( get_preload("Space.main") ) - @method = MomCollection.create_init_compiler + coll = compiler.ruby_to_slot( get_preload("Space.main") ) + @method = SlotCollection.create_init_compiler end - def test_mom_length + def test_slot_length assert_equal :__init__ , @method.callable.name - assert_equal 2 , @method.mom_instructions.length + assert_equal 2 , @method.slot_instructions.length end def test_compile assert_equal Risc::MethodCompiler , @method.to_risc.class diff --git a/test/mom/macro/test_method_missing.rb b/test/slot_machine/macro/test_method_missing.rb similarity index 81% rename from test/mom/macro/test_method_missing.rb rename to test/slot_machine/macro/test_method_missing.rb index c2d5e2b4..a252bd19 100644 --- a/test/mom/macro/test_method_missing.rb +++ b/test/slot_machine/macro/test_method_missing.rb @@ -1,14 +1,14 @@ require_relative "helper" -module Mom +module SlotMachine module Builtin class TestObjectMissingRisc < BootTest def setup @method = get_compiler("Object",:missing) end - def test_mom_length + def test_slot_length assert_equal :method_missing , @method.callable.name - assert_equal 7 , @method.mom_instructions.length + assert_equal 7 , @method.slot_instructions.length end def test_compile assert_equal Risc::MethodCompiler , @method.to_risc.class diff --git a/test/mom/macro/test_operator.rb b/test/slot_machine/macro/test_operator.rb similarity index 80% rename from test/mom/macro/test_operator.rb rename to test/slot_machine/macro/test_operator.rb index 0ac1532a..1602f1ce 100644 --- a/test/mom/macro/test_operator.rb +++ b/test/slot_machine/macro/test_operator.rb @@ -1,14 +1,14 @@ require_relative "helper" -module Mom +module SlotMachine module Builtin class TestIntOpPl < BootTest def setup @method = get_compiler("Integer",:and) end - def test_mom_length + def test_slot_length assert_equal :& , @method.callable.name - assert_equal 7 , @method.mom_instructions.length + assert_equal 7 , @method.slot_instructions.length end def test_compile assert_equal Risc::MethodCompiler , @method.to_risc.class @@ -21,9 +21,9 @@ module Mom def setup @method = get_compiler("Integer",:or) end - def test_mom_length + def test_slot_length assert_equal :| , @method.callable.name - assert_equal 7 , @method.mom_instructions.length + assert_equal 7 , @method.slot_instructions.length end def test_compile assert_equal Risc::MethodCompiler , @method.to_risc.class diff --git a/test/mom/macro/test_putstring.rb b/test/slot_machine/macro/test_putstring.rb similarity index 80% rename from test/mom/macro/test_putstring.rb rename to test/slot_machine/macro/test_putstring.rb index 4b133a03..9fee8c08 100644 --- a/test/mom/macro/test_putstring.rb +++ b/test/slot_machine/macro/test_putstring.rb @@ -1,14 +1,14 @@ require_relative "helper" -module Mom +module SlotMachine module Builtin class TestWordPutRisc < BootTest def setup @method = get_compiler("Word",:put) end - def test_mom_length + def test_slot_length assert_equal :putstring , @method.callable.name - assert_equal 7 , @method.mom_instructions.length + assert_equal 7 , @method.slot_instructions.length end def test_compile assert_equal Risc::MethodCompiler , @method.to_risc.class diff --git a/test/mom/macro/test_set_internal_byte.rb b/test/slot_machine/macro/test_set_internal_byte.rb similarity index 81% rename from test/mom/macro/test_set_internal_byte.rb rename to test/slot_machine/macro/test_set_internal_byte.rb index df052fd6..a1a53ff1 100644 --- a/test/mom/macro/test_set_internal_byte.rb +++ b/test/slot_machine/macro/test_set_internal_byte.rb @@ -1,15 +1,15 @@ require_relative "helper" -module Mom +module SlotMachine module Builtin class TestWordSetRisc < BootTest def setup super @method = get_compiler("Word",:set) end - def test_mom_length + def test_slot_length assert_equal :set_internal_byte , @method.callable.name - assert_equal 7 , @method.mom_instructions.length + assert_equal 7 , @method.slot_instructions.length end def test_compile assert_equal Risc::MethodCompiler , @method.to_risc.class diff --git a/test/mom/macro/test_set_internal_word.rb b/test/slot_machine/macro/test_set_internal_word.rb similarity index 81% rename from test/mom/macro/test_set_internal_word.rb rename to test/slot_machine/macro/test_set_internal_word.rb index 1da3d6d3..a809b2a0 100644 --- a/test/mom/macro/test_set_internal_word.rb +++ b/test/slot_machine/macro/test_set_internal_word.rb @@ -1,14 +1,14 @@ require_relative "helper" -module Mom +module SlotMachine module Builtin class TestWordSetRisc < BootTest def setup @method = get_compiler("Word",:set) end - def test_mom_length + def test_slot_length assert_equal :set_internal_byte , @method.callable.name - assert_equal 7 , @method.mom_instructions.length + assert_equal 7 , @method.slot_instructions.length end def test_compile assert_equal Risc::MethodCompiler , @method.to_risc.class diff --git a/test/mom/test_block_compiler.rb b/test/slot_machine/test_block_compiler.rb similarity index 98% rename from test/mom/test_block_compiler.rb rename to test/slot_machine/test_block_compiler.rb index d008e025..3bfd68a0 100644 --- a/test/mom/test_block_compiler.rb +++ b/test/slot_machine/test_block_compiler.rb @@ -1,6 +1,6 @@ require_relative "helper" -module Mom +module SlotMachine class TestBlockCompiler1 < MiniTest::Test include ScopeHelper diff --git a/test/mom/test_block_statement.rb b/test/slot_machine/test_block_statement.rb similarity index 71% rename from test/mom/test_block_statement.rb rename to test/slot_machine/test_block_statement.rb index cd9659ef..765bda78 100644 --- a/test/mom/test_block_statement.rb +++ b/test/slot_machine/test_block_statement.rb @@ -3,13 +3,13 @@ require_relative "helper" module Vool class TestBlockArg < MiniTest::Test - include MomCompile + include SlotMachineCompile def setup - @ret = compile_mom( as_main("self.main {|elem| elem = 5 } ")) + @ret = compile_slot( as_main("self.main {|elem| elem = 5 } ")) end def test_is_compiler - assert_equal Mom::MomCollection , @ret.class + assert_equal SlotMachine::SlotCollection , @ret.class end def test_has_method assert_equal Parfait::CallableMethod , @ret.method_compilers.get_method.class @@ -19,9 +19,9 @@ module Vool end end class TestBlockLocal < MiniTest::Test - include MomCompile + include SlotMachineCompile def setup - @ret = compile_mom( as_main("self.main {|elem| local = 5 } ")) + @ret = compile_slot( as_main("self.main {|elem| local = 5 } ")) @block = @ret.method_compilers.get_method.blocks end def test_block_arg_type @@ -38,16 +38,16 @@ module Vool end end class TestBlockMethodArg < MiniTest::Test - include MomCompile + include SlotMachineCompile def setup end def test_method_arg_compiles - ret = compile_mom( as_main("self.main {|elem| arg = 5 } ")) + ret = compile_slot( as_main("self.main {|elem| arg = 5 } ")) assert ret end def test_method_local_compiles - ret = compile_mom( as_main("local = 5 ; self.main {|elem| local = 10 } ")) + ret = compile_slot( as_main("local = 5 ; self.main {|elem| local = 10 } ")) assert ret end end diff --git a/test/mom/test_callable_compiler.rb b/test/slot_machine/test_callable_compiler.rb similarity index 88% rename from test/mom/test_callable_compiler.rb rename to test/slot_machine/test_callable_compiler.rb index 3bce6d37..68bdfd40 100644 --- a/test/mom/test_callable_compiler.rb +++ b/test/slot_machine/test_callable_compiler.rb @@ -1,5 +1,5 @@ require_relative "helper" -module Mom +module SlotMachine class FakeCallableCompiler < CallableCompiler def source_name "luke" @@ -20,8 +20,8 @@ module Mom assert_equal Label , @compiler.current.class assert_equal @compiler.source_name , @compiler.current.name end - def test_mom - assert @compiler.mom_instructions + def test_slot + assert @compiler.slot_instructions end def test_const assert_equal Array , @compiler.constants.class diff --git a/test/slot_machine/test_class_statement.rb b/test/slot_machine/test_class_statement.rb new file mode 100644 index 00000000..29f9293d --- /dev/null +++ b/test/slot_machine/test_class_statement.rb @@ -0,0 +1,24 @@ + +require_relative "helper" + +module Vool + class TestClassStatementSlotMachine < MiniTest::Test + include SlotMachineCompile + + def setup + @ret = compile_slot( as_main("return 1")) + end + + def test_return_class + assert_equal SlotMachine::SlotCollection , @ret.class + end + def test_has_compilers + assert_equal SlotMachine::MethodCompiler , @ret.method_compilers.class + end + + def test_constant + assert @ret.method_compilers.add_constant( Parfait::Integer.new(5) ) + end + + end +end diff --git a/test/mom/test_instruction.rb b/test/slot_machine/test_instruction.rb similarity index 95% rename from test/mom/test_instruction.rb rename to test/slot_machine/test_instruction.rb index e5dc8c67..a4eb5bb9 100644 --- a/test/mom/test_instruction.rb +++ b/test/slot_machine/test_instruction.rb @@ -1,7 +1,7 @@ require_relative "helper" -module Mom +module SlotMachine class TestInstruction < MiniTest::Test def test_instantiates diff --git a/test/mom/test_method_compiler.rb b/test/slot_machine/test_method_compiler.rb similarity index 92% rename from test/mom/test_method_compiler.rb rename to test/slot_machine/test_method_compiler.rb index 264a99a7..6eb6d456 100644 --- a/test/mom/test_method_compiler.rb +++ b/test/slot_machine/test_method_compiler.rb @@ -1,6 +1,6 @@ require_relative "helper" -module Mom +module SlotMachine class TestMethodCompiler < MiniTest::Test include ScopeHelper @@ -10,7 +10,7 @@ module Mom def in_test_vool(str) vool = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_vool(in_Test(str)) vool.to_parfait - vool.to_mom(nil) + vool.to_slot(nil) vool end def create_method(body = "@ivar = 5;return") @@ -62,10 +62,10 @@ module Mom assert_equal 2 , method.frame_type.variable_index(:a) end def constant_setup(input) - mom = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(in_Test(input)) - assert_equal Mom::MomCollection , mom.class + mom = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_slot(in_Test(input)) + assert_equal SlotMachine::SlotCollection , mom.class compiler = mom.method_compilers - assert_equal Mom::MethodCompiler , compiler.class + assert_equal SlotMachine::MethodCompiler , compiler.class compiler end def test_return_label diff --git a/test/mom/test_mom_collection.rb b/test/slot_machine/test_mom_collection.rb similarity index 59% rename from test/mom/test_mom_collection.rb rename to test/slot_machine/test_mom_collection.rb index 292b8099..20442ef5 100644 --- a/test/mom/test_mom_collection.rb +++ b/test/slot_machine/test_mom_collection.rb @@ -1,34 +1,34 @@ require_relative "helper" -module Mom - class TestMomCollection < MiniTest::Test - include MomCompile +module SlotMachine + class TestSlotCollection < MiniTest::Test + include SlotMachineCompile def setup - @comp = compile_mom( "class Test ; def main(); return 'Hi'; end; end;") + @comp = compile_slot( "class Test ; def main(); return 'Hi'; end; end;") end def test_class - assert_equal MomCollection , @comp.class + assert_equal SlotCollection , @comp.class end def test_compilers assert_equal 3 , @comp.compilers.num_compilers end def test_init_compilers - assert_equal MomCollection , @comp.init_compilers.class + assert_equal SlotCollection , @comp.init_compilers.class end def test_compilers_bare - assert_equal 2 , MomCollection.new.compilers.num_compilers + assert_equal 2 , SlotCollection.new.compilers.num_compilers end def test_append_class - assert_equal MomCollection, (@comp.append @comp).class + assert_equal SlotCollection, (@comp.append @comp).class end end - class TestMomCollectionToRisc < MiniTest::Test - include MomCompile + class TestSlotCollectionToRisc < MiniTest::Test + include SlotMachineCompile def setup - @comp = compile_mom( "class Space ; def main(); return 'Hi'; end; end;") + @comp = compile_slot( "class Space ; def main(); return 'Hi'; end; end;") @collection = @comp.to_risc() end def compiler diff --git a/test/support/compiling.rb b/test/support/compiling.rb index 44b51753..fbc46c8d 100644 --- a/test/support/compiling.rb +++ b/test/support/compiling.rb @@ -30,24 +30,24 @@ module ScopeHelper end module VoolCompile include ScopeHelper - include Mom + include SlotMachine include Preloader def compile_main( input , preload = nil) input = get_preload(preload) + as_main( input ) - collection = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(input) - assert collection.is_a?(Mom::MomCollection) , collection.class.name + collection = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_slot(input) + assert collection.is_a?(SlotMachine::SlotCollection) , collection.class.name compiler = collection.compilers.find_compiler_name(:main) - assert_equal Mom::MethodCompiler , compiler.class + assert_equal SlotMachine::MethodCompiler , compiler.class compiler end def compile_main_block( block_input , method_input = "main_local = 5" , preload = nil) source = get_preload(preload) + as_main("#{method_input} ; self.main{|val| #{block_input}}") - mom_col = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom( source ) + mom_col = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_slot( source ) compiler = mom_col.method_compilers.find_compiler_name(:main) block = mom_col.method_compilers.find_compiler_name(:main_block) assert block - block.mom_instructions.next + block.slot_instructions.next end def check_array( should , is ) index = 0 @@ -75,11 +75,11 @@ module VoolCompile end -module MomCompile +module SlotMachineCompile include ScopeHelper - def compile_mom(input) - RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(input) + def compile_slot(input) + RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_slot(input) end end diff --git a/test/vool/class_send/test_class_def.rb b/test/vool/class_send/test_class_def.rb index fbb1486f..43a6ce4b 100644 --- a/test/vool/class_send/test_class_def.rb +++ b/test/vool/class_send/test_class_def.rb @@ -2,7 +2,7 @@ require_relative "helper" module Vool class TestClassDef < MiniTest::Test - include Mom + include SlotMachine include VoolCompile def class_main @@ -20,8 +20,8 @@ module Vool def setup source = "class Integer err assert err.message.include?("Blocks") , err.message end @@ -22,7 +22,7 @@ module VoolBlocks def test_assign_compiles vool = Ruby::RubyCompiler.compile( as_class_method("val = 0") ).to_vool vool.to_parfait - assert_equal Mom::MomCollection , vool.to_mom(nil).class + assert_equal SlotMachine::SlotCollection , vool.to_slot(nil).class end end end diff --git a/test/vool/lambdas/test_if_condition.rb b/test/vool/lambdas/test_if_condition.rb index 7bff4f74..ca129b29 100644 --- a/test/vool/lambdas/test_if_condition.rb +++ b/test/vool/lambdas/test_if_condition.rb @@ -1,7 +1,7 @@ require_relative "helper" module VoolBlocks - class TestConditionIfMom < MiniTest::Test + class TestConditionIfSlotMachine < MiniTest::Test include VoolCompile def setup diff --git a/test/vool/lambdas/test_while_simple.rb b/test/vool/lambdas/test_while_simple.rb index 195b2c36..8129aef7 100644 --- a/test/vool/lambdas/test_while_simple.rb +++ b/test/vool/lambdas/test_while_simple.rb @@ -1,7 +1,7 @@ require_relative "helper" module VoolBlocks - class TestSimpleWhileMom < MiniTest::Test + class TestSimpleWhileSlotMachine < MiniTest::Test include VoolCompile def setup diff --git a/test/vool/send/helper.rb b/test/vool/send/helper.rb index b8602650..58ae8f77 100644 --- a/test/vool/send/helper.rb +++ b/test/vool/send/helper.rb @@ -4,11 +4,11 @@ module Vool # relies on @ins and receiver_type method module SimpleSendHarness include VoolCompile - include Mom + include SlotMachine def setup @compiler = compile_main( send_method , "Integer.div4;Object.get") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_first_not_array diff --git a/test/vool/send/test_not_found.rb b/test/vool/send/test_not_found.rb index 0274f77b..c8a69bde 100644 --- a/test/vool/send/test_not_found.rb +++ b/test/vool/send/test_not_found.rb @@ -1,12 +1,12 @@ require_relative "../helper" module Vool - class TestSendCachedSimpleMom < MiniTest::Test + class TestSendCachedSimpleSlotMachine < MiniTest::Test include VoolCompile def setup @compiler = compile_main( "5.div8") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_check_type assert_equal NotSameCheck , @ins.class , @ins diff --git a/test/vool/send/test_send_args_send.rb b/test/vool/send/test_send_args_send.rb index 8cae7e88..da203c70 100644 --- a/test/vool/send/test_send_args_send.rb +++ b/test/vool/send/test_send_args_send.rb @@ -1,12 +1,12 @@ require_relative "helper" module Vool - class TestSendArgsSendMom < MiniTest::Test + class TestSendArgsSendSlotMachine < MiniTest::Test include VoolCompile def setup @compiler = compile_main( "a = main(4.div4);return a" , "Integer.div4") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_array diff --git a/test/vool/send/test_send_cached_simple.rb b/test/vool/send/test_send_cached_simple.rb index 722b862c..48090215 100644 --- a/test/vool/send/test_send_cached_simple.rb +++ b/test/vool/send/test_send_cached_simple.rb @@ -1,12 +1,12 @@ require_relative "../helper" module Vool - class TestSendCachedSimpleMom < MiniTest::Test + class TestSendCachedSimpleSlotMachine < MiniTest::Test include VoolCompile def setup @compiler = compile_main( "a = 5; a.div4;return ") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_check_type assert_equal NotSameCheck , @ins.next(1).class , @ins diff --git a/test/vool/send/test_send_self.rb b/test/vool/send/test_send_self.rb index 5c5e8451..1bf1aa5f 100644 --- a/test/vool/send/test_send_self.rb +++ b/test/vool/send/test_send_self.rb @@ -1,7 +1,7 @@ require_relative "helper" module Vool - class TestSendSelfMom < MiniTest::Test + class TestSendSelfSlotMachine < MiniTest::Test include SimpleSendHarness def send_method @@ -23,7 +23,7 @@ module Vool assert_equal :get_internal_word, @ins.next(2).method.name end end - class TestSendSelfImplicitMom < TestSendSelfMom + class TestSendSelfImplicitSlotMachine < TestSendSelfSlotMachine def send_method "get_internal_word(0)" diff --git a/test/vool/send/test_send_simple.rb b/test/vool/send/test_send_simple.rb index 7ff5d0e9..9d39f3f6 100644 --- a/test/vool/send/test_send_simple.rb +++ b/test/vool/send/test_send_simple.rb @@ -1,14 +1,14 @@ require_relative "helper" module Vool - class TestSendSimpleMom < MiniTest::Test + class TestSendSimpleSlotMachine < MiniTest::Test include SimpleSendHarness def send_method "5.div4;return" end def receiver - [Mom::IntegerConstant , 5] + [SlotMachine::IntegerConstant , 5] end def test_call_has_right_method assert_equal :div4, @ins.next(2).method.name diff --git a/test/vool/send/test_send_simple_args.rb b/test/vool/send/test_send_simple_args.rb index 427b27b0..e26bd9b9 100644 --- a/test/vool/send/test_send_simple_args.rb +++ b/test/vool/send/test_send_simple_args.rb @@ -1,7 +1,7 @@ require_relative "helper" module Vool - class TestSendSimpleArgsMom < MiniTest::Test + class TestSendSimpleArgsSlotMachine < MiniTest::Test include SimpleSendHarness def send_method @@ -9,14 +9,14 @@ module Vool end def receiver - [Mom::IntegerConstant , 5] + [SlotMachine::IntegerConstant , 5] end def test_args_two_move assert_equal :next_message, @ins.next(1).arguments[1].left.slots[0] assert_equal :arg2, @ins.next(1).arguments[1].left.slots[1] end def test_args_two_str - assert_equal Mom::IntegerConstant, @ins.next(1).arguments[1].right.known_object.class + assert_equal SlotMachine::IntegerConstant, @ins.next(1).arguments[1].right.known_object.class assert_equal 2, @ins.next(1).arguments[1].right.known_object.value end def test_array diff --git a/test/vool/test_assignment.rb b/test/vool/test_assignment.rb index fc837803..e4a32b18 100644 --- a/test/vool/test_assignment.rb +++ b/test/vool/test_assignment.rb @@ -1,16 +1,16 @@ require_relative "helper" module Vool - class TestAssignMom < MiniTest::Test + class TestAssignSlotMachine < MiniTest::Test include VoolCompile def setup @compiler = compile_main( "local = 5;return") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_class_compiles - assert_equal Mom::SlotLoad , @ins.class , @ins + assert_equal SlotMachine::SlotLoad , @ins.class , @ins end def test_slot_is_set assert @ins.left @@ -25,19 +25,19 @@ module Vool assert @ins.right end def test_slot_assigns_int - assert_equal Mom::IntegerConstant , @ins.right.known_object.class + assert_equal SlotMachine::IntegerConstant , @ins.right.known_object.class end end #otherwise as above, but assigning instance, so should get a SlotLoad - class TestAssignMomInstanceToLocal < MiniTest::Test + class TestAssignSlotMachineInstanceToLocal < MiniTest::Test include VoolCompile def setup @compiler = compile_main( "@a = 5 ; local = @a;return") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_class_compiles - assert_equal Mom::SlotLoad , @ins.next.class , @ins + assert_equal SlotMachine::SlotLoad , @ins.next.class , @ins end end @@ -47,11 +47,11 @@ module Vool def setup @compiler = compile_main( "arg = 5;return") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_class_compiles - assert_equal Mom::SlotLoad , @ins.class , @ins + assert_equal SlotMachine::SlotLoad , @ins.class , @ins end def test_slot_is_set assert @ins.left @@ -64,22 +64,22 @@ module Vool end end - class TestAssignMomToInstance < MiniTest::Test + class TestAssignSlotMachineToInstance < MiniTest::Test include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) end def test_assigns_const @compiler = compile_main( "@a = 5;return") - @ins = @compiler.mom_instructions.next - assert_equal Mom::SlotLoad , @ins.class , @ins - assert_equal Mom::IntegerConstant , @ins.right.known_object.class , @ins + @ins = @compiler.slot_instructions.next + assert_equal SlotMachine::SlotLoad , @ins.class , @ins + assert_equal SlotMachine::IntegerConstant , @ins.right.known_object.class , @ins end def test_assigns_move @compiler = compile_main( "@a = arg;return") - @ins = @compiler.mom_instructions.next - assert_equal Mom::SlotLoad , @ins.class , @ins - assert_equal Mom::SlotDefinition , @ins.right.class , @ins + @ins = @compiler.slot_instructions.next + assert_equal SlotMachine::SlotLoad , @ins.class , @ins + assert_equal SlotMachine::SlotDefinition , @ins.right.class , @ins end end diff --git a/test/vool/test_builtin.rb b/test/vool/test_builtin.rb index f0b29520..3e6d219d 100644 --- a/test/vool/test_builtin.rb +++ b/test/vool/test_builtin.rb @@ -11,10 +11,10 @@ module Vool def as_ruby @ruby = Ruby::RubyCompiler.compile(@code) end - def as_mom + def as_slot vool = as_ruby.to_vool vool.to_parfait - vool.to_mom(nil) + vool.to_slot(nil) end def test_boot assert_equal String , @code.class @@ -36,17 +36,17 @@ module Vool assert_equal Vool::ReturnStatement , vool.body.first.body.class assert_equal Vool::MacroExpression , vool.body.first.body.return_value.class end - def test_mom_basic - mom = as_mom - assert_equal Mom::MomCollection , mom.class - assert_equal Mom::MethodCompiler , mom.method_compilers.class + def test_slot_basic + mom = as_slot + assert_equal SlotMachine::SlotCollection , mom.class + assert_equal SlotMachine::MethodCompiler , mom.method_compilers.class end - def test_mom_instructions - mom_compiler = as_mom.method_compilers - assert_equal Mom::Label , mom_compiler.mom_instructions.class - assert_equal Mom::IntOperator , mom_compiler.mom_instructions.next.class - assert_equal Mom::SlotLoad , mom_compiler.mom_instructions.next(2).class - assert_equal Mom::ReturnJump , mom_compiler.mom_instructions.next(3).class + def test_slot_instructions + mom_compiler = as_slot.method_compilers + assert_equal SlotMachine::Label , mom_compiler.slot_instructions.class + assert_equal SlotMachine::IntOperator , mom_compiler.slot_instructions.next.class + assert_equal SlotMachine::SlotLoad , mom_compiler.slot_instructions.next(2).class + assert_equal SlotMachine::ReturnJump , mom_compiler.slot_instructions.next(3).class end end end diff --git a/test/vool/test_class_expression2.rb b/test/vool/test_class_expression2.rb index a65e3f6d..7e31ebdd 100644 --- a/test/vool/test_class_expression2.rb +++ b/test/vool/test_class_expression2.rb @@ -7,7 +7,7 @@ module Vool def setup @compiler = compile_main( "if(@a) ; @a = 5 ; else; @a = 6 ; end; return") - @ins = @compiler.mom_instructions + @ins = @compiler.slot_instructions end def test_label diff --git a/test/vool/test_class_method_expression.rb b/test/vool/test_class_method_expression.rb index 7e08951a..a33f5e74 100644 --- a/test/vool/test_class_method_expression.rb +++ b/test/vool/test_class_method_expression.rb @@ -33,15 +33,15 @@ module Vool m = clazz.single_class.instance_type.get_method(:meth) assert m , "no type method :meth" end - def as_mom + def as_slot @clazz.to_parfait - @clazz.to_mom(nil) + @clazz.to_slot(nil) end - def test_mom - assert_equal :meth , as_mom.method_compilers.callable.name + def test_slot + assert_equal :meth , as_slot.method_compilers.callable.name end - def test_mom_frame - callable = as_mom.method_compilers.callable + def test_slot_frame + callable = as_slot.method_compilers.callable assert callable.frame_type.names.last.to_s.start_with?("tmp_") , "no tmp_ variable #{callable.frame_type.names}" end end diff --git a/test/vool/test_if_no_else.rb b/test/vool/test_if_no_else.rb index 5d857b55..25013c99 100644 --- a/test/vool/test_if_no_else.rb +++ b/test/vool/test_if_no_else.rb @@ -7,7 +7,7 @@ module Vool def setup @compiler = compile_main( "if(@a) ; @a = 5 ; end;return") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_condition_compiles_to_check diff --git a/test/vool/test_if_no_if.rb b/test/vool/test_if_no_if.rb index 7bb1067f..780d4515 100644 --- a/test/vool/test_if_no_if.rb +++ b/test/vool/test_if_no_if.rb @@ -7,7 +7,7 @@ module Vool def setup @compiler = compile_main( "unless(@a) ; @a = 5 ; end;return") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_condition_compiles_to_check diff --git a/test/vool/test_if_simple.rb b/test/vool/test_if_simple.rb index 883f6ff0..c7a4de7d 100644 --- a/test/vool/test_if_simple.rb +++ b/test/vool/test_if_simple.rb @@ -2,12 +2,12 @@ require_relative "helper" module Vool - class TestSimpleIfMom < MiniTest::Test + class TestSimpleIfSlotMachine < MiniTest::Test include VoolCompile def setup @compiler = compile_main( "if(@a) ; @a = 5 ; else; @a = 6 ; end;return") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_condition_compiles_to_check diff --git a/test/vool/test_if_statement.rb b/test/vool/test_if_statement.rb index 4698d099..4252c974 100644 --- a/test/vool/test_if_statement.rb +++ b/test/vool/test_if_statement.rb @@ -1,12 +1,12 @@ require_relative "helper" module Vool - class TestConditionIfMom < MiniTest::Test + class TestConditionIfSlotMachine < MiniTest::Test include VoolCompile def setup @compiler = compile_main( "if(5.div4) ; @a = 6 ; else; @a = 5 ; end;return" , "Integer.div4") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_condition diff --git a/test/vool/test_ivar.rb b/test/vool/test_ivar.rb index b1d276ec..3ae3fa99 100644 --- a/test/vool/test_ivar.rb +++ b/test/vool/test_ivar.rb @@ -1,12 +1,12 @@ require_relative "helper" module Vool - class TestIvarMom < MiniTest::Test + class TestIvarSlotMachine < MiniTest::Test include VoolCompile def setup @compiler = compile_main( "@a = 5") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_array @@ -26,7 +26,7 @@ module Vool end def test_slot_assigns_something assert @ins.right - assert_equal Mom::IntegerConstant , @ins.right.known_object.class + assert_equal SlotMachine::IntegerConstant , @ins.right.known_object.class end end end diff --git a/test/vool/test_local_assignment.rb b/test/vool/test_local_assignment.rb index a35dccd4..20914713 100644 --- a/test/vool/test_local_assignment.rb +++ b/test/vool/test_local_assignment.rb @@ -1,19 +1,19 @@ require_relative "helper" module Vool - class TestLocalMom < MiniTest::Test + class TestLocalSlotMachine < MiniTest::Test include VoolCompile def setup @compiler = compile_main( "a = 5") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_compiles_not_array assert Array != @ins.class , @ins end def test_class_compiles - assert_equal Mom::SlotLoad , @ins.class , @ins + assert_equal SlotMachine::SlotLoad , @ins.class , @ins end def test_slot_is_set assert @ins.left @@ -28,21 +28,21 @@ module Vool assert @ins.right end def test_slot_assigns_int - assert_equal Mom::IntegerConstant , @ins.right.known_object.class + assert_equal SlotMachine::IntegerConstant , @ins.right.known_object.class end end - class TestArgMom < MiniTest::Test + class TestArgSlotMachine < MiniTest::Test include VoolCompile def setup Parfait.boot!(Parfait.default_test_options) @compiler = compile_main( "arg = 5") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_class_compiles - assert_equal Mom::SlotLoad , @ins.class , @ins + assert_equal SlotMachine::SlotLoad , @ins.class , @ins end def test_slot_is_set assert @ins.left @@ -57,7 +57,7 @@ module Vool assert @ins.right end def test_slot_assigns_int - assert_equal Mom::IntegerConstant , @ins.right.known_object.class + assert_equal SlotMachine::IntegerConstant , @ins.right.known_object.class end end diff --git a/test/vool/test_macro_expression.rb b/test/vool/test_macro_expression.rb index 789c6fe8..815e76fe 100644 --- a/test/vool/test_macro_expression.rb +++ b/test/vool/test_macro_expression.rb @@ -1,5 +1,5 @@ require_relative "helper" -module Mom +module SlotMachine class PlusEquals < Instruction attr_reader :a , :b def initialize(source , arg , b) @@ -14,16 +14,16 @@ module Mom end module Vool - class TestMacroMom < MiniTest::Test + class TestMacroSlotMachine < MiniTest::Test include VoolCompile def setup @compiler = compile_main( "X.plus_equals(arg,1)") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_class_compiles - assert_equal Mom::PlusEquals , @ins.class , @ins + assert_equal SlotMachine::PlusEquals , @ins.class , @ins end def test_arg1 assert_equal Vool::LocalVariable , @ins.a.class diff --git a/test/vool/test_return.rb b/test/vool/test_return.rb index 00bcb1ef..3c00e2ec 100644 --- a/test/vool/test_return.rb +++ b/test/vool/test_return.rb @@ -1,12 +1,12 @@ require_relative "helper" module Vool - class TestReturnMom < MiniTest::Test + class TestReturnSlotMachine < MiniTest::Test include VoolCompile def setup @compiler = compile_main( "return 5") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_class_compiles @@ -28,7 +28,7 @@ module Vool assert @ins.right end def test_slot_assigns_int - assert_equal Mom::IntegerConstant , @ins.right.known_object.class + assert_equal SlotMachine::IntegerConstant , @ins.right.known_object.class end def test_second_is_return assert_equal ReturnJump, @ins.next(1).class @@ -37,12 +37,12 @@ module Vool check_array [SlotLoad, ReturnJump, Label, ReturnSequence, Label], @ins end end - class TestReturnSendMom < MiniTest::Test + class TestReturnSendSlotMachine < MiniTest::Test include VoolCompile def setup @compiler = compile_main( "return 5.div4" , "Integer.div4" ) - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_return_is_last diff --git a/test/vool/test_while_statement.rb b/test/vool/test_while_statement.rb index 9ba421cd..c5c929cf 100644 --- a/test/vool/test_while_statement.rb +++ b/test/vool/test_while_statement.rb @@ -1,12 +1,12 @@ require_relative "helper" module Vool - class TestSimpleWhileMom < MiniTest::Test + class TestSimpleWhileSlotMachine < MiniTest::Test include VoolCompile def setup @compiler = compile_main( "while(@a) ; @a = 5 ; end;return") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_compiles_as_while diff --git a/test/vool/test_while_statement1.rb b/test/vool/test_while_statement1.rb index 12b0544f..29c96ac9 100644 --- a/test/vool/test_while_statement1.rb +++ b/test/vool/test_while_statement1.rb @@ -2,12 +2,12 @@ require_relative "helper" module Vool - class TestWhileConditionMom < MiniTest::Test + class TestWhileConditionSlotMachine < MiniTest::Test include VoolCompile def setup @compiler = compile_main( "while(5.div4) ; 5.div4 ; end;return" , "Integer.div4") - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_condition_compiles_to_check diff --git a/test/vool/test_yield_statement.rb b/test/vool/test_yield_statement.rb index c4c2df38..12420dcd 100644 --- a/test/vool/test_yield_statement.rb +++ b/test/vool/test_yield_statement.rb @@ -1,12 +1,12 @@ require_relative "helper" module Vool - class TestYieldArgsSendMom < MiniTest::Test + class TestYieldArgsSendSlotMachine < MiniTest::Test include VoolCompile def setup @compiler = compile_main( "return yield(1)" ) - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_array @@ -65,12 +65,12 @@ module Vool assert_equal ReturnJump, @ins.next(6).class end end - class TestYieldNoArgsSendMom < MiniTest::Test + class TestYieldNoArgsSendSlotMachine < MiniTest::Test include VoolCompile def setup @compiler = compile_main( "return yield(some.extra.calls)" ) - @ins = @compiler.mom_instructions.next + @ins = @compiler.slot_instructions.next end def test_check_label assert_equal NotSameCheck, @ins.class