8153515: [ctw] CompileTheWorld testlibrary should trigger compilation of <clinit> and <init>
Reviewed-by: thartmann
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java Tue Jun 28 20:08:43 2016 +0000
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java Wed Jun 29 14:32:13 2016 +0300
@@ -68,6 +68,11 @@
if (Utils.COMPILE_THE_WORLD_PRELOAD_CLASSES) {
preloadClasses(aClass.getName(), id, constantPool);
}
+ int startLevel = Utils.INITIAL_COMP_LEVEL;
+ int endLevel = Utils.TIERED_COMPILATION ? Utils.TIERED_STOP_AT_LEVEL : startLevel;
+ for (int i = startLevel; i <= endLevel; ++i) {
+ WHITE_BOX.enqueueInitializerForCompilation(aClass, i);
+ }
long methodCount = 0;
for (Executable e : aClass.getDeclaredConstructors()) {
++methodCount;
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java Tue Jun 28 20:08:43 2016 +0000
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java Wed Jun 29 14:32:13 2016 +0300
@@ -40,6 +40,7 @@
* Concrete subclasses should implement method {@link #process()}.
*/
public abstract class PathHandler {
+ private static final Unsafe UNSAFE = jdk.test.lib.Utils.getUnsafe();
private static final AtomicLong CLASS_COUNT = new AtomicLong(0L);
private static volatile boolean CLASSES_LIMIT_REACHED = false;
private static final Pattern JAR_IN_DIR_PATTERN
@@ -151,6 +152,7 @@
if (id >= Utils.COMPILE_THE_WORLD_START_AT) {
try {
Class<?> aClass = loader.loadClass(name);
+ UNSAFE.ensureClassInitialized(aClass);
CompileTheWorld.OUT.printf("[%d]\t%s%n", id, name);
Compiler.compileClass(aClass, id, executor);
} catch (ClassNotFoundException e) {