final class jdk.internal.foreign.MemoryScope$Root extends jdk.internal.foreign.MemoryScope
  minor version: 0
  major version: 59
  flags: flags: (0x0030) ACC_FINAL, ACC_SUPER
  this_class: jdk.internal.foreign.MemoryScope$Root
  super_class: jdk.internal.foreign.MemoryScope
{
  private final java.util.concurrent.locks.StampedLock lock;
    descriptor: Ljava/util/concurrent/locks/StampedLock;
    flags: (0x0012) ACC_PRIVATE, ACC_FINAL

  private final java.util.concurrent.atomic.LongAdder acquired;
    descriptor: Ljava/util/concurrent/atomic/LongAdder;
    flags: (0x0012) ACC_PRIVATE, ACC_FINAL

  private final java.lang.Object ref;
    descriptor: Ljava/lang/Object;
    flags: (0x0012) ACC_PRIVATE, ACC_FINAL

  private final java.lang.Runnable cleanupAction;
    descriptor: Ljava/lang/Runnable;
    flags: (0x0012) ACC_PRIVATE, ACC_FINAL

  private void <init>(java.lang.Thread, java.lang.Object, java.lang.Runnable);
    descriptor: (Ljava/lang/Thread;Ljava/lang/Object;Ljava/lang/Runnable;)V
    flags: (0x0002) ACC_PRIVATE
    Code:
      stack=3, locals=4, args_size=4
        start local 0 // jdk.internal.foreign.MemoryScope$Root this
        start local 1 // java.lang.Thread owner
        start local 2 // java.lang.Object ref
        start local 3 // java.lang.Runnable cleanupAction
         0: .line 215
            aload 0 /* this */
            aload 1 /* owner */
            invokespecial jdk.internal.foreign.MemoryScope.<init>:(Ljava/lang/Thread;)V
         1: .line 209
            aload 0 /* this */
            new java.util.concurrent.locks.StampedLock
            dup
            invokespecial java.util.concurrent.locks.StampedLock.<init>:()V
            putfield jdk.internal.foreign.MemoryScope$Root.lock:Ljava/util/concurrent/locks/StampedLock;
         2: .line 210
            aload 0 /* this */
            new java.util.concurrent.atomic.LongAdder
            dup
            invokespecial java.util.concurrent.atomic.LongAdder.<init>:()V
            putfield jdk.internal.foreign.MemoryScope$Root.acquired:Ljava/util/concurrent/atomic/LongAdder;
         3: .line 216
            aload 0 /* this */
            aload 2 /* ref */
            putfield jdk.internal.foreign.MemoryScope$Root.ref:Ljava/lang/Object;
         4: .line 217
            aload 0 /* this */
            aload 3 /* cleanupAction */
            putfield jdk.internal.foreign.MemoryScope$Root.cleanupAction:Ljava/lang/Runnable;
         5: .line 218
            return
        end local 3 // java.lang.Runnable cleanupAction
        end local 2 // java.lang.Object ref
        end local 1 // java.lang.Thread owner
        end local 0 // jdk.internal.foreign.MemoryScope$Root this
      LocalVariableTable:
        Start  End  Slot           Name  Signature
            0    6     0           this  Ljdk/internal/foreign/MemoryScope$Root;
            0    6     1          owner  Ljava/lang/Thread;
            0    6     2            ref  Ljava/lang/Object;
            0    6     3  cleanupAction  Ljava/lang/Runnable;
    MethodParameters:
               Name  Flags
      owner          
      ref            
      cleanupAction  

  jdk.internal.foreign.MemoryScope acquire();
    descriptor: ()Ljdk/internal/foreign/MemoryScope;
    flags: (0x0000) 
    Code:
      stack=4, locals=5, args_size=1
        start local 0 // jdk.internal.foreign.MemoryScope$Root this
         0: .line 223
            aload 0 /* this */
            getfield jdk.internal.foreign.MemoryScope$Root.lock:Ljava/util/concurrent/locks/StampedLock;
            invokevirtual java.util.concurrent.locks.StampedLock.tryOptimisticRead:()J
            lstore 1 /* stamp */
        start local 1 // long stamp
         1: .line 226
      StackMap locals: long
      StackMap stack:
            lload 1 /* stamp */
            lconst_0
            lcmp
            ifne 3
         2: .line 227
            goto 11
         3: .line 228
      StackMap locals:
      StackMap stack:
            aload 0 /* this */
            invokestatic jdk.internal.foreign.MemoryScope.checkAliveConfined:(Ljdk/internal/foreign/MemoryScope;)V
         4: .line 231
            aload 0 /* this */
            getfield jdk.internal.foreign.MemoryScope$Root.acquired:Ljava/util/concurrent/atomic/LongAdder;
            invokevirtual java.util.concurrent.atomic.LongAdder.increment:()V
         5: .line 233
            aload 0 /* this */
            getfield jdk.internal.foreign.MemoryScope$Root.lock:Ljava/util/concurrent/locks/StampedLock;
            lload 1 /* stamp */
            invokevirtual java.util.concurrent.locks.StampedLock.validate:(J)Z
            ifeq 10
         6: .line 235
            new jdk.internal.foreign.MemoryScope$Root$Child
            dup
            aload 0 /* this */
            invokestatic java.lang.Thread.currentThread:()Ljava/lang/Thread;
            invokespecial jdk.internal.foreign.MemoryScope$Root$Child.<init>:(Ljdk/internal/foreign/MemoryScope$Root;Ljava/lang/Thread;)V
            astore 4
         7: .line 242
            lload 1 /* stamp */
            invokestatic java.util.concurrent.locks.StampedLock.isReadLockStamp:(J)Z
            ifeq 9
         8: .line 243
            aload 0 /* this */
            getfield jdk.internal.foreign.MemoryScope$Root.lock:Ljava/util/concurrent/locks/StampedLock;
            lload 1 /* stamp */
            invokevirtual java.util.concurrent.locks.StampedLock.unlockRead:(J)V
         9: .line 235
      StackMap locals: jdk.internal.foreign.MemoryScope$Root long top jdk.internal.foreign.MemoryScope
      StackMap stack:
            aload 4
            areturn
        10: .line 238
      StackMap locals: jdk.internal.foreign.MemoryScope$Root long
      StackMap stack:
            aload 0 /* this */
            getfield jdk.internal.foreign.MemoryScope$Root.acquired:Ljava/util/concurrent/atomic/LongAdder;
            invokevirtual java.util.concurrent.atomic.LongAdder.decrement:()V
        11: .line 225
      StackMap locals:
      StackMap stack:
            aload 0 /* this */
            getfield jdk.internal.foreign.MemoryScope$Root.lock:Ljava/util/concurrent/locks/StampedLock;
            invokevirtual java.util.concurrent.locks.StampedLock.readLock:()J
            lstore 1 /* stamp */
            goto 1
        12: .line 241
      StackMap locals:
      StackMap stack: java.lang.Throwable
            astore 3
        13: .line 242
            lload 1 /* stamp */
            invokestatic java.util.concurrent.locks.StampedLock.isReadLockStamp:(J)Z
            ifeq 15
        14: .line 243
            aload 0 /* this */
            getfield jdk.internal.foreign.MemoryScope$Root.lock:Ljava/util/concurrent/locks/StampedLock;
            lload 1 /* stamp */
            invokevirtual java.util.concurrent.locks.StampedLock.unlockRead:(J)V
        15: .line 244
      StackMap locals: java.lang.Throwable
      StackMap stack:
            aload 3
            athrow
        end local 1 // long stamp
        end local 0 // jdk.internal.foreign.MemoryScope$Root this
      LocalVariableTable:
        Start  End  Slot   Name  Signature
            0   16     0   this  Ljdk/internal/foreign/MemoryScope$Root;
            1   16     1  stamp  J
      Exception table:
        from    to  target  type
           1     7      12  any
          10    12      12  any

  jdk.internal.foreign.MemoryScope dup(java.lang.Thread);
    descriptor: (Ljava/lang/Thread;)Ljdk/internal/foreign/MemoryScope;
    flags: (0x0000) 
    Code:
      stack=5, locals=3, args_size=2
        start local 0 // jdk.internal.foreign.MemoryScope$Root this
        start local 1 // java.lang.Thread newOwner
         0: .line 249
            aload 1 /* newOwner */
            ldc "newOwner"
            invokestatic java.util.Objects.requireNonNull:(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
            pop
         1: .line 251
            new jdk.internal.foreign.MemoryScope$Root
            dup
            aload 1 /* newOwner */
            aload 0 /* this */
            getfield jdk.internal.foreign.MemoryScope$Root.ref:Ljava/lang/Object;
            aload 0 /* this */
            getfield jdk.internal.foreign.MemoryScope$Root.cleanupAction:Ljava/lang/Runnable;
            invokespecial jdk.internal.foreign.MemoryScope$Root.<init>:(Ljava/lang/Thread;Ljava/lang/Object;Ljava/lang/Runnable;)V
            astore 2 /* duped */
        start local 2 // jdk.internal.foreign.MemoryScope$Root duped
         2: .line 252
            aload 0 /* this */
            invokevirtual jdk.internal.foreign.MemoryScope$Root.justClose:()V
         3: .line 253
            aload 2 /* duped */
            areturn
        end local 2 // jdk.internal.foreign.MemoryScope$Root duped
        end local 1 // java.lang.Thread newOwner
        end local 0 // jdk.internal.foreign.MemoryScope$Root this
      LocalVariableTable:
        Start  End  Slot      Name  Signature
            0    4     0      this  Ljdk/internal/foreign/MemoryScope$Root;
            0    4     1  newOwner  Ljava/lang/Thread;
            2    4     2     duped  Ljdk/internal/foreign/MemoryScope$Root;
    MethodParameters:
          Name  Flags
      newOwner  

  void close();
    descriptor: ()V
    flags: (0x0000) 
    Code:
      stack=1, locals=1, args_size=1
        start local 0 // jdk.internal.foreign.MemoryScope$Root this
         0: .line 258
            aload 0 /* this */
            invokevirtual jdk.internal.foreign.MemoryScope$Root.justClose:()V
         1: .line 259
            aload 0 /* this */
            getfield jdk.internal.foreign.MemoryScope$Root.cleanupAction:Ljava/lang/Runnable;
            ifnull 3
         2: .line 260
            aload 0 /* this */
            getfield jdk.internal.foreign.MemoryScope$Root.cleanupAction:Ljava/lang/Runnable;
            invokeinterface java.lang.Runnable.run:()V
         3: .line 262
      StackMap locals:
      StackMap stack:
            return
        end local 0 // jdk.internal.foreign.MemoryScope$Root this
      LocalVariableTable:
        Start  End  Slot  Name  Signature
            0    4     0  this  Ljdk/internal/foreign/MemoryScope$Root;

  private void justClose();
    descriptor: ()V
    flags: (0x0002) ACC_PRIVATE
    Code:
      stack=4, locals=4, args_size=1
        start local 0 // jdk.internal.foreign.MemoryScope$Root this
         0: .line 267
            aload 0 /* this */
            getfield jdk.internal.foreign.MemoryScope$Root.lock:Ljava/util/concurrent/locks/StampedLock;
            invokevirtual java.util.concurrent.locks.StampedLock.writeLock:()J
            lstore 1 /* stamp */
        start local 1 // long stamp
         1: .line 269
            aload 0 /* this */
            invokevirtual jdk.internal.foreign.MemoryScope$Root.checkValidState:()V
         2: .line 271
            aload 0 /* this */
            getfield jdk.internal.foreign.MemoryScope$Root.acquired:Ljava/util/concurrent/atomic/LongAdder;
            invokevirtual java.util.concurrent.atomic.LongAdder.sum:()J
            lconst_0
            lcmp
            ifle 4
         3: .line 272
            new java.lang.IllegalStateException
            dup
            ldc "Cannot close this scope as it has active acquired children"
            invokespecial java.lang.IllegalStateException.<init>:(Ljava/lang/String;)V
            athrow
         4: .line 275
      StackMap locals: long
      StackMap stack:
            getstatic jdk.internal.foreign.MemoryScope.CLOSED:Ljava/lang/invoke/VarHandle;
            aload 0 /* this */
            iconst_1
            invokevirtual java.lang.invoke.VarHandle.set:(Ljdk/internal/foreign/MemoryScope$Root;Z)V
         5: .line 276
            goto 9
      StackMap locals:
      StackMap stack: java.lang.Throwable
         6: astore 3
         7: .line 278
            aload 0 /* this */
            getfield jdk.internal.foreign.MemoryScope$Root.lock:Ljava/util/concurrent/locks/StampedLock;
            lload 1 /* stamp */
            invokevirtual java.util.concurrent.locks.StampedLock.unlockWrite:(J)V
         8: .line 279
            aload 3
            athrow
         9: .line 278
      StackMap locals:
      StackMap stack:
            aload 0 /* this */
            getfield jdk.internal.foreign.MemoryScope$Root.lock:Ljava/util/concurrent/locks/StampedLock;
            lload 1 /* stamp */
            invokevirtual java.util.concurrent.locks.StampedLock.unlockWrite:(J)V
        10: .line 280
            return
        end local 1 // long stamp
        end local 0 // jdk.internal.foreign.MemoryScope$Root this
      LocalVariableTable:
        Start  End  Slot   Name  Signature
            0   11     0   this  Ljdk/internal/foreign/MemoryScope$Root;
            1   11     1  stamp  J
      Exception table:
        from    to  target  type
           1     6       6  any
    RuntimeVisibleAnnotations: 
      jdk.internal.vm.annotation.ForceInline()
}
SourceFile: "MemoryScope.java"
NestHost: jdk.internal.foreign.MemoryScope
InnerClasses:
  private final Root = jdk.internal.foreign.MemoryScope$Root of jdk.internal.foreign.MemoryScope
  private final Child = jdk.internal.foreign.MemoryScope$Root$Child of jdk.internal.foreign.MemoryScope$Root