changeset 15591:55977f9fa56f

fixed assertion position and documented critical class initialization dependency
author Doug Simon <doug.simon@oracle.com>
date Sun, 11 May 2014 22:00:06 +0200
parents 1e63e4b5ef6d
children 07ca8c86d31c
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java	Sun May 11 13:43:58 2014 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java	Sun May 11 22:00:06 2014 +0200
@@ -33,6 +33,7 @@
 import java.nio.file.*;
 import java.util.*;
 
+import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.hotspot.logging.*;
@@ -247,8 +248,9 @@
             unconditionallyEnableTimerOrMetric(InliningUtil.class, "InlinedBytecodes");
             unconditionallyEnableTimerOrMetric(CompilationTask.class, "CompilationTime");
         }
+        assert !Debug.Initialization.isDebugInitialized() : "The class " + Debug.class.getName() + " must not be initialized before the Graal runtime has been initialized. " +
+                        "This can be fixed by placing a call to " + Graal.class.getName() + ".runtime() on the path that triggers initialization of " + Debug.class.getName();
         if (areDebugScopePatternsEnabled()) {
-            assert !Debug.Initialization.isDebugInitialized();
             System.setProperty(Debug.Initialization.INITIALIZER_PROPERTY_NAME, "true");
         }
     }
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java	Sun May 11 13:43:58 2014 +0200
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java	Sun May 11 22:00:06 2014 +0200
@@ -35,7 +35,11 @@
 public class DebugEnvironment {
 
     public static GraalDebugConfig initialize(PrintStream log) {
+
+        // Ensure Graal runtime is initialized prior to Debug being initialized as the former
+        // included processing command line options used by the latter.
         Graal.getRuntime();
+
         if (!Debug.isEnabled()) {
             log.println("WARNING: Scope debugging needs to be enabled with -esa or -D" + Debug.Initialization.INITIALIZER_PROPERTY_NAME + "=true");
             return null;