Merge: frontend: run code generation phases only in engines (and nitmetrics)
authorJean Privat <jean@pryen.org>
Tue, 11 Jul 2017 13:01:32 +0000 (09:01 -0400)
committerJean Privat <jean@pryen.org>
Tue, 11 Jul 2017 13:01:32 +0000 (09:01 -0400)
Some frontend phases generate Nit code (usually method implementations) that is ignored by some tools, including `nitpick`, `nitserial` and `nitrestful`. When running `nitpick` on WBTW, a serialization heavy project, the code generation part of `serialization_phase` uselessly took ~10% of the work time. This extra time adds up quickly as `nitpick` is invoked each time we save a file in vim.

This PR extracts some code generation phases from the main frontend. Compilers and interpreters must import the code generation phases (`frontend::code_gen`) but most others only need the main frontend (`frontend`). Analysis tools may import the code generation phases ito analyze the generated code, or import only the main frontend phases to analyze only the user code.

In this PR, only two phases have been moved: half of `serialization_phase` which was the most costly in my use case, and `actors_generation_phase` because it was already nicely decoupled (well done @BlackMinou!). Others phases could be divided and moved to the code generation frontend if they happen to be a performance bottleneck: `i18n_phase`, `parallelization_phase` and maybe `deriving`.

Note that there is no implementation change to the serialization phase, I simply split the module in two.

Pull-Request: #2523


Trivial merge