< prev index next >

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

Print this page
*** 1150,22 ***
              if (member != null)
                  return member.hashCode();
              return super.hashCode();
          }
  
!         static final MethodType INVOKER_METHOD_TYPE =
!             MethodType.methodType(Object.class, MethodHandle.class, Object[].class);
  
          private static MethodHandle computeInvoker(MethodTypeForm typeForm) {
              typeForm = typeForm.basicType().form();  // normalize to basic type
              MethodHandle mh = typeForm.cachedMethodHandle(MethodTypeForm.MH_NF_INV);
              if (mh != null)  return mh;
              MemberName invoker = InvokerBytecodeGenerator.generateNamedFunctionInvoker(typeForm);  // this could take a while
              mh = DirectMethodHandle.make(invoker);
              MethodHandle mh2 = typeForm.cachedMethodHandle(MethodTypeForm.MH_NF_INV);
              if (mh2 != null)  return mh2;  // benign race
!             if (!mh.type().equals(INVOKER_METHOD_TYPE))
                  throw newInternalError(mh.debugString());
              return typeForm.setCachedMethodHandle(MethodTypeForm.MH_NF_INV, mh);
          }
  
          @Hidden
--- 1150,24 ---
              if (member != null)
                  return member.hashCode();
              return super.hashCode();
          }
  
!         static class AOTHolder {
!             static final MethodType INVOKER_METHOD_TYPE =
+                 MethodType.methodType(Object.class, MethodHandle.class, Object[].class);
+         }
  
          private static MethodHandle computeInvoker(MethodTypeForm typeForm) {
              typeForm = typeForm.basicType().form();  // normalize to basic type
              MethodHandle mh = typeForm.cachedMethodHandle(MethodTypeForm.MH_NF_INV);
              if (mh != null)  return mh;
              MemberName invoker = InvokerBytecodeGenerator.generateNamedFunctionInvoker(typeForm);  // this could take a while
              mh = DirectMethodHandle.make(invoker);
              MethodHandle mh2 = typeForm.cachedMethodHandle(MethodTypeForm.MH_NF_INV);
              if (mh2 != null)  return mh2;  // benign race
!             if (!mh.type().equals(AOTHolder.INVOKER_METHOD_TYPE))
                  throw newInternalError(mh.debugString());
              return typeForm.setCachedMethodHandle(MethodTypeForm.MH_NF_INV, mh);
          }
  
          @Hidden
< prev index next >