< prev index next >

test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java

Print this page




  83             executor.execute(new CompileMethodCommand(id, e));
  84         }
  85         METHOD_COUNT.addAndGet(methodCount);
  86 
  87         if (Utils.DEOPTIMIZE_ALL_CLASSES_RATE > 0
  88                 && (id % Utils.DEOPTIMIZE_ALL_CLASSES_RATE == 0)) {
  89             WHITE_BOX.deoptimizeAll();
  90         }
  91     }
  92 
  93     private static void preloadClasses(String className, long id,
  94             ConstantPool constantPool) {
  95         try {
  96             for (int i = 0, n = constantPool.getSize(); i < n; ++i) {
  97                 try {
  98                     constantPool.getClassAt(i);
  99                 } catch (IllegalArgumentException ignore) {
 100                 }
 101             }
 102         } catch (Throwable t) {
 103             CompileTheWorld.OUT.printf("[%d]\t%s\tWARNING preloading failed : %s%n",
 104                     id, className, t);
 105             t.printStackTrace(CompileTheWorld.ERR);
 106         }
 107     }
 108 
 109     private static void compileClinit(Class<?> aClass, long id) {
 110         int startLevel = Utils.INITIAL_COMP_LEVEL;
 111         int endLevel = Utils.TIERED_COMPILATION ? Utils.TIERED_STOP_AT_LEVEL : startLevel;
 112         for (int i = startLevel; i <= endLevel; ++i) {
 113             try {
 114                 WHITE_BOX.enqueueInitializerForCompilation(aClass, i);
 115             } catch (Throwable t) {
 116                 CompileTheWorld.OUT.printf("[%d]\t%s::<clinit>\tERROR at level %d : %s%n",
 117                         id, aClass.getName(), i, t);
 118                 t.printStackTrace(CompileTheWorld.ERR);
 119             }
 120         }
 121     }
 122 
 123     /**
 124      * Compilation of method.
 125      * Will compile method on all available comp levels.
 126      */
 127     private static class CompileMethodCommand implements Runnable {
 128         private final long classId;
 129         private final String className;
 130         private final Executable method;
 131 
 132         /**
 133          * @param classId   id of class
 134          * @param method    compiled for compilation
 135          */
 136         public CompileMethodCommand(long classId, Executable method) {
 137             this.classId = classId;




  83             executor.execute(new CompileMethodCommand(id, e));
  84         }
  85         METHOD_COUNT.addAndGet(methodCount);
  86 
  87         if (Utils.DEOPTIMIZE_ALL_CLASSES_RATE > 0
  88                 && (id % Utils.DEOPTIMIZE_ALL_CLASSES_RATE == 0)) {
  89             WHITE_BOX.deoptimizeAll();
  90         }
  91     }
  92 
  93     private static void preloadClasses(String className, long id,
  94             ConstantPool constantPool) {
  95         try {
  96             for (int i = 0, n = constantPool.getSize(); i < n; ++i) {
  97                 try {
  98                     constantPool.getClassAt(i);
  99                 } catch (IllegalArgumentException ignore) {
 100                 }
 101             }
 102         } catch (Throwable t) {
 103             CompileTheWorld.OUT.println(String.format("[%d]\t%s\tWARNING preloading failed : %s",
 104                     id, className, t));
 105             t.printStackTrace(CompileTheWorld.ERR);
 106         }
 107     }
 108 
 109     private static void compileClinit(Class<?> aClass, long id) {
 110         int startLevel = Utils.INITIAL_COMP_LEVEL;
 111         int endLevel = Utils.TIERED_COMPILATION ? Utils.TIERED_STOP_AT_LEVEL : startLevel;
 112         for (int i = startLevel; i <= endLevel; ++i) {
 113             try {
 114                 WHITE_BOX.enqueueInitializerForCompilation(aClass, i);
 115             } catch (Throwable t) {
 116                 CompileTheWorld.OUT.println(String.format("[%d]\t%s::<clinit>\tERROR at level %d : %s",
 117                         id, aClass.getName(), i, t));
 118                 t.printStackTrace(CompileTheWorld.ERR);
 119             }
 120         }
 121     }
 122 
 123     /**
 124      * Compilation of method.
 125      * Will compile method on all available comp levels.
 126      */
 127     private static class CompileMethodCommand implements Runnable {
 128         private final long classId;
 129         private final String className;
 130         private final Executable method;
 131 
 132         /**
 133          * @param classId   id of class
 134          * @param method    compiled for compilation
 135          */
 136         public CompileMethodCommand(long classId, Executable method) {
 137             this.classId = classId;


< prev index next >