test/hotspot/jtreg/compiler/runtime/TestFloatsOnStackDeopt.java
changeset 50212 c4800cdd45c7
parent 50172 9925e9fd56ad
equal deleted inserted replaced
50211:5afedc9e4662 50212:c4800cdd45c7
    37     private static final int ARRLEN = 97;
    37     private static final int ARRLEN = 97;
    38     private static final int ITERS1 = 100;
    38     private static final int ITERS1 = 100;
    39     private static final int ITERS2 = 40000;
    39     private static final int ITERS2 = 40000;
    40     private static final float VALUE = 15.f;
    40     private static final float VALUE = 15.f;
    41     public static String dummyString = "long long string";
    41     public static String dummyString = "long long string";
       
    42     static volatile boolean pleaseStop = false;
    42 
    43 
    43     static void run_loop_with_safepoint(float[] a0, float b) {
    44     static void run_loop_with_safepoint(float[] a0, float b) {
    44         // Non-counted loop with safepoint.
    45         // Non-counted loop with safepoint.
    45         for (long l = 0; l < ITERS2; l++) {
    46         for (long l = 0; l < ITERS2; l++) {
    46             // Counted and vectorized loop.
    47             // Counted and vectorized loop.
    52 
    53 
    53     static int test() {
    54     static int test() {
    54         // thread provokes frequent GC - together with +DeoptimizeALot and safepoint it forces executed function deoptimization
    55         // thread provokes frequent GC - together with +DeoptimizeALot and safepoint it forces executed function deoptimization
    55         Thread th = new Thread() {
    56         Thread th = new Thread() {
    56             public void run() {
    57             public void run() {
    57                 while(true) {
    58                 while (!pleaseStop) {
    58                     synchronized(this) { try { wait(1); } catch (Exception ex) {} }
    59                     synchronized(this) { try { wait(1); } catch (Exception ex) {} }
    59                     dummyString += dummyString;
    60                     dummyString = new StringBuilder(dummyString).append(dummyString).toString();
    60                     if (dummyString.length() > 1024*1024) { dummyString = "long long string"; }
    61                     if (dummyString.length() > 1024*1024) { dummyString = "long long string"; }
    61                 }
    62                 }
    62             }
    63             }
    63         };
    64         };
    64         th.start();
    65         th.start();
    75                 x0[i] = 0.f; // Reset
    76                 x0[i] = 0.f; // Reset
    76             }
    77             }
    77             if (errn > 0) break;
    78             if (errn > 0) break;
    78         }
    79         }
    79 
    80 
    80         th.stop();
    81         pleaseStop = true;
       
    82         try {
       
    83             th.join();
       
    84         } catch (InterruptedException e) {
       
    85             throw new Error("InterruptedException in main thread ", e);
       
    86         }
    81         return errn;
    87         return errn;
    82     }
    88     }
    83 
    89 
    84     public static void main(String args[]) {
    90     public static void main(String args[]) {
    85         int errn = test();
    91         int errn = test();