diff c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/logging/Logger.java @ 1429:abc670a709dc

* -XX:TraceC1X=0...5 controls the native c1x tracing * -Dc1x.debug=true turns on the logging proxies and lots of log output on the java side * provide more information about types to the compiler (type hierarchy, etc) * provide exception handler tables to the compiler * add exception handlers to the nmethod * correct implementation of ExceptionObject * exception handling/unwinding entry points * modified versions of handle/unwind exception stubs using standard calling conventions * exception throwing * implicit null pointer exception, implicit div by 0 exception * arraystore/classcast/arrayindex exceptions * checkcast implementation * newarray, anewarray, multinewarray implementation * correct new instance initialization * access to java class mirrors (for ldc) * unresolved methods * class resolving - class patching (asssembly prototype copying)
author Lukas Stadler <lukas.stadler@oracle.com>
date Tue, 31 Aug 2010 22:13:30 -0700
parents 760213a60e8b
children 9e5e83ca2259
line wrap: on
line diff
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/logging/Logger.java	Thu Aug 19 14:34:52 2010 -0700
+++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/logging/Logger.java	Tue Aug 31 22:13:30 2010 -0700
@@ -20,6 +20,7 @@
 import java.io.*;
 import java.lang.reflect.*;
 import java.util.*;
+
 /**
  * Scoped logging class used to display the call hierarchy of VMEntries/VMExits calls
  *
@@ -27,7 +28,7 @@
  */
 public class Logger {
 
-    private static final boolean ENABLED = true;
+    public static final boolean ENABLED = Boolean.valueOf(System.getProperty("c1x.debug"));
     private static final int SPACING = 4;
     private static Deque<Boolean> openStack = new LinkedList<Boolean>();
     private static boolean open = false;
@@ -36,21 +37,30 @@
     private final static PrintStream out;
 
     static {
-        PrintStream ps;
-        try {
-            ps = new PrintStream(new FileOutputStream("output.txt"));
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
-            ps = null;
+        PrintStream ps = null;
+        String filename = System.getProperty("c1x.info_file");
+        if (filename != null && !"".equals(filename)) {
+            try {
+                ps = new PrintStream(new FileOutputStream(filename));
+            } catch (FileNotFoundException e) {
+                e.printStackTrace();
+                ps = null;
+            }
         }
         out = ps;
-        out.println("start: " + new Date());
+        if (out != null)
+            out.println("start: " + new Date());
     }
 
     public static void info(String message) {
-        log(message);
-        out.println(message);
-        out.flush();
+        if (ENABLED)
+            log(message);
+        else
+            System.out.println(message);
+        if (out != null) {
+            out.println(message);
+            out.flush();
+        }
     }
 
     public static void log(String message) {