changeset 21882:90e3fecd4143

renamed fields in TTY to better reflect their semantics
author Doug Simon <doug.simon@oracle.com>
date Tue, 09 Jun 2015 17:29:15 +0200
parents 3b5c9d5bfcaa
children 2d97ac4c3df5
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraalDebugConfigCustomizer.java jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/TTY.java jvmci/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugScope.java jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilationTask.java jvmci/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompileTheWorld.java
diffstat 7 files changed, 25 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- 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) {
--- 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);
         }
     }
 }
--- 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()));
         }
--- 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<LogStream> out = new ThreadLocal<LogStream>() {
+    private static final ThreadLocal<LogStream> log = new ThreadLocal<LogStream>() {
 
         @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();
     }
 
     /**
--- 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();
--- 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);
--- 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);
         }
     }