changeset 13547:8ea968b6dba9

fix handling of sandboxed debug scopes (don't destroy parent flags)
author Lukas Stadler <lukas.stadler@jku.at>
date Wed, 08 Jan 2014 14:47:47 +0100
parents 43bd3d7254d1
children 2a165b1e841c
files graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java
diffstat 2 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java	Wed Jan 08 12:51:13 2014 +0100
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java	Wed Jan 08 14:47:47 2014 +0100
@@ -169,7 +169,7 @@
      */
     public static Scope scope(String name, Object... context) {
         if (ENABLED) {
-            return DebugScope.getInstance().scope(name, false, null, context);
+            return DebugScope.getInstance().scope(name, null, context);
         } else {
             return null;
         }
@@ -198,7 +198,7 @@
     public static Scope sandbox(String name, DebugConfig config, Object... context) {
         if (ENABLED) {
             DebugConfig sandboxConfig = config == null ? silentConfig() : config;
-            return DebugScope.getInstance().scope(name, true, sandboxConfig, context);
+            return DebugScope.getInstance().scope(name, sandboxConfig, context);
         } else {
             return null;
         }
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java	Wed Jan 08 12:51:13 2014 +0100
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java	Wed Jan 08 14:47:47 2014 +0100
@@ -169,7 +169,7 @@
 
     public void close() {
         instanceTL.set(parent);
-        setConfig(parentConfig);
+        configTL.set(parentConfig);
         lastClosedTL.set(this);
     }
 
@@ -236,18 +236,17 @@
      * disjoint top level scope.
      * 
      * @param name the name of the new scope
-     * @param sandbox specifies if the scope is a child of the current scope or a top level scope
-     * @param sandboxConfig the configuration to use for a new top level scope (ignored if
-     *            {@code sandbox == false})
+     * @param sandboxConfig the configuration to use for a new top level scope, or null if the new
+     *            scope should be a child scope
      * @param context objects to be appended to the debug context
      * @return the new scope which will be exited when its {@link #close()} method is called
      */
     @SuppressWarnings("hiding")
-    public DebugScope scope(String name, boolean sandbox, DebugConfig sandboxConfig, Object... context) {
+    public DebugScope scope(String name, DebugConfig sandboxConfig, Object... context) {
         DebugScope newScope = null;
-        if (sandbox) {
+        if (sandboxConfig != null) {
             newScope = new DebugScope(name, name, this, true, context);
-            setConfig(sandboxConfig);
+            configTL.set(sandboxConfig);
         } else {
             newScope = this.createChild(name, context);
         }
@@ -308,7 +307,7 @@
     private RuntimeException interceptException(final Throwable e) {
         final DebugConfig config = getConfig();
         if (config != null) {
-            try (DebugScope s = scope("InterceptException", false, null, e)) {
+            try (DebugScope s = scope("InterceptException", null, e)) {
                 return config.interceptException(e);
             } catch (Throwable t) {
                 return new RuntimeException("Exception while intercepting exception", t);