rubyx/lib/virtual
2015-09-27 14:30:41 +03:00
..
instructions more test working 2015-09-20 16:52:26 +03:00
passes remove tmp variables 2015-09-27 14:00:24 +03:00
slots small cleans 2015-09-27 12:59:26 +03:00
block.rb minors 2015-07-30 19:18:41 +03:00
boot.rb introducing class variable and typed arguments 2015-09-27 14:30:41 +03:00
constants.rb fix putstring file descriptor 2015-07-02 09:49:52 +03:00
instruction.rb rebooting tests for small compiles 2015-07-18 15:28:57 +03:00
machine.rb move compiler to bosl and get first test working (adjusting syntax as i go) 2015-09-19 16:28:41 +03:00
message.rb unifying register comstants 2015-06-27 21:16:46 +03:00
method_source.rb introducing class variable and typed arguments 2015-09-27 14:30:41 +03:00
padding.rb word length fixes 2015-06-06 18:46:53 +02:00
parfait_adapter.rb fix that silly mistake that made the percentage plummet 2015-07-21 19:41:30 +03:00
plock.rb mem_length to word/byte length 2015-06-05 09:20:43 +03:00
positioned.rb fix that silly mistake that made the percentage plummet 2015-07-21 19:41:30 +03:00
README.md renamed info to MethodSource 2015-07-03 20:13:03 +03:00
type.rb small clean 2015-09-27 14:07:02 +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 compile the AST layer into Virtual::Objects and Parfait::Values

The main objects are Space (lots of objects), Parfait::Class , Method and MethodSource (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 MethodSource in code and necessarily machine dependant.