Compiler: eliminate unreachable subroutines
Created by: stephanemagnenat
The compiler currently eliminates dead code inside conditions that are always false, but it does not eliminate subroutines that are unreachable. This is not too hard and should be implemented, as it could be done in Compiler::link()
:
- mark the life status of all subroutines as undefined,
- go through the bytecode of all events, mark called subroutines as alive,
- go through the bytecode of all recently-marked alive subroutines, mark the called ones currently undefined as alive and recurse in them,
- mark all undefined subroutines as dead and eliminate them.