< prev index next >

src/java.base/share/classes/jdk/internal/vm/Continuation.java

Print this page
@@ -54,13 +54,27 @@
          PRESERVE_SCOPED_VALUE_CACHE = (value == null) || Boolean.parseBoolean(value);
      }
  
      /** Reason for pinning */
      public enum Pinned {
-         /** Native frame on stack */ NATIVE,
-         /** Monitor held */          MONITOR,
-         /** In critical section */   CRITICAL_SECTION }
+         NATIVE(2, "Native frame or <clinit> on stack"),
+         MONITOR(3, "Monitor held"),
+         CRITICAL_SECTION(4, "In critical section");
+ 
+         private final int reasonCode;
+         private final String reasonString;
+         Pinned(int reasonCode, String reasonString) {
+             this.reasonCode = reasonCode;
+             this.reasonString = reasonString;
+         }
+         public int reasonCode() {
+             return reasonCode;
+         }
+         public String reasonString() {
+             return reasonString;
+         }
+     }
  
      /** Preemption attempt result */
      public enum PreemptStatus {
          /** Success */                                                      SUCCESS(null),
          /** Permanent failure */                                            PERM_FAIL_UNSUPPORTED(null),

@@ -351,12 +365,10 @@
          return cont.yield0(scope, null);
      }
  
      @Hidden
      private boolean yield0(ContinuationScope scope, Continuation child) {
-         preempted = false;
- 
          if (scope != this.scope)
              this.yieldInfo = scope;
          int res = doYield();
          U.storeFence(); // needed to prevent certain transformations by the compiler
  
< prev index next >