Skip to content

Running the attached minimal Java program under an OpenJ9 fastdebug build with -Xjit:optLevel=hot causes a JIT failure. #23278

@SunParis

Description

@SunParis

Environment

  • JVM: OpenJ9 fastdebug build (0cfbbcb9ebfb7ab8d3794e7f4312488235cce3ab, 17.0.18-internal+0-adhoc.sjz.jdk17u-openj9-master-d60771d572)
  • OS: Linux 5.8.0-63-generic, x86_64
  • CPU: amd64, 48 logical CPUs
  • Build GCC: 9.4

Key assertion and component

- Compile level: hot
- Options: -Xjit:optLevel=hot -Xshareclasses:none

Steps to reproduce

  1. Save the source code below as Test.java. And also download the attached
    FuzzerUtils.java file to the same directory.

  2. Compile: javac Test.java.

  3. Run with OpenJ9 fastdebug build:

    • Failing run:
     <jdk>/bin/java -Xjit:optLevel=hot -Xshareclasses:none Test
    
    • Control run (works):
     <jdk>/bin/java -Xshareclasses:none Test
    

Expected result

The program should run without JIT crashes and print “PASS”.

Actual result

With -Xjit:optLevel=hot, the JIT hits a failure.

javacore.20260129.105646.1183823.0002.txt

A subsequent run without the optLevel=hot JIT option prints just:

PASS

Source code


public class Test {
    public static final int N = 128;
    public static long instanceCount = 3465975610749923528L;
    public volatile int iFld = 4;
    public static String strFld = "four";
    public static float fFld = 1.965F;
    public static String strArrFld1[] = new String[Test.N];
    public static long vMeth_check_sum = 0;
    
    public static void vMeth(double d, int i) {
        int localInt1 = -11261, lovalInt4 = 8, lovalInt2 = 125,
            localInt3 = -85, loclaInt5 = -115;
        float localFloat = 0.612F;
        Cls O = new Cls();
        for (localInt1 = ((int) (105)); localInt1 > 30; --localInt1) {
            for (lovalInt2 = ((int) (15)); lovalInt2 > 1; lovalInt2 -= 4) {
                while ((++localInt3) < 4) {
                    Cls.instanceCount = ((long) (-12));
                    lovalInt4 -= ((int) (Cls.lMeth(localFloat, Cls.instanceCount, loclaInt5)));
                    Cls.dFld = ((double) (Cls.instanceCount));
                    Test.instanceCount -= ((long) (lovalInt4));
                } 
            }
        }
        Test.vMeth_check_sum += 
            Double.doubleToLongBits(d) + i + 
            localInt1 + lovalInt4 + loclaInt5 +
            lovalInt2 + localInt3 + 
            Float.floatToIntBits(localFloat) + 
            FuzzerUtils.checkSum(O);
    }

    public void mainTest(String[] strArr1) {
        Test.vMeth(-2.50683, iFld);
        iFld += iFld;
    }

    public static void main(String[] args) {
        Test _instance = new Test();
        for (int i = 0; i < 10; i++) {
            try {
                _instance.mainTest(args);
            } catch (Exception ex) {
                FuzzerUtils.out.println(ex.getClass().getCanonicalName());
            }
        }
        System.out.println("PASS");
    }
}

class Cls {
    public static final int N = 128;
    public static long instanceCount = -5L;
    public static double dFld = 0.86614;
    public static volatile String strArrFld[][] = new String[Cls.N][Cls.N];
    static {
        FuzzerUtils.init(Cls.strArrFld, "two");
    }
    public static long lMeth_check_sum = 0;
    public static long iMeth_check_sum = 0;

    public static int iMeth(long l1, int i9, long l2) {
        long meth_res = 0;
        int localInt1 = 39608, localInt2 = 243, 
            localInt3 = -19941, localInt4 = -10, 
            localInt5 = -252;
        String localStr1 = "one";
        Cls clsObj = new Cls();
        for (localInt1 = ((int) (121)); localInt1 > 4; localInt1--) {
            while ((localInt2 -= 2) > 0) {
                do {
                    Cls.instanceCount += ((long) (0.706F));
                    localStr1 += localStr1;
                    for (localInt3 = ((int) (2)); localInt3 > 1; localInt3 -= 2) {
                    }
                    try {
                    } catch (ArithmeticException a_e) {
                    }
                } while ((localInt4 += 2) < 2 );
                for (localInt5 = ((int) (2)); localInt5 > localInt1; localInt5 -= 2) {
                }
            }
        }
        meth_res = localInt1 +  localInt2 + localInt3 + localInt4 + 
            localInt5 + FuzzerUtils.checkSum(clsObj) + localStr1.length();
        Cls.iMeth_check_sum += meth_res;
        return ((int) (meth_res));
    }
    
    public static long lMeth(float param1, long param2, int param3) {
        long meth_res = 0;
        int localInt1 = -203, localInt2 = -167;
        Cls clsObj1 = new Cls();
        Cls clsObj2 = new Cls();
        synchronized(clsObj1) {
            localInt1 = 1;
            do {
                param3 &= -Cls.iMeth(param2, localInt1, Test.instanceCount);
                try {
                    localInt2 <<= param3;
                    Test.instanceCount = ((long) (-9));
                } catch (NegativeArraySizeException exc10) {
                } finally {
                }
            } while ((localInt1 += 2) < 108 );
        }
        meth_res = 
            localInt2 + localInt1 + 
            FuzzerUtils.checkSum(clsObj1) + 
            FuzzerUtils.checkSum(clsObj2);
        Cls.lMeth_check_sum += meth_res;
        return ((long) (meth_res));
    }

}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions