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

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

Print this page
rev 7928 : imported patch stable


  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
  23  * questions.
  24  */
  25 
  26 package java.lang.invoke;
  27 
  28 import sun.invoke.util.Wrapper;
  29 import static java.lang.invoke.MethodHandleStatics.*;
  30 import static java.lang.invoke.MethodHandleNatives.Constants.*;

  31 
  32 /**
  33  * Shared information for a group of method types, which differ
  34  * only by reference types, and therefore share a common erasure
  35  * and wrapping.
  36  * <p>
  37  * For an empirical discussion of the structure of method types,
  38  * see <a href="http://groups.google.com/group/jvm-languages/browse_thread/thread/ac9308ae74da9b7e/">
  39  * the thread "Avoiding Boxing" on jvm-languages</a>.
  40  * There are approximately 2000 distinct erased method types in the JDK.
  41  * There are a little over 10 times that number of unerased types.
  42  * No more than half of these are likely to be loaded at once.
  43  * @author John Rose
  44  */
  45 final class MethodTypeForm {
  46     final int[] argToSlotTable, slotToArgTable;
  47     final long argCounts;               // packed slot & value counts
  48     final long primCounts;              // packed prim & double counts
  49     final int vmslots;                  // total number of parameter slots
  50     final MethodType erasedType;        // the canonical erasure
  51     final MethodType basicType;         // the canonical erasure, with primitives simplified
  52 
  53     // Cached adapter information:
  54     /*lazy*/ MethodHandle genericInvoker; // JVM hook for inexact invoke
  55     /*lazy*/ MethodHandle basicInvoker;   // cached instance of MH.invokeBasic
  56     /*lazy*/ MethodHandle namedFunctionInvoker; // cached helper for LF.NamedFunction

  57 
  58     // Cached lambda form information, for basic types only:
  59     final LambdaForm[] lambdaForms;
  60     // Indexes into lambdaForms:
  61     static final int
  62             LF_INVVIRTUAL     =  0,  // DMH invokeVirtual
  63             LF_INVSTATIC      =  1,
  64             LF_INVSPECIAL     =  2,
  65             LF_NEWINVSPECIAL  =  3,
  66             LF_INVINTERFACE   =  4,
  67             LF_INVSTATIC_INIT =  5,  // DMH invokeStatic with <clinit> barrier
  68             LF_INTERPRET      =  6,  // LF interpreter
  69             LF_COUNTER        =  7,  // CMH wrapper
  70             LF_REINVOKE       =  8,  // other wrapper
  71             LF_EX_LINKER      =  9,  // invokeExact_MT
  72             LF_EX_INVOKER     = 10,  // invokeExact MH
  73             LF_GEN_LINKER     = 11,
  74             LF_GEN_INVOKER    = 12,
  75             LF_CS_LINKER      = 13,  // linkToCallSite_CS
  76             LF_LIMIT          = 14;
  77 
  78     public MethodType erasedType() {
  79         return erasedType;




  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
  23  * questions.
  24  */
  25 
  26 package java.lang.invoke;
  27 
  28 import sun.invoke.util.Wrapper;
  29 import static java.lang.invoke.MethodHandleStatics.*;
  30 import static java.lang.invoke.MethodHandleNatives.Constants.*;
  31 import sun.invoke.Stable;
  32 
  33 /**
  34  * Shared information for a group of method types, which differ
  35  * only by reference types, and therefore share a common erasure
  36  * and wrapping.
  37  * <p>
  38  * For an empirical discussion of the structure of method types,
  39  * see <a href="http://groups.google.com/group/jvm-languages/browse_thread/thread/ac9308ae74da9b7e/">
  40  * the thread "Avoiding Boxing" on jvm-languages</a>.
  41  * There are approximately 2000 distinct erased method types in the JDK.
  42  * There are a little over 10 times that number of unerased types.
  43  * No more than half of these are likely to be loaded at once.
  44  * @author John Rose
  45  */
  46 final class MethodTypeForm {
  47     final int[] argToSlotTable, slotToArgTable;
  48     final long argCounts;               // packed slot & value counts
  49     final long primCounts;              // packed prim & double counts
  50     final int vmslots;                  // total number of parameter slots
  51     final MethodType erasedType;        // the canonical erasure
  52     final MethodType basicType;         // the canonical erasure, with primitives simplified
  53 
  54     // Cached adapter information:
  55     @Stable String typeString;           // argument type signature characters
  56     @Stable MethodHandle genericInvoker; // JVM hook for inexact invoke
  57     @Stable MethodHandle basicInvoker;   // cached instance of MH.invokeBasic
  58     @Stable MethodHandle namedFunctionInvoker; // cached helper for LF.NamedFunction
  59 
  60     // Cached lambda form information, for basic types only:
  61     final @Stable LambdaForm[] lambdaForms;
  62     // Indexes into lambdaForms:
  63     static final int
  64             LF_INVVIRTUAL     =  0,  // DMH invokeVirtual
  65             LF_INVSTATIC      =  1,
  66             LF_INVSPECIAL     =  2,
  67             LF_NEWINVSPECIAL  =  3,
  68             LF_INVINTERFACE   =  4,
  69             LF_INVSTATIC_INIT =  5,  // DMH invokeStatic with <clinit> barrier
  70             LF_INTERPRET      =  6,  // LF interpreter
  71             LF_COUNTER        =  7,  // CMH wrapper
  72             LF_REINVOKE       =  8,  // other wrapper
  73             LF_EX_LINKER      =  9,  // invokeExact_MT
  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_LIMIT          = 14;
  79 
  80     public MethodType erasedType() {
  81         return erasedType;


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