rubyx/lib/virtual
2014-08-28 22:32:53 +03:00
..
block.rb add FunctionCall instruction and the missing puts (stub) 2014-08-22 15:08:46 +03:00
boot_class.rb moved boot_class back to virtual (as things get clearer) 2014-08-28 08:24:37 +03:00
boot_space.rb renaming ripples 2014-08-28 18:53:48 +03:00
compiled_method.rb renamed method definition to compiled method 2014-08-28 08:10:33 +03:00
constants.rb move space accesor to boot_space 2014-08-24 21:32:21 +03:00
frame.rb comments and cosmetics 2014-07-24 21:56:31 +03:00
get_implementation.rb move get implementation to virtual as it should not result in register action 2014-08-28 08:43:38 +03:00
instruction.rb scaffold for instance variable get implementation 2014-08-23 10:59:35 +03:00
machine.rb move get implementation to virtual as it should not result in register action 2014-08-28 08:43:38 +03:00
message.rb pretty much redid the variable idea (now slot) 2014-08-20 17:14:52 +03:00
meta_class.rb reditribute boot dir evenly. some was parfait, some virtual, some kernel 2014-08-24 00:25:15 +03:00
object.rb moved boot_class back to virtual (as things get clearer) 2014-08-28 08:24:37 +03:00
plock.rb more renaming ripples 2014-08-22 18:00:23 +03:00
README.md fix spelling 2014-08-28 22:32:53 +03:00
send_implementation.rb reditribute boot dir evenly. some was parfait, some virtual, some kernel 2014-08-24 00:25:15 +03:00
slot.rb getting the passes back and starting on send 2014-08-21 17:46:12 +03:00
type.rb pretty much redid the variable idea (now slot) 2014-08-20 17:14:52 +03:00
value.rb pretty much redid the variable idea (now slot) 2014-08-20 17:14:52 +03:00

Virtual OO Machine

This is really an OV (object value) not object oriented machine.

Integers and References are Values. We make them look like objects, sure, but they are not. Symbols have similar properties and those are:

  • equality means identity
  • no change over lifetime

It's like with Atoms: they used to be the smallest possible physical unit. Now we have electrons, proton and neutrons. And so objects are made up of Values (not objects), integers, floats , references and possibly more.

Values have type in the same way objects have a class. We keep track of the type of a value at runtime, also in an similar way that objects have their classes at runtime.

Layers

Ast instances get created by the salama-reader gem from source. Here we add compile functions to ast classes and comile the ast layer into Virtual:: objects

The main objects are BootSpace (lots of objects), BootClass (represents a class), CompiledMethod (with Blocks and Instruction).

Virtual Instructions get further transformed into register instructions. This is done by an abstractly defined Register Machine with basic Intructions. A concrete implementation (like Arm) derives and creates derived Instructions.

The transformation is implemented as passes to make it easier to understand what is going on. Also this makes it easier to add functionality and optimisations from external (to the gem) sources.

The final transformation assigns Positions to all boot objects (Linker) and assembles them into a binary representation. The data- part is then a representation of classes in the parfait runtime. And the instrucions make up the funtions.

Accessible Objects

Object oriented systems have data hiding. So we have access to the inner state of only four objects:

  • Self
  • Message (arguments, method name, self)
  • Frame (local and tmp variables)
  • NewMessage ( to build the next message sent)

A single instructions (Set) allows movement of data between these. There are compare, branch and call intructions too.

Micro

The micro-kernel idea is well stated by: If you can leave it out, do.

As such we are aiming for integer and reference (type) support, and a minimal class system (object/class/aray/hash/string). It is possible to add types to the system in a similar way as we add classes, and also implement very machine dependent functionality which nevertheless is fully wrapped as OO.

Parfait is that part of the runtime that can be coded in ruby. It is parsed, like any other code and always included in the resulting binary. Builtin is the part of the runtime that can not be coded in ruby (but is still needed). This is coded by construction CompiledMethods in code and neccesarily machine dependant.