Instruction Scheduling in the C2 Compiler

Krystal Mok rednaxelafx at
Mon Jun 15 19:26:34 UTC 2015

Hi Ahmed,

Greetings. If you're looking for scheduling logic in C2, that would mostly
be in opto/gcm.cpp and opto/lcm.cpp, for Global Code Motion and Local Code
Motion, respectively.

The place that initiates code scheduling is from Compile::Code_Gen() in

2320   // Build a proper-looking CFG
2321   PhaseCFG cfg(node_arena(), root(), matcher);
2322   _cfg = &cfg;
2323   {
2324     TracePhase tp("scheduler", &timers[_t_scheduler]);
2325     bool success = cfg.do_global_code_motion(); // <- Scheduling
initiated from here
2326     if (!success) {
2327       return;
2328     }
2330     print_method(PHASE_GLOBAL_CODE_MOTION, 2);
2331     NOT_PRODUCT( verify_graph_edges(); )
2332     debug_only( cfg.verify(); )
2333   }

Follow that path and you'll be able to find all the code you need.

Best regards,

On Mon, Jun 15, 2015 at 10:56 AM, Ahmed Khawaja <ahmed.khawaja at>

> Greetings,
>            I am inquiring as to what would be a good starting point to get
> familiar with the current instruction scheduling capabilities of the C2
> compiler in hotspot. I am relatively new to working with Hotspot and have
> primarily been working with the macro-assembler and will now be looking at
> the instruction scheduling abilities. I am going through the source code
> now but I am not exactly sure where instruction scheduling is done. The
> OpenJDK wiki also seems to be somewhat empty on this and the compiler
> passes in general.
> Thanks in advance,
>    Ahmed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the hotspot-compiler-dev mailing list