# HG changeset patch # User Doug Simon # Date 1433863755 -7200 # Node ID 90e3fecd4143f5b029e3c89f37ccf55fb969ad30 # Parent 3b5c9d5bfcaad72792fae212af6d5d14f6748401 renamed fields in TTY to better reflect their semantics diff -r 3b5c9d5bfcaa -r 90e3fecd4143 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Tue Jun 09 17:25:57 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Tue Jun 09 17:29:15 2015 +0200 @@ -258,7 +258,7 @@ } if (Debug.isEnabled()) { - DebugEnvironment.initialize(TTY.cachedOut); + DebugEnvironment.initialize(TTY.out); String summary = DebugValueSummary.getValue(); if (summary != null) { diff -r 3b5c9d5bfcaa -r 90e3fecd4143 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java Tue Jun 09 17:25:57 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java Tue Jun 09 17:29:15 2015 +0200 @@ -378,7 +378,7 @@ if (Options.TimedDynamicCounters.getValue() > 0) { Thread thread = new Thread() { long lastTime = System.nanoTime(); - PrintStream out = TTY.cachedOut; + PrintStream out = TTY.out; @Override public void run() { @@ -405,7 +405,7 @@ public static void shutdown(CompilerToVM compilerToVM, long compilerStartTime) { if (Options.GenericDynamicCounters.getValue()) { - dump(TTY.cachedOut, (System.nanoTime() - compilerStartTime) / 1000000000d, compilerToVM.collectCounters(), 100); + dump(TTY.out, (System.nanoTime() - compilerStartTime) / 1000000000d, compilerToVM.collectCounters(), 100); } } } diff -r 3b5c9d5bfcaa -r 90e3fecd4143 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraalDebugConfigCustomizer.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraalDebugConfigCustomizer.java Tue Jun 09 17:25:57 2015 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraalDebugConfigCustomizer.java Tue Jun 09 17:29:15 2015 +0200 @@ -37,7 +37,7 @@ config.dumpHandlers().add(new NodeDumper()); if (PrintCFG.getValue() || PrintBackendCFG.getValue()) { if (PrintBinaryGraphs.getValue() && PrintCFG.getValue()) { - TTY.cachedOut.println("Complete C1Visualizer dumping slows down PrintBinaryGraphs: use -G:-PrintCFG to disable it"); + TTY.out.println("Complete C1Visualizer dumping slows down PrintBinaryGraphs: use -G:-PrintCFG to disable it"); } config.dumpHandlers().add(new CFGPrinterObserver(PrintCFG.getValue())); } diff -r 3b5c9d5bfcaa -r 90e3fecd4143 jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/TTY.java --- a/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/TTY.java Tue Jun 09 17:25:57 2015 +0200 +++ b/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/TTY.java Tue Jun 09 17:29:15 2015 +0200 @@ -69,7 +69,7 @@ } if (suppressed) { previous = out(); - out.set(LogStream.SINK); + log.set(LogStream.SINK); } } } @@ -81,7 +81,7 @@ */ public Filter() { previous = out(); - out.set(LogStream.SINK); + log.set(LogStream.SINK); } /** @@ -91,31 +91,30 @@ public void remove() { assert thread == Thread.currentThread(); if (previous != null) { - out.set(previous); + log.set(previous); } } } - public static final PrintStream cachedOut; + /** + * The {@link PrintStream} to which all non-suppressed output from {@link TTY} is written. + */ + public static final PrintStream out; static { TTYStreamProvider p = Services.loadSingle(TTYStreamProvider.class, false); - cachedOut = p == null ? System.out : p.getStream(); + out = p == null ? System.out : p.getStream(); } - private static LogStream createLog() { - return new LogStream(cachedOut); - } - - private static final ThreadLocal out = new ThreadLocal() { + private static final ThreadLocal log = new ThreadLocal() { @Override protected LogStream initialValue() { - return createLog(); + return new LogStream(out); } }; public static boolean isSuppressed() { - return out.get() == LogStream.SINK; + return log.get() == LogStream.SINK; } /** @@ -125,7 +124,7 @@ * current thread. */ public static LogStream out() { - return out.get(); + return log.get(); } /** diff -r 3b5c9d5bfcaa -r 90e3fecd4143 jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugScope.java --- a/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugScope.java Tue Jun 09 17:25:57 2015 +0200 +++ b/jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugScope.java Tue Jun 09 17:29:15 2015 +0200 @@ -146,7 +146,7 @@ // Be pragmatic: provide a default log stream to prevent a crash if the stream is not // set while logging - this.output = TTY.cachedOut; + this.output = TTY.out; assert context != null; } @@ -358,7 +358,7 @@ // Be pragmatic: provide a default log stream to prevent a crash if the stream is not // set while logging - output = TTY.cachedOut; + output = TTY.out; } else { meterEnabled = config.isMeterEnabled(); memUseTrackingEnabled = config.isMemUseTrackingEnabled(); diff -r 3b5c9d5bfcaa -r 90e3fecd4143 jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilationTask.java --- a/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilationTask.java Tue Jun 09 17:25:57 2015 +0200 +++ b/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilationTask.java Tue Jun 09 17:29:15 2015 +0200 @@ -181,16 +181,16 @@ } catch (BailoutException bailout) { BAILOUTS.increment(); if (ExitVMOnBailout.getValue()) { - TTY.cachedOut.println(method.format("Bailout in %H.%n(%p)")); - bailout.printStackTrace(TTY.cachedOut); + TTY.out.println(method.format("Bailout in %H.%n(%p)")); + bailout.printStackTrace(TTY.out); System.exit(-1); } else if (PrintBailout.getValue()) { - TTY.cachedOut.println(method.format("Bailout in %H.%n(%p)")); - bailout.printStackTrace(TTY.cachedOut); + TTY.out.println(method.format("Bailout in %H.%n(%p)")); + bailout.printStackTrace(TTY.out); } } catch (Throwable t) { if (PrintStackTraceOnException.getValue() || ExitVMOnException.getValue()) { - t.printStackTrace(TTY.cachedOut); + t.printStackTrace(TTY.out); } // Log a failure event. @@ -281,7 +281,7 @@ public static void compileMethod(HotSpotResolvedJavaMethod method, int entryBCI, long jvmciEnv, int id) { // Ensure a debug configuration for this thread is initialized if (Debug.isEnabled() && DebugScope.getConfig() == null) { - DebugEnvironment.initialize(TTY.cachedOut); + DebugEnvironment.initialize(TTY.out); } CompilationTask task = new CompilationTask(method, entryBCI, jvmciEnv, id, true); diff -r 3b5c9d5bfcaa -r 90e3fecd4143 jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompileTheWorld.java --- a/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompileTheWorld.java Tue Jun 09 17:25:57 2015 +0200 +++ b/jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompileTheWorld.java Tue Jun 09 17:29:15 2015 +0200 @@ -470,7 +470,7 @@ } catch (Throwable t) { // Catch everything and print a message println("CompileTheWorld (%d) : Error compiling method: %s", counter, method.format("%H.%n(%p):%r")); - t.printStackTrace(TTY.cachedOut); + t.printStackTrace(TTY.out); } }