< prev index next >

test/compiler/whitebox/CompilerWhiteBoxTest.java

Print this page
rev 8983 : 8222670: pathological case of JIT recompilation and code cache bloat
Summary: Prevent downgraded compilation tasks from recompiling.
Reviewed-by: thartmann, sgehwolf, phh, andrew
   1 /*
   2  * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 311         WHITE_BOX.makeMethodNotCompilable(method, compLevel, testCase.isOsr());
 312     }
 313 
 314     /**
 315      * Waits for completion of background compilation of {@linkplain #method}.
 316      */
 317     protected final void waitBackgroundCompilation() {
 318         waitBackgroundCompilation(method);
 319     }
 320 
 321     /**
 322      * Waits for completion of background compilation of the given executable.
 323      *
 324      * @param executable Executable
 325      */
 326     protected static final void waitBackgroundCompilation(Executable executable) {
 327         if (!BACKGROUND_COMPILATION) {
 328             return;
 329         }
 330         final Object obj = new Object();
 331         for (int i = 0; i < 10
 332                 && WHITE_BOX.isMethodQueuedForCompilation(executable); ++i) {
 333             synchronized (obj) {
 334                 try {
 335                     obj.wait(1000);
 336                 } catch (InterruptedException e) {
 337                     Thread.currentThread().interrupt();
 338                 }
 339             }
 340         }
 341     }
 342 
 343     /**
 344      * Prints information about {@linkplain #method}.
 345      */
 346     protected final void printInfo() {
 347         System.out.printf("%n%s:%n", method);
 348         System.out.printf("\tcompilable:\t%b%n",
 349                 WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, false));
 350         System.out.printf("\tcompiled:\t%b%n",
 351                 WHITE_BOX.isMethodCompiled(method, false));
 352         System.out.printf("\tcomp_level:\t%d%n",
 353                 WHITE_BOX.getMethodCompilationLevel(method, false));
 354         System.out.printf("\tosr_compilable:\t%b%n",
 355                 WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, true));


   1 /*
   2  * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 311         WHITE_BOX.makeMethodNotCompilable(method, compLevel, testCase.isOsr());
 312     }
 313 
 314     /**
 315      * Waits for completion of background compilation of {@linkplain #method}.
 316      */
 317     protected final void waitBackgroundCompilation() {
 318         waitBackgroundCompilation(method);
 319     }
 320 
 321     /**
 322      * Waits for completion of background compilation of the given executable.
 323      *
 324      * @param executable Executable
 325      */
 326     protected static final void waitBackgroundCompilation(Executable executable) {
 327         if (!BACKGROUND_COMPILATION) {
 328             return;
 329         }
 330         final Object obj = new Object();
 331         for (int i = 0; i < 100
 332                 && WHITE_BOX.isMethodQueuedForCompilation(executable); ++i) {
 333             synchronized (obj) {
 334                 try {
 335                     obj.wait(100);
 336                 } catch (InterruptedException e) {
 337                     Thread.currentThread().interrupt();
 338                 }
 339             }
 340         }
 341     }
 342 
 343     /**
 344      * Prints information about {@linkplain #method}.
 345      */
 346     protected final void printInfo() {
 347         System.out.printf("%n%s:%n", method);
 348         System.out.printf("\tcompilable:\t%b%n",
 349                 WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, false));
 350         System.out.printf("\tcompiled:\t%b%n",
 351                 WHITE_BOX.isMethodCompiled(method, false));
 352         System.out.printf("\tcomp_level:\t%d%n",
 353                 WHITE_BOX.getMethodCompilationLevel(method, false));
 354         System.out.printf("\tosr_compilable:\t%b%n",
 355                 WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, true));


< prev index next >