value is not derived from code (was too much generalisation/confusing)

This commit is contained in:
Torsten Ruger 2014-05-21 19:41:51 +03:00
parent 067cde8d43
commit 937f566b27
2 changed files with 6 additions and 8 deletions

View File

@ -5,7 +5,7 @@ module Vm
# 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.
# When it should be usable in other forms, the constant must become a Value first
class Constant < Value
class Constant < Code
end

View File

@ -4,9 +4,8 @@ module Vm
# Values represent the information as it is processed. Different subclasses for different types,
# each type with different operations.
# The oprerations on values is what makes a machine do things.
# For compilation, values are moved to the machines registers and the methods (on values) map
# to machine instructions
# The oprerations on values is what makes a machine do things. Operations are captured as
# subclasses of Instruction and saved to Blocks
# Values are immutable! (that's why they are called values)
# Operations on values _always_ produce new values (conceptionally)
@ -19,10 +18,9 @@ module Vm
# 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)
class Value < Code
def type
self.class
class Value
def class_for clazz
CMachine.instance.class_for(clazz)
end
end