o42a-0.1.3 Release Notes

Normalization

A new stage added to compiler. It is called normalization and is responsible for generated code redundancy elimination.

Code redundancy is inherent to “everythin is an object” approach, so the normalization is essential to o42a.

Normalization techniques will evolve over time. In this release the object inlining technique implemented. It is able to convert an object construction expression into executable code without object data structure construction (and extra memory allocation). Constructed object can be inlined, when it is known, that object is only used to calculate it’s value and the object type can be predicted at compile time.

For example, the following statement:

= a + b

involves three objects: two numeric operands and their sum object. But this statement is only used to construct the sum of two numbers. Normalizer is able to determine that. It will convert the sum object construction and access to it’s value to just summing of two numbers. Operands are subjects to normalization also, so they can be inlined too. So, the inlining of compound expressions is also possible.

Normalization leads to significant decrease in size of generated executables. The test suite executable size decreased by almost 30%, while “Hello, World!” - by 50%.

Predefined Object Modifications

  • Void object is no longer exposed as a pseudo-field of the root. Access to void is always static now, even from within root or it’s descendants. Void object still can be addressed with $$void expression.
  • False object is no longer a field of root. Access to false is always static now, even from root or it’s descendants. False object still can be addressed with $$false expression.

New Compiler Options

Two new command-line options added to o42ac:

  • -analyze-uses (0/1, enabled by default) - this option controls whether compiler should track the uses of objects and other program model entities. With this disabled, the executable will contain all objects from root, imported modules and program module, and will take the most conservative (and slowest) code generation decisions. It’s meaningless to disable this option for something but compiler debugging.
  • -normalize (0/1, enabled by default) - this option controls the normalization. Again, it’s meaningless to disable this option for something but compiler debugging.