Merge: Lazy semantize
authorJean Privat <jean@pryen.org>
Tue, 6 Jan 2015 02:02:04 +0000 (21:02 -0500)
committerJean Privat <jean@pryen.org>
Tue, 6 Jan 2015 02:02:04 +0000 (21:02 -0500)
commit59d1076d0a07fc66e956ffad5b23ea0c686cefae
tree4454bc057bc648cb1247ff224707b706b36794c3
parentb3948b6842f63d65ec67dd5b7fc9e7573854c59e
parente61a348923c611ea04f91876deaf9427b6b5f409
Merge: Lazy semantize

Prof of concept for lazy semantic analysis of the bodies of methods.
It means that the bodies of methods can be analysed only at the first request of the associated AST node.

It is disabled by default (see bellow) but can be enabled with --sloppy

It may improves the speed of some tools, especially the interpreter (and the VM).

For `nit hello_world.nit`.
before: 0m0.260s
after (lazy): 0m0.188s
explication: `standard` remains mostly unanalysed

For `nit nit.nit`
before: 0m1.824s
after: 0m1.060s
explication: `src/` and libs remain mostly unanalysed

For `nit nit.nit ../tests/base_simple3.nit`
before: 0m3.868s
after: 0m3.464s
explication: still some parts of `src/` and libs not analysed

However. there is some issues that remains

* `nitc` will crash with it because coloration is done before `super` are collected
* there is not always a gain, most tools need the full analysis of each method, thus doing the analysis in a lazy way can only degrade the performances.
* this could allow the interpreter to happily execute (or the compiler to compile) statically invalid programs. Eg. a bad identifier in a unused method will be undetected with the lazy approach.
* testing in `tests/` will be difficult because the error messages will change (see previous point)

Pull-Request: #1064
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
src/modelize/modelize_property.nit
src/phase.nit