value is not derived from code (was too much generalisation/confusing)
This commit is contained in:
parent
067cde8d43
commit
937f566b27
@ -5,7 +5,7 @@ module Vm
|
|||||||
# and usually end up embedded in the instructions. ie your basic foo + 4 will encode
|
# and usually end up embedded in the instructions. ie your basic foo + 4 will encode
|
||||||
# the 4 in the instruction opcode. The 4 is not accessible anywhere else.
|
# the 4 in the instruction opcode. The 4 is not accessible anywhere else.
|
||||||
# When it should be usable in other forms, the constant must become a Value first
|
# When it should be usable in other forms, the constant must become a Value first
|
||||||
class Constant < Value
|
class Constant < Code
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -4,9 +4,8 @@ module Vm
|
|||||||
|
|
||||||
# Values represent the information as it is processed. Different subclasses for different types,
|
# Values represent the information as it is processed. Different subclasses for different types,
|
||||||
# each type with different operations.
|
# each type with different operations.
|
||||||
# The oprerations on values is what makes a machine do things.
|
# The oprerations on values is what makes a machine do things. Operations are captured as
|
||||||
# For compilation, values are moved to the machines registers and the methods (on values) map
|
# subclasses of Instruction and saved to Blocks
|
||||||
# to machine instructions
|
|
||||||
|
|
||||||
# Values are immutable! (that's why they are called values)
|
# Values are immutable! (that's why they are called values)
|
||||||
# Operations on values _always_ produce new values (conceptionally)
|
# Operations on values _always_ produce new values (conceptionally)
|
||||||
@ -19,10 +18,9 @@ module Vm
|
|||||||
# Float, Reference , Integer(s) must fit the same registers
|
# Float, Reference , Integer(s) must fit the same registers
|
||||||
|
|
||||||
# just a base class for data. not sure how this will be usefull (may just have read too much llvm)
|
# just a base class for data. not sure how this will be usefull (may just have read too much llvm)
|
||||||
class Value < Code
|
class Value
|
||||||
|
def class_for clazz
|
||||||
def type
|
CMachine.instance.class_for(clazz)
|
||||||
self.class
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user