nashorn/src/jdk/internal/dynalink/linker/GuardingDynamicLinker.java
changeset 24719 f726e9d67629
parent 16245 6a1c6c8bc113
equal deleted inserted replaced
23083:8c74590d5df1 24719:f726e9d67629
    99      * @param linkRequest the object describing the request for linking a particular invocation
    99      * @param linkRequest the object describing the request for linking a particular invocation
   100      * @param linkerServices linker services
   100      * @param linkerServices linker services
   101      * @return a guarded invocation with a method handle suitable for the arguments, as well as a guard condition that
   101      * @return a guarded invocation with a method handle suitable for the arguments, as well as a guard condition that
   102      * if fails should trigger relinking. Must return null if it can't resolve the invocation. If the returned
   102      * if fails should trigger relinking. Must return null if it can't resolve the invocation. If the returned
   103      * invocation is unconditional (which is actually quite rare), the guard in the return value can be null. The
   103      * invocation is unconditional (which is actually quite rare), the guard in the return value can be null. The
   104      * invocation can also have a switch point for asynchronous invalidation of the linkage. If the linker does not
   104      * invocation can also have a switch point for asynchronous invalidation of the linkage, as well as a
   105      * recognize any native language runtime contexts in arguments, or does recognize its own, but receives a call site
   105      * {@link Throwable} subclass that describes an expected exception condition that also triggers relinking (often it
   106      * descriptor without its recognized context in the arguments, it should invoke
   106      * is faster to rely on an infrequent but expected {@link ClassCastException} than on an always evaluated
   107      * {@link LinkRequest#withoutRuntimeContext()} and link for that.
   107      * {@code instanceof} guard). If the linker does not recognize any native language runtime contexts in arguments, or
       
   108      * does recognize its own, but receives a call site descriptor without its recognized context in the arguments, it
       
   109      * should invoke {@link LinkRequest#withoutRuntimeContext()} and link for that. While the linker must produce an
       
   110      * invocation with parameter types matching those in the call site descriptor of the link request, it should not try
       
   111      * to match the return type expected at the call site except when it can do it with only the conversions that lose
       
   112      * neither precision nor magnitude, see {@link LinkerServices#asTypeLosslessReturn(java.lang.invoke.MethodHandle,
       
   113      * java.lang.invoke.MethodType)}.
   108      * @throws Exception if the operation fails for whatever reason
   114      * @throws Exception if the operation fails for whatever reason
   109      */
   115      */
   110     public GuardedInvocation getGuardedInvocation(LinkRequest linkRequest, LinkerServices linkerServices)
   116     public GuardedInvocation getGuardedInvocation(LinkRequest linkRequest, LinkerServices linkerServices)
   111             throws Exception;
   117             throws Exception;
   112 }
   118 }