src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/internal/DebugScope.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/internal

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/internal/DebugScope.java

Print this page




 386         if (sandboxConfig != null) {
 387             newScope = new DebugScope(name.toString(), this, uniqueScopeId.incrementAndGet(), null, true, newContextObjects);
 388             configTL.set(sandboxConfig);
 389         } else {
 390             newScope = this.createChild(name.toString(), this.extraInfo, newContextObjects);
 391         }
 392         instanceTL.set(newScope);
 393         newScope.updateFlags();
 394         return newScope;
 395     }
 396 
 397     public DebugScope enhanceWithExtraInfo(CharSequence name, ExtraInfo newInfo, boolean newId, Object... newContext) {
 398         DebugScope newScope = createChild(name.toString(), newInfo, newId ? uniqueScopeId.incrementAndGet() : this.scopeId, newContext);
 399         instanceTL.set(newScope);
 400         newScope.updateFlags();
 401         return newScope;
 402     }
 403 
 404     public RuntimeException handle(Throwable e) {
 405         DebugScope lastClosed = lastClosedTL.get();
 406         assert lastClosed.parent == this : "Debug.handle() used with no matching Debug.scope(...) or Debug.sandbox(...)";


 407         if (e != lastExceptionThrownTL.get()) {
 408             RuntimeException newException = null;
 409             instanceTL.set(lastClosed);
 410             try (DebugScope s = lastClosed) {
 411                 newException = s.interceptException(e);
 412             }
 413             assert instanceTL.get() == this;
 414             assert lastClosed == lastClosedTL.get();
 415             if (newException == null) {
 416                 lastExceptionThrownTL.set(e);
 417             } else {
 418                 lastExceptionThrownTL.set(newException);
 419                 throw newException;
 420             }
 421         }




 422         if (e instanceof Error) {
 423             throw (Error) e;
 424         }
 425         if (e instanceof RuntimeException) {
 426             throw (RuntimeException) e;
 427         }
 428         throw new RuntimeException(e);
 429     }
 430 
 431     private void updateFlags() {
 432         DebugConfig config = getConfig();
 433         if (config == null) {
 434             countEnabled = false;
 435             memUseTrackingEnabled = false;
 436             timeEnabled = false;
 437             verifyEnabled = false;
 438             currentDumpLevel = 0;
 439             methodMetricsEnabled = false;
 440             // Be pragmatic: provide a default log stream to prevent a crash if the stream is not
 441             // set while logging




 386         if (sandboxConfig != null) {
 387             newScope = new DebugScope(name.toString(), this, uniqueScopeId.incrementAndGet(), null, true, newContextObjects);
 388             configTL.set(sandboxConfig);
 389         } else {
 390             newScope = this.createChild(name.toString(), this.extraInfo, newContextObjects);
 391         }
 392         instanceTL.set(newScope);
 393         newScope.updateFlags();
 394         return newScope;
 395     }
 396 
 397     public DebugScope enhanceWithExtraInfo(CharSequence name, ExtraInfo newInfo, boolean newId, Object... newContext) {
 398         DebugScope newScope = createChild(name.toString(), newInfo, newId ? uniqueScopeId.incrementAndGet() : this.scopeId, newContext);
 399         instanceTL.set(newScope);
 400         newScope.updateFlags();
 401         return newScope;
 402     }
 403 
 404     public RuntimeException handle(Throwable e) {
 405         DebugScope lastClosed = lastClosedTL.get();
 406         try {
 407             assert lastClosed.parent == this : "Debug.handle() used with no matching Debug.scope(...) or Debug.sandbox(...) " +
 408                             "or an exception occurred while opening a scope";
 409             if (e != lastExceptionThrownTL.get()) {
 410                 RuntimeException newException = null;
 411                 instanceTL.set(lastClosed);
 412                 try (DebugScope s = lastClosed) {
 413                     newException = s.interceptException(e);
 414                 }
 415                 assert instanceTL.get() == this;
 416                 assert lastClosed == lastClosedTL.get();
 417                 if (newException == null) {
 418                     lastExceptionThrownTL.set(e);
 419                 } else {
 420                     lastExceptionThrownTL.set(newException);
 421                     throw newException;
 422                 }
 423             }
 424         } catch (Throwable t) {
 425             t.initCause(e);
 426             throw t;
 427         }
 428         if (e instanceof Error) {
 429             throw (Error) e;
 430         }
 431         if (e instanceof RuntimeException) {
 432             throw (RuntimeException) e;
 433         }
 434         throw new RuntimeException(e);
 435     }
 436 
 437     private void updateFlags() {
 438         DebugConfig config = getConfig();
 439         if (config == null) {
 440             countEnabled = false;
 441             memUseTrackingEnabled = false;
 442             timeEnabled = false;
 443             verifyEnabled = false;
 444             currentDumpLevel = 0;
 445             methodMetricsEnabled = false;
 446             // Be pragmatic: provide a default log stream to prevent a crash if the stream is not
 447             // set while logging


src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/internal/DebugScope.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File