Dead code elimination for entire modules and their init procs if empty (#10032)

* fixes #9798
* Change order of write modules
* Move datInit calls ahead of initStackBottom
This commit is contained in:
cooldome 2018-12-30 10:28:12 +00:00 • committed by Andreas Rumpf
commit 82c009a2cb
6 changed files with 176 additions and 99 deletions

View file

@ -1479,12 +1479,9 @@ const
# for string literals, it allows for some optimizations.
{.push profiler: off.}
when defined(nimKnowsNimvm):
let nimvm* {.magic: "Nimvm".}: bool = false
## may be used only in "when" expression.
## It is true in Nim VM context and false otherwise
else:
const nimvm*: bool = false
let nimvm* {.magic: "Nimvm", compileTime.}: bool = false
## may be used only in "when" expression.
## It is true in Nim VM context and false otherwise
{.pop.}
proc compileOption*(option: string): bool {.