Fork me on GitHub

Parfait, a minimal runtime

RubyX uses the these following classes at compile time to build the base of an object oriented system.

In RubyX every object really is an object and data is hidden to the language level.

Objects have a Type and constant size. See memory for more on memory layout and management.

Types

If we would be talking about a language, this would be like Javascript, or previously Self. Basically rubyx's types would be (immutable) prototypes in a prototype based language.

It may be easiest to understand types by how they are used. When rubyx parses a class, it creates a Vool::Class, which in turn creates a Parfait::Class. This class carries the Vool methods, basically the language code for the methods.
At this point a type, representing the object layout as known at the time, is created. Vool::Methods are compiled to binary (Parfait::Method) according to the type information and stored in the type.
If the class changes at run-time, ie variables are added or removed, a new type object is created (with the updated layout) and the same ruby code is compiled to new Parfait::Methods.

Method, Message and Frame

The TypedMethod class describes a callable method. It carries a name, argument and local variable type and several descriptions of the code:

When TypedMethods are invoked, A message object (instance of Message class) is populated. The data in the Message holds the receiver, return addresses, arguments and a frame. Frames are also created at compile time and just reused at runtime. Calling describes more detail about the calling convention, while method resolution described how the methods are found, mainly at run-time.

Memory

The single instance of Space holds a list of all Types and all Classes, which in turn hold the methods. The space also holds messages and will hold memory management objects like pages.

Pages are currently not implemented but will be used to realise the aproach described in the page about memory management.

Util

There are off course several utility classes necessary just to implement the type and class system.