Change Mom to SlotMachine

rather large commit, but essentially a simple rename
Rationale in docs and blogs
This commit is contained in:
2019-10-03 20:55:41 +03:00
parent fd8a3e9cc5
commit c43436f35a
170 changed files with 481 additions and 480 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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