More rename cleanp
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
module Mom
|
||||
module SlotMachine
|
||||
|
||||
# Transering the arguments from the current frame into the next frame
|
||||
#
|
||||
|
@ -1,5 +1,5 @@
|
||||
module Mom
|
||||
# just name scoping the same stuff to mom
|
||||
module SlotMachine
|
||||
# just name scoping the same stuff to slot
|
||||
# so we know we are on the way down, keeping our layers seperated
|
||||
# and we can put constant adding into the to_risc methods (instead of on vool classes)
|
||||
class Constant
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Mom
|
||||
module SlotMachine
|
||||
|
||||
# A BlockYield calls an argument block. All we need to know is the index
|
||||
# of the argument, and the rest is almost as simple as a SimpleCall
|
||||
|
@ -1,6 +1,6 @@
|
||||
module Mom
|
||||
module SlotMachine
|
||||
|
||||
# A base class for conditions in MOM
|
||||
# A base class for conditions in SlotMachine
|
||||
# Checks (if in code, compare in assm) jump or not, depending
|
||||
# The logic we choose is closer to the code logic (the asm is reversed)
|
||||
# When we write an if, the true is the next code, so the Check logic is
|
||||
@ -9,7 +9,7 @@ module Mom
|
||||
# check does not pass
|
||||
# Note: In assembler a branch on 0 does just that, it branches if the condition
|
||||
# is met. This means that the asm implementation is somewhat the reverse
|
||||
# of the Mom names. But it's easier to understand (imho)
|
||||
# of the SlotMachine names. But it's easier to understand (imho)
|
||||
class Check < Instruction
|
||||
attr_reader :false_jump
|
||||
def initialize(false_jump)
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Mom
|
||||
module SlotMachine
|
||||
|
||||
# A dynamic call calls a method at runtime. This off course implies that we don't know the
|
||||
# method at compile time and so must "find" it. Resolving, or finding the method, is a
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Mom
|
||||
module SlotMachine
|
||||
|
||||
# Branch jump to the Label given
|
||||
# Eg used at the end of while or end of if_true branch
|
||||
|
@ -1,6 +1,6 @@
|
||||
module Mom
|
||||
module SlotMachine
|
||||
|
||||
# A Label is the only legal target for a branch (in Mom, in Risc a BinaryCode is ok too)
|
||||
# A Label is the only legal target for a branch (in SlotMachine, in Risc a BinaryCode is ok too)
|
||||
#
|
||||
# In the dynamic view (runtime) where the instructions form a graph,
|
||||
# branches fan out, Labels collect. In other words a branch is the place where
|
||||
@ -8,7 +8,7 @@ module Mom
|
||||
#
|
||||
# A Label has a name which is mainly used for debugging.
|
||||
#
|
||||
# A Mom::Label converts one2one to a Risc::Label. So in a way it could not be more
|
||||
# A SlotMachine::Label converts one2one to a Risc::Label. So in a way it could not be more
|
||||
# simple.
|
||||
# Alas, since almost by definition several roads lead to this label, all those
|
||||
# several converted instructions must also point to the identical label on the
|
||||
|
@ -1,6 +1,6 @@
|
||||
module Mom
|
||||
module SlotMachine
|
||||
|
||||
# As reminder: a statically resolved call (the simplest one) becomes three Mom Instructions.
|
||||
# As reminder: a statically resolved call (the simplest one) becomes three SlotMachine Instructions.
|
||||
# Ie: MessageSetup,ArgumentTransfer,SimpleCall
|
||||
#
|
||||
# MessageSetup does Setup before a call can be made, acquiring and filling the message
|
||||
|
@ -1,12 +1,12 @@
|
||||
module Mom
|
||||
module SlotMachine
|
||||
|
||||
# Mom internal check, as the name says to see if two values are not the same
|
||||
# SlotMachine internal check, as the name says to see if two values are not the same
|
||||
# In other words, we this checks identity, bit-values, pointers
|
||||
#
|
||||
# The values that are compared are defined as SlotDefinitions, ie can be anything
|
||||
# available to the machine through frame message or self
|
||||
#
|
||||
# Acording to Mom::Check logic, we jump to the given label is the values are the same
|
||||
# Acording to SlotMachine::Check logic, we jump to the given label is the values are the same
|
||||
#
|
||||
class NotSameCheck < Check
|
||||
attr_reader :left , :right
|
||||
|
@ -1,7 +1,7 @@
|
||||
module Mom
|
||||
module SlotMachine
|
||||
|
||||
# Dynamic method resolution is at the heart of a dynamic language, and here
|
||||
# is the Mom level instruction to do it.
|
||||
# is the SlotMachine level instruction to do it.
|
||||
#
|
||||
# When the static type can not be determined a CacheEntry is used to store
|
||||
# type and method of the resolved method. The CacheEntry is shared with
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Mom
|
||||
module SlotMachine
|
||||
|
||||
# the return jump jumps to the return label
|
||||
# the method setup is such that there is exactly one return_label in a method
|
||||
|
@ -1,11 +1,11 @@
|
||||
module Mom
|
||||
module SlotMachine
|
||||
|
||||
# The ReturnSequence models the return from a method.
|
||||
#
|
||||
# This involves the jump to the return address stored in the message, and
|
||||
# the reinstantiation of the previous message.
|
||||
#
|
||||
# The machine (mom) only ever "knows" one message, the current message.
|
||||
# The (slot) machine only ever "knows" one message, the current message.
|
||||
# Messages are a double linked list, calling involves going forward,
|
||||
# returning means going back.
|
||||
#
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Mom
|
||||
module SlotMachine
|
||||
|
||||
# A SimpleCall is just that, a simple call. This could be called a function call too,
|
||||
# meaning we managed to resolve the function at compile time and all we have to do is
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Mom
|
||||
module SlotMachine
|
||||
# A SlotDefinition defines a slot. A bit like a variable name but for objects.
|
||||
#
|
||||
# PS: for the interested: A "developement" of Smalltalk was the
|
||||
|
@ -1,9 +1,9 @@
|
||||
module Mom
|
||||
module SlotMachine
|
||||
|
||||
# SlotLoad is for moving data into a slot, either from another slot, or constant
|
||||
# A Slot is basically an instance variable, but it must be of known type
|
||||
#
|
||||
# The value loaded (the right hand side) can be a constant (Mom::Constant) or come from
|
||||
# The value loaded (the right hand side) can be a constant (SlotMachine::Constant) or come from
|
||||
# another Slot (SlotDefinition)
|
||||
#
|
||||
# The Slot on the left hand side is always a SlotDefinition.
|
||||
@ -21,9 +21,9 @@ module Mom
|
||||
# @left: A SlotDefinition, or an array that can be passed to the constructor of the
|
||||
# SlotDefinition (see there)
|
||||
#
|
||||
# @right: A SlotDefinition with slots or a Mom::Constant
|
||||
# original_source: optinally another mom instruction that will be passed down to created
|
||||
# risc instructions. (Because SlotLoad is often used internally in mom)
|
||||
# @right: A SlotDefinition with slots or a SlotMachine::Constant
|
||||
# original_source: optinally another slot_machine instruction that will be passed down
|
||||
# to created risc instructions. (Because SlotLoad is often used internally)
|
||||
class SlotLoad < Instruction
|
||||
|
||||
attr_reader :left , :right , :original_source
|
||||
@ -33,7 +33,7 @@ module Mom
|
||||
@left , @right = left , right
|
||||
@left = SlotDefinition.new(@left.shift , @left) if @left.is_a? Array
|
||||
@right = SlotDefinition.new(@right.shift , @right) if @right.is_a? Array
|
||||
raise "right not Mom, #{@right.to_s}" unless @right.is_a?( SlotDefinition )
|
||||
raise "right not SlotMachine, #{@right.to_s}" unless @right.is_a?( SlotDefinition )
|
||||
@original_source = original_source || self
|
||||
end
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Mom
|
||||
module SlotMachine
|
||||
|
||||
# The funny thing about the ruby truth is that it is anything but false or nil
|
||||
#
|
||||
|
Reference in New Issue
Block a user