o42a-0.2.11 Release Notes

This release does not contain any new language features. Instead it focuses on the language runtime improvements. E.g. executables are more than two times smaller now, as compared to previous version of compiler. Also, the programs are faster now, and consume less memory.

Run Time Object Structure

Before this release an object was represented at run time as a set of structures, each of which corresponded to object ascendant. This caused a lot of problems. E.g. a simple field access required a lookup among these structures, and new object construction was a quite complicated task.

Now, every object is represented as a simple structure, which is known at compile time. Also, every object has a virtual method table (VMT), which is built at compile time and contains pointers to field construction methods (these pointers were stored in object itself previously). This made run time object representation much simpler and smaller, fields accessed by simple memory offset, and new object construction is cleaner and faster process. Also, this simplified the compiler itself, and opened a lot of new possibilities for further optimizations.

There is a cost however. To make this work, some limitations were applied to the language semantics. It is not possible to inherit absolutely any object now. It is required that compiler know the structure of inherited object. E.g. it is not possible to inherit link target or variable value. But it is always possible to inherit static object or object field. Also, it is always possible to construct an eager object out of any one. But the eager object itself can not be inherited.

Escape Analysis

Using a simple escape analysis, the compiler may decide to allocate some objects on stack instead of a heap. The life cycle of stack-allocated object is not controlled by garbage collector. This reduces the GC overhead. Also, when a simple field can be allocated on stack, it doesn’t occupy any space in its owner, thus reducing its size and simplifying its structure.

The escape analysis is primitive right now. But even in its current implementation it significantly optimizes the runtime. By improving this technique more impressive results could be achieved.