Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
distinguish FINAL phase from CHECK phase
CHECK phase is always after the parsing of the current compilation unit. FINAL phase is after the main application's CHECK phase, when the application as a whole commits to optimization policies. In other words, a FINAL block defined in a module is not run when the module is compiled (that would be a CHECK instead), but rather when the application using the module is completing its compilation and linking.
- Loading branch information
Showing
6 changed files
with
31 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This really needs to be reconsidered and talk about compilation units, not whole programs. Otherwise we can not really do any kind of inlining in the compiler, using what a Perl 6 compiler knows about the things in its lexical scope (which is more than most runtimes ever can). We would have to keep all code in AST form to retain that ability and follow this bit of spec, so precompilation would really have to mean mean serializing an AST, nothing more. Goodbye to mapping bytecode into memory, etc. We should be making different mistakes to Perl 5.
And saying we should defer all inling until runtime and let VM level stuff do it is also a fail. Sure, if we only want Perl 6 to perform well on some magical custom VM we may manage it, but that is also 5-think.
For things like method inlining, I agree it can't happen until application close time. But for lexical routines, we should allow inlining per compilation unit, after its CHECK time. All of our operators are lexical multi-dispatches; our ability to have them inlned at the point of code gen - which we expect to be able to do per compilation unit - is not only important for speed, but also for generating efficient code. We should not be leaving an addition of two native integers being cheap hanging on a VM untangling Perl 6 multi-dispatch (yeah, right) and realizing it can inline what that calls. It just won't happen, in general.