Irreducible loop

Control-flow graph

(a) an if-then-else
(b) a while loop
(c) a natural loop with two exits, e.g. while with an if…break in the middle; non-structured but reducible
(d) an irreducible CFG: a loop with two entry points, e.g. goto into a while or for loop

Java case

public class IrreducibleLoop {
    public static void test(int loop) {


super public class IrreducibleLoop
    version 63:0
  public Method "<init>":"()V" 
    stack 1 locals 1
        invokespecial    Method java/lang/Object."<init>":"()V";
  public static Method test:"(I)V" 
    stack 2 locals 2
    L0: iconst_0;
        ifne    L2;
    L1: stack_frame_type append;
        locals_map int;
        if_icmpge    L3;
    L2: stack_frame_type same;
        goto    L1;
    L3: stack_frame_type chop1;

} // end Class IrreducibleLoop

public class Main {
    public static void main(String[] args) {
        for (int i = 0; i < 12000; i++) {


java -jar asmtools-core-7.0.b10-ea.jar jasm IrreducibleLoop.jasm
java -XX:TieredStopAtLevel=1 -Xcomp -XX:CompileCommand=compileonly,IrreducibleLoop::* Main


Hotspot stress diagnostic options

SafepointALot: Generate a lot of safepoints. This works with GuaranteedSafepointInterval.

HandshakeALot: Generate a lot of handshakes. This works with GuaranteedSafepointInterval.

DeoptimizeALot: Deoptimize at every exit from the runtime system.

ZombieALot: Create zombies (non-entrant) at exit from the runtime system.

WalkStackALot: Trace stack (no print) at every exit from the runtime system.

DeoptimizeObjectsALot: For testing purposes concurrent threads revert optimizations based on escape analysis at intervals given with DeoptimizeObjectsALotInterval=n. The thread count is given with DeoptimizeObjectsALotThreadCountSingle and DeoptimizeObjectsALotThreadCountAll.

DontYieldALot: Throw away obvious excess yield calls.

StringDeduplicationResizeALot: Force more frequent table resizing.

DeoptimizeNMethodBarriersALot: Make nmethod barriers deoptimise a lot.

OpenJDK Guide

Java Virtual Machine Guide:

HostSpot Virtual Machine Garbage Collection Tuning Guide:

OpenJDK Developers’ Guide:

HotSpot Runtime Overview:

Java Coding Style:

HotSpot Coding Style:

HotSpot VM Options:


HotSpot Glossary of Terms:

Building the JDK:

Building jtreg:

JVM Allocate Prefetch Options: