rename also get_slot, to slot_to_reg

makes source and target clear
This commit is contained in:
Torsten Ruger
2016-12-25 18:05:39 +02:00
parent 35adf9a5e6
commit f648bf7bd5
32 changed files with 105 additions and 105 deletions

View File

@ -29,6 +29,6 @@ module Register
# move the current message to new_message
compiler.add_code Register::RegisterTransfer.new(source, Register.message_reg , Register.new_message_reg )
# and restore the message from saved value in new_message
compiler.add_code Register.get_slot(source , :new_message , :caller , :message )
compiler.add_code Register.slot_to_reg(source , :new_message , :caller , :message )
end
end

View File

@ -10,7 +10,7 @@ module Register
# If you had a c array (of int8) and index offset
# the instruction would do register = array[index]
# The arguments are in the order that makes sense for the Instruction name
# So GetSlot means the slot (array and index) moves to the register (last argument)
# So SlotToReg means the slot (array and index) moves to the register (last argument)
# def initialize source , array , index , register
# super
# end

View File

@ -1,6 +1,6 @@
module Register
# Getter is a base class for get instructions (GetSlot and GetByte , possibly more coming)
# Getter is a base class for get instructions (SlotToReg and GetByte , possibly more coming)
#
# The instruction that is modelled is loading data from an array into a register
#
@ -16,7 +16,7 @@ module Register
# If you had a c array and index offset
# the instruction would do register = array[index]
# The arguments are in the order that makes sense for the Instruction name
# So GetSlot means the slot (array and index) moves to the register (last argument)
# So SlotToReg means the slot (array and index) moves to the register (last argument)
def initialize source , array , index , register
super(source)
@array = array

View File

@ -1,7 +1,7 @@
module Register
# RegToSlot moves data into memory from a register.
# GetSlot moves data into a register from memory.
# SlotToReg moves data into a register from memory.
# Both use a base memory (a register)
# This is because that is what cpu's can do. In programming terms this would be accessing

View File

@ -3,7 +3,7 @@ module Register
# transfer the constents of one register to another.
# possibly called move in some cpus
# There are other instructions to move data from / to memory, namely GetSlot and RegToSlot
# There are other instructions to move data from / to memory, namely SlotToReg and RegToSlot
# Get/Set Slot move data around in vm objects, but transfer moves the objects (in the machine)
#

View File

@ -1,20 +1,20 @@
module Register
# GetSlot moves data into a register from memory.
# SlotToReg moves data into a register from memory.
# RegToSlot moves data into memory from a register.
# Both use a base memory (a register)
# This is because that is what cpu's can do. In programming terms this would be accessing
# an element in an array, in the case of GetSlot setting the value in the array.
# an element in an array, in the case of SlotToReg setting the value in the array.
# btw: to move data between registers, use RegisterTransfer
class GetSlot < Getter
class SlotToReg < Getter
# If you had a c array and index offset
# the instruction would do register = array[index]
# The arguments are in the order that makes sense for the Instruction name
# So GetSlot means the slot (array and index) moves to the register (last argument)
# So SlotToReg means the slot (array and index) moves to the register (last argument)
# def initialize source , array , index , register
# super
# end
@ -22,13 +22,13 @@ module Register
end
# Produce a GetSlot instruction.
# Produce a SlotToReg instruction.
# Array and to are registers or symbols that can be transformed to a register by resolve_to_register
# index resolves with resolve_index.
def self.get_slot source , array , index , to
def self.slot_to_reg source , array , index , to
index = resolve_index( array , index)
array = resolve_to_register array
to = resolve_to_register to
GetSlot.new( source , array , index , to)
SlotToReg.new( source , array , index , to)
end
end