fixed the SetImplementation with new register instructions

This commit is contained in:
Torsten Ruger
2014-10-03 11:07:18 +03:00
parent 38a286942e
commit 1af66567fb
5 changed files with 53 additions and 6 deletions

View File

@ -0,0 +1,16 @@
module Register
# offset memory get access
# so the value to be set must be given as the first register
# the second argument holds the base address
# and the third a possible (small) offset into the "object"
#
# if for example the value is pointed to by a register, a VariableGet (load) is needed first
class GetSlot < Instruction
def initialize value , reference , index = 0
@value = value
@reference = reference
@index = index
end
attr_accessor :value , :reference , :index
end
end

View File

@ -0,0 +1,14 @@
module Register
# load a constant into a register
#
# first arguemnt is the register the constant is loaded into
# second is the actual constant
class LoadConstant < Instruction
def initialize value , constant
@value = value
@constant = constant
end
attr_accessor :value , :constant
end
end

View File

@ -0,0 +1,16 @@
module Register
# offset memory set access
# so the value must be given as the first register
# the second argument holds the base address
# and the third a possible (small) offset into the "object"
#
# if for example the value is pointed to by a register, a VariableGet (load) is needed first
class SetSlot < Instruction
def initialize value , reference , index = 0
@value = value
@reference = reference
@index = index
end
attr_accessor :value , :reference , :index
end
end