Controlling the phases of the Graal compiler

Doug Simon doug.simon at
Tue Feb 14 09:55:41 UTC 2017

Hi David,

> On 14 Feb 2017, at 03:01, David Clarke <dawclarke at> wrote:
> Good people,
> I have found Bahram Yarahmadi’s post of 5th Jun 2016 3:34pm regarding his attempt to use the Graal compiler to generate the machine code for his test program.
> I need the ability to write a new optimisation phase and inject it into the suite of phases in the correct place.  I know what I want to do, but I don’t know how to get my code integrated into the compiler.
> Please can someone point me to the relevant place in the documentation that describes what the various compiler phases do, the order in which they must be invoked and any implicit dependencies.   Alternatively, which Java classes would you suggest as models so that I can start “code-diving”?

It might be easier if you describe what kind of optimization you are planning on adding. We can then better advise you on where in the pipeline your phase should be attached.

You can look at the following classes that build the compilation pipeline:


Also, the graph progresses through various states which are captured by these fields in StructuredGraph:

    private GuardsStage guardsStage = GuardsStage.FLOATING_GUARDS;
    private boolean isAfterFloatingReadPhase = false;
    private boolean hasValueProxies = true;


More information about the graal-dev mailing list