< prev index next >

src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java

Print this page
*** 36,11 ***
  import static java.lang.invoke.LambdaForm.*;
  import static java.lang.invoke.LambdaForm.BasicType.*;
  import static java.lang.invoke.MethodHandleImpl.Intrinsic;
  import static java.lang.invoke.MethodHandleImpl.NF_loop;
  import static java.lang.invoke.MethodHandleImpl.makeIntrinsic;
- import static java.lang.invoke.MethodHandleNatives.USE_SOFT_CACHE;
  
  /** Transforms on LFs.
   *  A lambda-form editor can derive new LFs from its base LF.
   *  The editor can cache derived LFs, which simplifies the reuse of their underlying bytecodes.
   *  To support this caching, a LF has an optional pointer to its editor.
--- 36,10 ---

*** 88,21 ***
       * Sequences that are simple (short enough and with small enough values) pack into a 64-bit long.
       *
       * Tightly coupled with the TransformKey class, which is used to lookup existing
       * Transforms.
       */
!     private static final class Transform {
-         final Object cache;
          final long packedBytes;
          final byte[] fullBytes;
  
          private Transform(long packedBytes, byte[] fullBytes, LambdaForm result) {
!             if (USE_SOFT_CACHE) {
-                 cache = new SoftReference<LambdaForm>(result);
-             } else {
-                 cache = result;
-             }
              this.packedBytes = packedBytes;
              this.fullBytes = fullBytes;
          }
  
          @Override
--- 87,16 ---
       * Sequences that are simple (short enough and with small enough values) pack into a 64-bit long.
       *
       * Tightly coupled with the TransformKey class, which is used to lookup existing
       * Transforms.
       */
!     private static final class Transform extends SoftReference<LambdaForm> {
          final long packedBytes;
          final byte[] fullBytes;
  
          private Transform(long packedBytes, byte[] fullBytes, LambdaForm result) {
!             super(result);
              this.packedBytes = packedBytes;
              this.fullBytes = fullBytes;
          }
  
          @Override

*** 139,19 ***
                  buf.append(" result=");
                  buf.append(result);
              }
              return buf.toString();
          }
- 
-         @SuppressWarnings({"rawtypes", "unchecked"})
-         public LambdaForm get() {
-             if (cache instanceof LambdaForm lf) {
-                 return lf;
-             } else {
-                 return ((SoftReference<LambdaForm>)cache).get();
-             }
-         }
      }
  
      /**
       * Used as a lookup key to find existing Transforms
       */
--- 133,10 ---
< prev index next >