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)
commit8a9dd1d5aaacff9cd8655cdc0c6a1f597a398f4f
treefdf7fad5867d8be371ed142bc195e4bd29d663d1
parent1c9f9e5422bcf5c118451d5a71cea9c67b4fffa0
parentd5bb215f7fbcbe4ec7f524ca2f015ee98e8b2bdb
Merge: frontend: run code generation phases only in engines (and nitmetrics)

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