Merge: separate_compiler: Refactored class compilation
authorJean Privat <jean@pryen.org>
Mon, 16 Mar 2020 18:31:54 +0000 (14:31 -0400)
committerJean Privat <jean@pryen.org>
Mon, 16 Mar 2020 18:31:54 +0000 (14:31 -0400)
commita4a01bce6c4ba9719f03fd41a977662554403dc2
tree5a03ab686f4718307e4c9599474ba59a9292f89e
parent4523ec49a917e16f7840cbe4f1aa2fcc9b6c7a00
parentd6d98741ce1f410ea61f98de4d69d0b838c7d786
Merge: separate_compiler: Refactored class compilation

## Before
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.

## After

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>

Pull-Request: #2808
Reviewed-by: Jean Privat <jean@pryen.org>