src/share/classes/java/lang/invoke/MethodTypeForm.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File jdk Sdiff src/share/classes/java/lang/invoke

src/share/classes/java/lang/invoke/MethodTypeForm.java

Print this page




  74             LF_EX_INVOKER     = 10,  // invokeExact MH
  75             LF_GEN_LINKER     = 11,
  76             LF_GEN_INVOKER    = 12,
  77             LF_CS_LINKER      = 13,  // linkToCallSite_CS
  78             LF_MH_LINKER      = 14,  // linkToCallSite_MH
  79             LF_GWC            = 15,
  80             LF_LIMIT          = 16;
  81 
  82     public MethodType erasedType() {
  83         return erasedType;
  84     }
  85 
  86     public MethodType basicType() {
  87         return basicType;
  88     }
  89 
  90     public LambdaForm cachedLambdaForm(int which) {
  91         return lambdaForms[which];
  92     }
  93 
  94     public LambdaForm setCachedLambdaForm(int which, LambdaForm form) {
  95         // Should we perform some sort of CAS, to avoid racy duplication?


  96         return lambdaForms[which] = form;
  97     }
  98 
  99     public MethodHandle basicInvoker() {
 100         assert(erasedType == basicType) : "erasedType: " + erasedType + " != basicType: " + basicType;  // primitives must be flattened also
 101         MethodHandle invoker = basicInvoker;
 102         if (invoker != null)  return invoker;
 103         invoker = DirectMethodHandle.make(invokeBasicMethod(basicType));
 104         basicInvoker = invoker;
 105         return invoker;
 106     }
 107 
 108     // This next one is called from LambdaForm.NamedFunction.<init>.
 109     /*non-public*/ static MemberName invokeBasicMethod(MethodType basicType) {
 110         assert(basicType == basicType.basicType());
 111         try {
 112             // Do approximately the same as this public API call:
 113             //   Lookup.findVirtual(MethodHandle.class, name, type);
 114             // But bypass access and corner case checks, since we know exactly what we need.
 115             return IMPL_LOOKUP.resolveOrFail(REF_invokeVirtual, MethodHandle.class, "invokeBasic", basicType);




  74             LF_EX_INVOKER     = 10,  // invokeExact MH
  75             LF_GEN_LINKER     = 11,
  76             LF_GEN_INVOKER    = 12,
  77             LF_CS_LINKER      = 13,  // linkToCallSite_CS
  78             LF_MH_LINKER      = 14,  // linkToCallSite_MH
  79             LF_GWC            = 15,
  80             LF_LIMIT          = 16;
  81 
  82     public MethodType erasedType() {
  83         return erasedType;
  84     }
  85 
  86     public MethodType basicType() {
  87         return basicType;
  88     }
  89 
  90     public LambdaForm cachedLambdaForm(int which) {
  91         return lambdaForms[which];
  92     }
  93 
  94     synchronized public LambdaForm setCachedLambdaForm(int which, LambdaForm form) {
  95         // Simulate a CAS, to avoid racy duplication of results.
  96         LambdaForm prev = lambdaForms[which];
  97         if (prev != null) return prev;
  98         return lambdaForms[which] = form;
  99     }
 100 
 101     public MethodHandle basicInvoker() {
 102         assert(erasedType == basicType) : "erasedType: " + erasedType + " != basicType: " + basicType;  // primitives must be flattened also
 103         MethodHandle invoker = basicInvoker;
 104         if (invoker != null)  return invoker;
 105         invoker = DirectMethodHandle.make(invokeBasicMethod(basicType));
 106         basicInvoker = invoker;
 107         return invoker;
 108     }
 109 
 110     // This next one is called from LambdaForm.NamedFunction.<init>.
 111     /*non-public*/ static MemberName invokeBasicMethod(MethodType basicType) {
 112         assert(basicType == basicType.basicType());
 113         try {
 114             // Do approximately the same as this public API call:
 115             //   Lookup.findVirtual(MethodHandle.class, name, type);
 116             // But bypass access and corner case checks, since we know exactly what we need.
 117             return IMPL_LOOKUP.resolveOrFail(REF_invokeVirtual, MethodHandle.class, "invokeBasic", basicType);


src/share/classes/java/lang/invoke/MethodTypeForm.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File