# HG changeset patch # User Doug Simon # Date 1385772498 -3600 # Node ID bae0869c829a5d853a353dca8a3749717605463a # Parent 9a971210a55a2693f37719bd7ca2fbdffc6d1a28 put CompileTheWorldTest logging behind the graal.compileTheWorldTest.log system property diff -r 9a971210a55a -r bae0869c829a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java Sat Nov 30 01:33:29 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java Sat Nov 30 01:48:18 2013 +0100 @@ -127,6 +127,22 @@ } } + public static void println() { + println(""); + } + + public static void println(String format, Object... args) { + println(String.format(format, args)); + } + + public static final boolean LOG = Boolean.getBoolean("graal.compileTheWorldTest.log"); + + public static void println(String s) { + if (LOG) { + TTY.println(s); + } + } + /** * Compile all methods in all classes in the Zip/Jar files passed. * @@ -141,13 +157,13 @@ // For now we only compile all methods in all classes in zip/jar files. if (!entry.endsWith(".zip") && !entry.endsWith(".jar")) { - TTY.println("CompileTheWorld : Skipped classes in " + entry); - TTY.println(); + println("CompileTheWorld : Skipped classes in " + entry); + println(); continue; } - TTY.println("CompileTheWorld : Compiling all classes in " + entry); - TTY.println(); + println("CompileTheWorld : Compiling all classes in " + entry); + println(); URL url = new URL("jar", "", "file:" + entry + "!/"); ClassLoader loader = new URLClassLoader(new URL[]{url}); @@ -182,13 +198,13 @@ } } catch (Throwable t) { // If something went wrong during pre-loading we just ignore it. - TTY.println("Preloading failed for (%d) %s", classFileCounter, className); + println("Preloading failed for (%d) %s", classFileCounter, className); } // Are we compiling this class? HotSpotMetaAccessProvider metaAccess = runtime.getHostProviders().getMetaAccess(); if (classFileCounter >= startAt) { - TTY.println("CompileTheWorld (%d) : %s", classFileCounter, className); + println("CompileTheWorld (%d) : %s", classFileCounter, className); // Enqueue each constructor/method in the class for compilation. for (Constructor constructor : javaClass.getDeclaredConstructors()) { @@ -205,14 +221,14 @@ } } } catch (Throwable t) { - TTY.println("CompileTheWorld (%d) : Skipping %s", classFileCounter, className); + println("CompileTheWorld (%d) : Skipping %s", classFileCounter, className); } } jarFile.close(); } - TTY.println(); - TTY.println("CompileTheWorld : Done (%d classes, %d methods, %d ms)", classFileCounter, compiledMethodsCounter, compileTime); + println(); + println("CompileTheWorld : Done (%d classes, %d methods, %d ms)", classFileCounter, compiledMethodsCounter, compileTime); } /** @@ -227,7 +243,7 @@ method.reprofile(); // makes the method also not-entrant } catch (Throwable t) { // Catch everything and print a message - TTY.println("CompileTheWorld (%d) : Error compiling method: %s", classFileCounter, MetaUtil.format("%H.%n(%p):%r", method)); + println("CompileTheWorld (%d) : Error compiling method: %s", classFileCounter, MetaUtil.format("%H.%n(%p):%r", method)); t.printStackTrace(TTY.cachedOut); } }