From 9b39a3a8163d167e1483b71ecb1da70e9cbe0a88 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Wed, 25 Jun 2014 02:33:44 +0300 Subject: [PATCH] renaming, making space for extra layer --- lib/{vm => neumann}/README.markdown | 2 +- lib/{vm => neumann}/block.rb | 0 lib/{vm => neumann}/call_site.rb | 0 lib/{vm => neumann}/code.rb | 0 lib/{vm => neumann}/context.rb | 0 lib/{vm => neumann}/function.rb | 0 lib/{vm => neumann}/instruction.rb | 0 lib/{vm => neumann}/passes.rb | 0 lib/{vm => neumann}/plock.rb | 0 lib/{vm => neumann}/register_machine.rb | 0 lib/{vm => neumann}/register_reference.rb | 0 lib/{vm => neumann}/values.rb | 0 lib/{ast => old_ast}/all.rb | 0 lib/{ast => old_ast}/basic_expressions.rb | 0 lib/{ast => old_ast}/call_site_expression.rb | 0 lib/{ast => old_ast}/compound_expressions.rb | 0 lib/{ast => old_ast}/function_expression.rb | 0 lib/{ast => old_ast}/if_expression.rb | 0 lib/{ast => old_ast}/module_expression.rb | 0 lib/{ast => old_ast}/operator_expressions.rb | 0 lib/{ast => old_ast}/return_expression.rb | 0 lib/{ast => old_ast}/while_expression.rb | 0 lib/vm/{values => }/constants.rb | 0 lib/vm/{values => }/integer.rb | 0 lib/vm/{values => }/mystery.rb | 0 lib/vm/object_machine.rb | 33 ++++++++++++++++++++ lib/vm/{values => }/reference.rb | 0 lib/vm/{values => }/word.rb | 0 28 files changed, 34 insertions(+), 1 deletion(-) rename lib/{vm => neumann}/README.markdown (98%) rename lib/{vm => neumann}/block.rb (100%) rename lib/{vm => neumann}/call_site.rb (100%) rename lib/{vm => neumann}/code.rb (100%) rename lib/{vm => neumann}/context.rb (100%) rename lib/{vm => neumann}/function.rb (100%) rename lib/{vm => neumann}/instruction.rb (100%) rename lib/{vm => neumann}/passes.rb (100%) rename lib/{vm => neumann}/plock.rb (100%) rename lib/{vm => neumann}/register_machine.rb (100%) rename lib/{vm => neumann}/register_reference.rb (100%) rename lib/{vm => neumann}/values.rb (100%) rename lib/{ast => old_ast}/all.rb (100%) rename lib/{ast => old_ast}/basic_expressions.rb (100%) rename lib/{ast => old_ast}/call_site_expression.rb (100%) rename lib/{ast => old_ast}/compound_expressions.rb (100%) rename lib/{ast => old_ast}/function_expression.rb (100%) rename lib/{ast => old_ast}/if_expression.rb (100%) rename lib/{ast => old_ast}/module_expression.rb (100%) rename lib/{ast => old_ast}/operator_expressions.rb (100%) rename lib/{ast => old_ast}/return_expression.rb (100%) rename lib/{ast => old_ast}/while_expression.rb (100%) rename lib/vm/{values => }/constants.rb (100%) rename lib/vm/{values => }/integer.rb (100%) rename lib/vm/{values => }/mystery.rb (100%) create mode 100644 lib/vm/object_machine.rb rename lib/vm/{values => }/reference.rb (100%) rename lib/vm/{values => }/word.rb (100%) diff --git a/lib/vm/README.markdown b/lib/neumann/README.markdown similarity index 98% rename from lib/vm/README.markdown rename to lib/neumann/README.markdown index 3ef77453..6c7c7c08 100644 --- a/lib/vm/README.markdown +++ b/lib/neumann/README.markdown @@ -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. diff --git a/lib/vm/block.rb b/lib/neumann/block.rb similarity index 100% rename from lib/vm/block.rb rename to lib/neumann/block.rb diff --git a/lib/vm/call_site.rb b/lib/neumann/call_site.rb similarity index 100% rename from lib/vm/call_site.rb rename to lib/neumann/call_site.rb diff --git a/lib/vm/code.rb b/lib/neumann/code.rb similarity index 100% rename from lib/vm/code.rb rename to lib/neumann/code.rb diff --git a/lib/vm/context.rb b/lib/neumann/context.rb similarity index 100% rename from lib/vm/context.rb rename to lib/neumann/context.rb diff --git a/lib/vm/function.rb b/lib/neumann/function.rb similarity index 100% rename from lib/vm/function.rb rename to lib/neumann/function.rb diff --git a/lib/vm/instruction.rb b/lib/neumann/instruction.rb similarity index 100% rename from lib/vm/instruction.rb rename to lib/neumann/instruction.rb diff --git a/lib/vm/passes.rb b/lib/neumann/passes.rb similarity index 100% rename from lib/vm/passes.rb rename to lib/neumann/passes.rb diff --git a/lib/vm/plock.rb b/lib/neumann/plock.rb similarity index 100% rename from lib/vm/plock.rb rename to lib/neumann/plock.rb diff --git a/lib/vm/register_machine.rb b/lib/neumann/register_machine.rb similarity index 100% rename from lib/vm/register_machine.rb rename to lib/neumann/register_machine.rb diff --git a/lib/vm/register_reference.rb b/lib/neumann/register_reference.rb similarity index 100% rename from lib/vm/register_reference.rb rename to lib/neumann/register_reference.rb diff --git a/lib/vm/values.rb b/lib/neumann/values.rb similarity index 100% rename from lib/vm/values.rb rename to lib/neumann/values.rb diff --git a/lib/ast/all.rb b/lib/old_ast/all.rb similarity index 100% rename from lib/ast/all.rb rename to lib/old_ast/all.rb diff --git a/lib/ast/basic_expressions.rb b/lib/old_ast/basic_expressions.rb similarity index 100% rename from lib/ast/basic_expressions.rb rename to lib/old_ast/basic_expressions.rb diff --git a/lib/ast/call_site_expression.rb b/lib/old_ast/call_site_expression.rb similarity index 100% rename from lib/ast/call_site_expression.rb rename to lib/old_ast/call_site_expression.rb diff --git a/lib/ast/compound_expressions.rb b/lib/old_ast/compound_expressions.rb similarity index 100% rename from lib/ast/compound_expressions.rb rename to lib/old_ast/compound_expressions.rb diff --git a/lib/ast/function_expression.rb b/lib/old_ast/function_expression.rb similarity index 100% rename from lib/ast/function_expression.rb rename to lib/old_ast/function_expression.rb diff --git a/lib/ast/if_expression.rb b/lib/old_ast/if_expression.rb similarity index 100% rename from lib/ast/if_expression.rb rename to lib/old_ast/if_expression.rb diff --git a/lib/ast/module_expression.rb b/lib/old_ast/module_expression.rb similarity index 100% rename from lib/ast/module_expression.rb rename to lib/old_ast/module_expression.rb diff --git a/lib/ast/operator_expressions.rb b/lib/old_ast/operator_expressions.rb similarity index 100% rename from lib/ast/operator_expressions.rb rename to lib/old_ast/operator_expressions.rb diff --git a/lib/ast/return_expression.rb b/lib/old_ast/return_expression.rb similarity index 100% rename from lib/ast/return_expression.rb rename to lib/old_ast/return_expression.rb diff --git a/lib/ast/while_expression.rb b/lib/old_ast/while_expression.rb similarity index 100% rename from lib/ast/while_expression.rb rename to lib/old_ast/while_expression.rb diff --git a/lib/vm/values/constants.rb b/lib/vm/constants.rb similarity index 100% rename from lib/vm/values/constants.rb rename to lib/vm/constants.rb diff --git a/lib/vm/values/integer.rb b/lib/vm/integer.rb similarity index 100% rename from lib/vm/values/integer.rb rename to lib/vm/integer.rb diff --git a/lib/vm/values/mystery.rb b/lib/vm/mystery.rb similarity index 100% rename from lib/vm/values/mystery.rb rename to lib/vm/mystery.rb diff --git a/lib/vm/object_machine.rb b/lib/vm/object_machine.rb new file mode 100644 index 00000000..da6e68aa --- /dev/null +++ b/lib/vm/object_machine.rb @@ -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 diff --git a/lib/vm/values/reference.rb b/lib/vm/reference.rb similarity index 100% rename from lib/vm/values/reference.rb rename to lib/vm/reference.rb diff --git a/lib/vm/values/word.rb b/lib/vm/word.rb similarity index 100% rename from lib/vm/values/word.rb rename to lib/vm/word.rb