renaming, making space for extra layer

This commit is contained in:
Torsten Ruger 2014-06-25 02:33:44 +03:00
parent 2044a3e994
commit 9b39a3a816
28 changed files with 34 additions and 1 deletions

View File

@ -1,4 +1,4 @@
Virtual Machine Von Neumann Machine
=============== ===============
This is the logic that uses the generated ast to produce code, using the asm layer. This is the logic that uses the generated ast to produce code, using the asm layer.

33
lib/vm/object_machine.rb Normal file
View File

@ -0,0 +1,33 @@
module Vm
# The ObjectMachine is the object-oriented virtual machine in which ruby is implemented.
#
# It is minimal and realistic and low level
# - minimal means that if one thing can be implemented by another, it is left out. This is quite the opposite from
# ruby, which has several loops, many redundant if forms and the like.
# - realistic means it is easy to implement on a 32 bit machine (arm) and possibly 64 bit. Memory access, a stack,
# some registers of same size are the underlying hardware. (not ie byte machine)
# - low level means it's basic instructions are realively easily implemented in a register machine. ie send is not
# a an instruction but a function.
#
# A better name may be Value-based machine. Ie all "objects" are values, all passing is value based.
# The illusion of objects is created by a value called object-reference.
#
# So the memory model of the machine allows for indexed access into and "object" . A fixed number of objects exist
# (ie garbage collection is reclaming, not destroying and recreating) although there may be a way to increase that number.
#
# The ast is transformed to object-machine objects, some of which represent code, some data.
#
# The next step transforms to the register machine layer, which is what actually executes.
#
# More concretely, an object machine is a sort of oo turing machine, it has a current instruction, executes the
# instructions, fetches the next one and so on.
# Off course the instructions are not soo simple, but in oo terms quite so.
#
# The machine has a no register, but local variables, a scope at each point in time.
# Scope changes with calls and blocks, but is saved at each level. In terms of lower level implementation this means
# that the the model is such that what is a variable in ruby, never ends up being just on the cpu stack.
#
class ObjectMachine
end
end