924 if (argc <= 1) { |
924 if (argc <= 1) { |
925 if (argc == 1 && !canConvert(srcTypes[0], dstTypes[0])) |
925 if (argc == 1 && !canConvert(srcTypes[0], dstTypes[0])) |
926 return false; |
926 return false; |
927 return true; |
927 return true; |
928 } |
928 } |
929 if ((oldForm.primitiveParameterCount() == 0 && oldForm.erasedType == this) || |
929 if ((!oldForm.hasPrimitives() && oldForm.erasedType == this) || |
930 (newForm.primitiveParameterCount() == 0 && newForm.erasedType == newType)) { |
930 (!newForm.hasPrimitives() && newForm.erasedType == newType)) { |
931 // Somewhat complicated test to avoid a loop of 2 or more trips. |
931 // Somewhat complicated test to avoid a loop of 2 or more trips. |
932 // If either type has only Object parameters, we know we can convert. |
932 // If either type has only Object parameters, we know we can convert. |
933 assert(canConvertParameters(srcTypes, dstTypes)); |
933 assert(canConvertParameters(srcTypes, dstTypes)); |
934 return true; |
934 return true; |
935 } |
935 } |
1069 /*non-public*/ Invokers invokers() { |
1069 /*non-public*/ Invokers invokers() { |
1070 Invokers inv = invokers; |
1070 Invokers inv = invokers; |
1071 if (inv != null) return inv; |
1071 if (inv != null) return inv; |
1072 invokers = inv = new Invokers(this); |
1072 invokers = inv = new Invokers(this); |
1073 return inv; |
1073 return inv; |
1074 } |
|
1075 |
|
1076 /** Reports the number of JVM stack slots which carry all parameters including and after |
|
1077 * the given position, which must be in the range of 0 to |
|
1078 * {@code parameterCount} inclusive. Successive parameters are |
|
1079 * more shallowly stacked, and parameters are indexed in the bytecodes |
|
1080 * according to their trailing edge. Thus, to obtain the depth |
|
1081 * in the outgoing call stack of parameter {@code N}, obtain |
|
1082 * the {@code parameterSlotDepth} of its trailing edge |
|
1083 * at position {@code N+1}. |
|
1084 * <p> |
|
1085 * Parameters of type {@code long} and {@code double} occupy |
|
1086 * two stack slots (for historical reasons) and all others occupy one. |
|
1087 * Therefore, the number returned is the number of arguments |
|
1088 * <em>including</em> and <em>after</em> the given parameter, |
|
1089 * <em>plus</em> the number of long or double arguments |
|
1090 * at or after the argument for the given parameter. |
|
1091 * <p> |
|
1092 * This method is included for the benefit of applications that must |
|
1093 * generate bytecodes that process method handles and invokedynamic. |
|
1094 * @param num an index (zero-based, inclusive) within the parameter types |
|
1095 * @return the index of the (shallowest) JVM stack slot transmitting the |
|
1096 * given parameter |
|
1097 * @throws IllegalArgumentException if {@code num} is negative or greater than {@code parameterCount()} |
|
1098 */ |
|
1099 /*non-public*/ int parameterSlotDepth(int num) { |
|
1100 if (num < 0 || num > ptypes.length) |
|
1101 parameterType(num); // force a range check |
|
1102 return form.parameterToArgSlot(num-1); |
|
1103 } |
|
1104 |
|
1105 /** Reports the number of JVM stack slots required to receive a return value |
|
1106 * from a method of this type. |
|
1107 * If the {@link #returnType() return type} is void, it will be zero, |
|
1108 * else if the return type is long or double, it will be two, else one. |
|
1109 * <p> |
|
1110 * This method is included for the benefit of applications that must |
|
1111 * generate bytecodes that process method handles and invokedynamic. |
|
1112 * @return the number of JVM stack slots (0, 1, or 2) for this type's return value |
|
1113 * Will be removed for PFD. |
|
1114 */ |
|
1115 /*non-public*/ int returnSlotCount() { |
|
1116 return form.returnSlotCount(); |
|
1117 } |
1074 } |
1118 |
1075 |
1119 /** |
1076 /** |
1120 * Finds or creates an instance of a method type, given the spelling of its bytecode descriptor. |
1077 * Finds or creates an instance of a method type, given the spelling of its bytecode descriptor. |
1121 * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}. |
1078 * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}. |