separate_compiler: Refactored class compilation
authorLouis-Vincent Boudreault <lv.boudreault95@gmail.com>
Wed, 4 Dec 2019 21:59:00 +0000 (16:59 -0500)
committerLouis-Vincent Boudreault <lv.boudreault95@gmail.com>
Wed, 29 Jan 2020 00:19:18 +0000 (19:19 -0500)
commitd6d98741ce1f410ea61f98de4d69d0b838c7d786
tree9cb0310efb0707ee10a95916d0ec5de3bf11202e
parentca8f5eca8a69bd85077ad626293bcf01e9a11295
separate_compiler: Refactored class compilation

Before this update, the method `compile_class_to_c` handled every part
of the class compilation process even special case (universal class).
By doing so, we can't refined this method efficiently without
reimplementing the entire method. This is a pain, since each time we
need to add universal class we have to modify the original code instead
of refining the compiler.

The method `compile_class_to_c` has been divided in three main parts:

1. the class's vft compilation (same for every type of class)
2. the compilation of universal class specifics (change alot through
time). This part must managed every part of a universal type, except its
vft compilation which already handled by the 1st step.
3. the compilation of the default `NEW` allocator (apply only for
non-universal type).

Moreover, the state of a class compilation is stored in a new class
called `ClassCompilationInfo`, which has different flag to specify if
the class is dead/alive or need_corpse. This choice was made to prevent
dataclump in each method involved with the class compilation.

With this new way of managing class compilation, we can add new
universal class via refinement instead of code rewriting.

Signed-off-by: Louis-Vincent Boudreault <lv.boudreault95@gmail.com>
src/compiler/separate_compiler.nit
src/compiler/separate_erasure_compiler.nit