2015-11-23 18:51:52 +01:00
|
|
|
---
|
2016-12-19 16:43:59 +01:00
|
|
|
layout: typed
|
2016-12-19 17:56:35 +01:00
|
|
|
title: Parfait, a minimal runtime
|
2015-11-23 18:51:52 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
|
2016-02-26 04:10:56 +01:00
|
|
|
### Type and Class
|
2015-11-23 18:51:52 +01:00
|
|
|
|
2016-12-19 17:56:35 +01:00
|
|
|
Each object has a type that describes the instance variables and basic types of the object.
|
|
|
|
Types also reference the class they implement.
|
|
|
|
Type objects are unique and constant, may not be changed over their lifetime.
|
|
|
|
When a field is added to a class, a new Type is created. For a given class and combination
|
|
|
|
of instance names and basic types, only one instance every exists describing that type (a bit
|
|
|
|
similar to symbols)
|
2015-11-23 18:51:52 +01:00
|
|
|
|
2016-12-19 17:56:35 +01:00
|
|
|
A Class describes a set of objects that respond to the same methods (the methods source is stored
|
|
|
|
in the RubyMethod class).
|
2016-02-26 04:10:56 +01:00
|
|
|
A Type describes a set of objects that have the same instance variables.
|
2015-11-23 18:51:52 +01:00
|
|
|
|
|
|
|
### Method, Message and Frame
|
|
|
|
|
2016-12-19 17:56:35 +01:00
|
|
|
The TypedMethod class describes a callable method. It carries a name, argument and local variable
|
|
|
|
type and several descriptions of the code.
|
|
|
|
The typed ast is kept for debugging, the register model instruction stream for optimisation
|
|
|
|
and further processing and finally the cpu specific binary
|
2015-11-23 18:51:52 +01:00
|
|
|
represents the executable code.
|
|
|
|
|
2016-12-19 17:56:35 +01:00
|
|
|
When TypedMethods are invoked, A message object (instance of Message class) is populated.
|
|
|
|
Message objects are created at compile time and form a linked list.
|
|
|
|
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.
|
2015-11-23 18:51:52 +01:00
|
|
|
|
|
|
|
### Space and support
|
|
|
|
|
2016-12-19 17:56:35 +01:00
|
|
|
The single instance of Space hold a list of all Types and all Classes, which in turn hold
|
|
|
|
the methods.
|
|
|
|
Also the space holds messages and will hold memory management objects like pages.
|
2015-11-23 18:51:52 +01:00
|
|
|
|
|
|
|
Words represent short immutable text and other word processing (buffers, text) is still tbd.
|
2016-12-19 17:56:35 +01:00
|
|
|
|
|
|
|
Lists (aka Array) are number indexed, starting at one, and dictionaries (aka Hash) are mappings from words to objects.
|