< prev index next >

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

Print this page
rev 51977 : [mq]: 8200381-Typos-in-javadoc-missing-verb-be-and-alike
   1 /*
   2  * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 488     /** Static definition of MethodHandle.invokeGeneric checking code.
 489      * Directly returns the type-adjusted MH to invoke, as follows:
 490      * {@code (R)MH.invoke(a*) => MH.asType(TYPEOF(a*:R)).invokeBasic(a*)}
 491      */
 492     /*non-public*/ static
 493     @ForceInline
 494     MethodHandle checkGenericType(MethodHandle mh,  MethodType expected) {
 495         return mh.asType(expected);
 496         /* Maybe add more paths here.  Possible optimizations:
 497          * for (R)MH.invoke(a*),
 498          * let MT0 = TYPEOF(a*:R), MT1 = MH.type
 499          *
 500          * if MT0==MT1 or MT1 can be safely called by MT0
 501          *  => MH.invokeBasic(a*)
 502          * if MT1 can be safely called by MT0[R := Object]
 503          *  => MH.invokeBasic(a*) & checkcast(R)
 504          * if MT1 can be safely called by MT0[* := Object]
 505          *  => checkcast(A)* & MH.invokeBasic(a*) & checkcast(R)
 506          * if a big adapter BA can be pulled out of (MT0,MT1)
 507          *  => BA.invokeBasic(MT0,MH,a*)
 508          * if a local adapter LA can cached on static CS0 = new GICS(MT0)
 509          *  => CS0.LA.invokeBasic(MH,a*)
 510          * else
 511          *  => MH.asType(MT0).invokeBasic(A*)
 512          */
 513     }
 514 
 515     static MemberName linkToCallSiteMethod(MethodType mtype) {
 516         LambdaForm lform = callSiteForm(mtype, false);
 517         return lform.vmentry;
 518     }
 519 
 520     static MemberName linkToTargetMethod(MethodType mtype) {
 521         LambdaForm lform = callSiteForm(mtype, true);
 522         return lform.vmentry;
 523     }
 524 
 525     // skipCallSite is true if we are optimizing a ConstantCallSite
 526     static LambdaForm callSiteForm(MethodType mtype, boolean skipCallSite) {
 527         mtype = mtype.basicType();  // normalize Z to I, String to Object, etc.
 528         final int which = (skipCallSite ? MethodTypeForm.LF_MH_LINKER : MethodTypeForm.LF_CS_LINKER);


   1 /*
   2  * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 488     /** Static definition of MethodHandle.invokeGeneric checking code.
 489      * Directly returns the type-adjusted MH to invoke, as follows:
 490      * {@code (R)MH.invoke(a*) => MH.asType(TYPEOF(a*:R)).invokeBasic(a*)}
 491      */
 492     /*non-public*/ static
 493     @ForceInline
 494     MethodHandle checkGenericType(MethodHandle mh,  MethodType expected) {
 495         return mh.asType(expected);
 496         /* Maybe add more paths here.  Possible optimizations:
 497          * for (R)MH.invoke(a*),
 498          * let MT0 = TYPEOF(a*:R), MT1 = MH.type
 499          *
 500          * if MT0==MT1 or MT1 can be safely called by MT0
 501          *  => MH.invokeBasic(a*)
 502          * if MT1 can be safely called by MT0[R := Object]
 503          *  => MH.invokeBasic(a*) & checkcast(R)
 504          * if MT1 can be safely called by MT0[* := Object]
 505          *  => checkcast(A)* & MH.invokeBasic(a*) & checkcast(R)
 506          * if a big adapter BA can be pulled out of (MT0,MT1)
 507          *  => BA.invokeBasic(MT0,MH,a*)
 508          * if a local adapter LA can be cached on static CS0 = new GICS(MT0)
 509          *  => CS0.LA.invokeBasic(MH,a*)
 510          * else
 511          *  => MH.asType(MT0).invokeBasic(A*)
 512          */
 513     }
 514 
 515     static MemberName linkToCallSiteMethod(MethodType mtype) {
 516         LambdaForm lform = callSiteForm(mtype, false);
 517         return lform.vmentry;
 518     }
 519 
 520     static MemberName linkToTargetMethod(MethodType mtype) {
 521         LambdaForm lform = callSiteForm(mtype, true);
 522         return lform.vmentry;
 523     }
 524 
 525     // skipCallSite is true if we are optimizing a ConstantCallSite
 526     static LambdaForm callSiteForm(MethodType mtype, boolean skipCallSite) {
 527         mtype = mtype.basicType();  // normalize Z to I, String to Object, etc.
 528         final int which = (skipCallSite ? MethodTypeForm.LF_MH_LINKER : MethodTypeForm.LF_CS_LINKER);


< prev index next >