src/share/classes/java/lang/invoke/CallSite.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/CallSite.java

Print this page
rev 10274 : 8050052: Small cleanups in java.lang.invoke code
Reviewed-by: ?
rev 10275 : imported patch invokers
rev 10276 : 8050166: Get rid of some package-private methods on arguments in j.l.i.MethodHandle
Reviewed-by: vlivanov, ?
Contributed-by: john.r.rose@oracle.com
rev 10277 : 8050173: Add j.l.i.MethodHandle.copyWith(MethodType, LambdaForm)
Reviewed-by: vlivanov, ?
Contributed-by: john.r.rose@oracle.com


 225             THROW_UCS = IMPL_LOOKUP.
 226                 findStatic(CallSite.class, "uninitializedCallSite", MethodType.methodType(Object.class, Object[].class));
 227         } catch (ReflectiveOperationException e) {
 228             throw newInternalError(e);
 229         }
 230     }
 231 
 232     /** This guy is rolled into the default target if a MethodType is supplied to the constructor. */
 233     private static Object uninitializedCallSite(Object... ignore) {
 234         throw new IllegalStateException("uninitialized call site");
 235     }
 236 
 237     private MethodHandle makeUninitializedCallSite(MethodType targetType) {
 238         MethodType basicType = targetType.basicType();
 239         MethodHandle invoker = basicType.form().cachedMethodHandle(MethodTypeForm.MH_UNINIT_CS);
 240         if (invoker == null) {
 241             invoker = THROW_UCS.asType(basicType);
 242             invoker = basicType.form().setCachedMethodHandle(MethodTypeForm.MH_UNINIT_CS, invoker);
 243         }
 244         // unchecked view is OK since no values will be received or returned
 245         return invoker.viewAsType(targetType);
 246     }
 247 
 248     // unsafe stuff:
 249     private static final long TARGET_OFFSET;
 250     static {
 251         try {
 252             TARGET_OFFSET = UNSAFE.objectFieldOffset(CallSite.class.getDeclaredField("target"));
 253         } catch (Exception ex) { throw new Error(ex); }
 254     }
 255 
 256     /*package-private*/
 257     void setTargetNormal(MethodHandle newTarget) {
 258         MethodHandleNatives.setCallSiteTargetNormal(this, newTarget);
 259     }
 260     /*package-private*/
 261     MethodHandle getTargetVolatile() {
 262         return (MethodHandle) UNSAFE.getObjectVolatile(this, TARGET_OFFSET);
 263     }
 264     /*package-private*/
 265     void setTargetVolatile(MethodHandle newTarget) {




 225             THROW_UCS = IMPL_LOOKUP.
 226                 findStatic(CallSite.class, "uninitializedCallSite", MethodType.methodType(Object.class, Object[].class));
 227         } catch (ReflectiveOperationException e) {
 228             throw newInternalError(e);
 229         }
 230     }
 231 
 232     /** This guy is rolled into the default target if a MethodType is supplied to the constructor. */
 233     private static Object uninitializedCallSite(Object... ignore) {
 234         throw new IllegalStateException("uninitialized call site");
 235     }
 236 
 237     private MethodHandle makeUninitializedCallSite(MethodType targetType) {
 238         MethodType basicType = targetType.basicType();
 239         MethodHandle invoker = basicType.form().cachedMethodHandle(MethodTypeForm.MH_UNINIT_CS);
 240         if (invoker == null) {
 241             invoker = THROW_UCS.asType(basicType);
 242             invoker = basicType.form().setCachedMethodHandle(MethodTypeForm.MH_UNINIT_CS, invoker);
 243         }
 244         // unchecked view is OK since no values will be received or returned
 245         return invoker.viewAsType(targetType, false);
 246     }
 247 
 248     // unsafe stuff:
 249     private static final long TARGET_OFFSET;
 250     static {
 251         try {
 252             TARGET_OFFSET = UNSAFE.objectFieldOffset(CallSite.class.getDeclaredField("target"));
 253         } catch (Exception ex) { throw new Error(ex); }
 254     }
 255 
 256     /*package-private*/
 257     void setTargetNormal(MethodHandle newTarget) {
 258         MethodHandleNatives.setCallSiteTargetNormal(this, newTarget);
 259     }
 260     /*package-private*/
 261     MethodHandle getTargetVolatile() {
 262         return (MethodHandle) UNSAFE.getObjectVolatile(this, TARGET_OFFSET);
 263     }
 264     /*package-private*/
 265     void setTargetVolatile(MethodHandle newTarget) {


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