Inlining Exception Handlers
A standard phase template
The global environment; overridden by instantiation in Global.
The global environment; overridden by instantiation in Global.
List of phase names, this phase should run after
List of phase names, this phase should run after
Phase name this phase will attach itself to, not allowing any phase to come between it and the phase name declared
Phase name this phase will attach itself to, not allowing any phase to come between it and the phase name declared
SubComponent are added to a HashSet and two phases are the same if they have the same name
SubComponent are added to a HashSet and two phases are the same if they have the same name
Internal flag to tell external from internal phases
Internal flag to tell external from internal phases
Create a new phase
Create a new phase
The phase corresponding to this subcomponent in the current compiler run
The phase corresponding to this subcomponent in the current compiler run
The name of the phase
The name of the phase
New flags defined by the phase which are not valid before
New flags defined by the phase which are not valid before
New flags defined by the phase which are not valid until immediately after it
New flags defined by the phase which are not valid until immediately after it
List of phase names, this phase should run before
List of phase names, this phase should run before
(inlineExceptionHandlers: StringAdd).self
(inlineExceptionHandlers: StringFormat).self
(inlineExceptionHandlers: ArrowAssoc[InlineExceptionHandlers]).x
(Since version 2.10.0) Use leftOfArrow
instead
(inlineExceptionHandlers: Ensuring[InlineExceptionHandlers]).x
(Since version 2.10.0) Use resultOfEnsuring
instead
This optimization phase inlines the exception handlers so that further phases can optimize the code better
will inline the exception handler code to:
Q: How does the inlining work, ICode level? A: if a block contains a THROW(A) instruction AND there is a handler that takes A or a superclass of A we do:
Q: Why do we need to duplicate the handler? A: An exception might be thrown in a method that we invoke in the function and we cannot see that THROW command directly. In order to catch such exceptions, we keep the exception handler in place and duplicate it in order to inline its code.