Mercurial > hg > truffle
comparison src/share/vm/oops/constantPoolOop.cpp @ 2011:dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
Reviewed-by: twisti
author | jrose |
---|---|
date | Fri, 03 Dec 2010 15:53:57 -0800 |
parents | f95d63e2154a |
children | 3582bf76420e |
comparison
equal
deleted
inserted
replaced
2010:7601ab0e1e33 | 2011:dad31fc330cd |
---|---|
913 | 913 |
914 case JVM_CONSTANT_MethodType: | 914 case JVM_CONSTANT_MethodType: |
915 { | 915 { |
916 int k1 = method_type_index_at(index1); | 916 int k1 = method_type_index_at(index1); |
917 int k2 = cp2->method_type_index_at(index2); | 917 int k2 = cp2->method_type_index_at(index2); |
918 if (k1 == k2) { | 918 bool match = compare_entry_to(k1, cp2, k2, CHECK_false); |
919 if (match) { | |
919 return true; | 920 return true; |
920 } | 921 } |
921 } break; | 922 } break; |
922 | 923 |
923 case JVM_CONSTANT_MethodHandle: | 924 case JVM_CONSTANT_MethodHandle: |
925 int k1 = method_handle_ref_kind_at(index1); | 926 int k1 = method_handle_ref_kind_at(index1); |
926 int k2 = cp2->method_handle_ref_kind_at(index2); | 927 int k2 = cp2->method_handle_ref_kind_at(index2); |
927 if (k1 == k2) { | 928 if (k1 == k2) { |
928 int i1 = method_handle_index_at(index1); | 929 int i1 = method_handle_index_at(index1); |
929 int i2 = cp2->method_handle_index_at(index2); | 930 int i2 = cp2->method_handle_index_at(index2); |
930 if (i1 == i2) { | 931 bool match = compare_entry_to(i1, cp2, i2, CHECK_false); |
932 if (match) { | |
931 return true; | 933 return true; |
932 } | 934 } |
933 } | 935 } |
934 } break; | 936 } break; |
935 | 937 |
936 case JVM_CONSTANT_InvokeDynamic: | 938 case JVM_CONSTANT_InvokeDynamic: |
937 { | 939 case JVM_CONSTANT_InvokeDynamicTrans: |
938 int op_count = multi_operand_count_at(index1); | 940 { |
939 if (op_count == cp2->multi_operand_count_at(index2)) { | 941 int k1 = invoke_dynamic_bootstrap_method_ref_index_at(index1); |
940 bool all_equal = true; | 942 int k2 = cp2->invoke_dynamic_bootstrap_method_ref_index_at(index2); |
941 for (int op_i = 0; op_i < op_count; op_i++) { | 943 bool match = compare_entry_to(k1, cp2, k2, CHECK_false); |
942 int k1 = multi_operand_ref_at(index1, op_i); | 944 if (!match) return false; |
943 int k2 = cp2->multi_operand_ref_at(index2, op_i); | 945 k1 = invoke_dynamic_name_and_type_ref_index_at(index1); |
944 if (k1 != k2) { | 946 k2 = cp2->invoke_dynamic_name_and_type_ref_index_at(index2); |
945 all_equal = false; | 947 match = compare_entry_to(k1, cp2, k2, CHECK_false); |
946 break; | 948 if (!match) return false; |
947 } | 949 int argc = invoke_dynamic_argument_count_at(index1); |
948 } | 950 if (argc == cp2->invoke_dynamic_argument_count_at(index2)) { |
949 if (all_equal) { | 951 for (int j = 0; j < argc; j++) { |
950 return true; // got through loop; all elements equal | 952 k1 = invoke_dynamic_argument_index_at(index1, j); |
951 } | 953 k2 = cp2->invoke_dynamic_argument_index_at(index2, j); |
954 match = compare_entry_to(k1, cp2, k2, CHECK_false); | |
955 if (!match) return false; | |
956 } | |
957 return true; // got through loop; all elements equal | |
952 } | 958 } |
953 } break; | 959 } break; |
954 | 960 |
955 case JVM_CONSTANT_UnresolvedString: | 961 case JVM_CONSTANT_UnresolvedString: |
956 { | 962 { |
982 | 988 |
983 return false; | 989 return false; |
984 } // end compare_entry_to() | 990 } // end compare_entry_to() |
985 | 991 |
986 | 992 |
987 // Grow this->operands() to the indicated length, unless it is already at least that long. | |
988 void constantPoolOopDesc::multi_operand_buffer_grow(int min_length, TRAPS) { | |
989 int old_length = multi_operand_buffer_fill_pointer(); | |
990 if (old_length >= min_length) return; | |
991 int new_length = min_length; | |
992 assert(new_length > _multi_operand_buffer_fill_pointer_offset, ""); | |
993 typeArrayHandle new_operands = oopFactory::new_permanent_intArray(new_length, CHECK); | |
994 if (operands() == NULL) { | |
995 new_operands->int_at_put(_multi_operand_buffer_fill_pointer_offset, old_length); | |
996 } else { | |
997 // copy fill pointer and everything else | |
998 for (int i = 0; i < old_length; i++) { | |
999 new_operands->int_at_put(i, operands()->int_at(i)); | |
1000 } | |
1001 } | |
1002 set_operands(new_operands()); | |
1003 } | |
1004 | |
1005 | |
1006 // Copy this constant pool's entries at start_i to end_i (inclusive) | 993 // Copy this constant pool's entries at start_i to end_i (inclusive) |
1007 // to the constant pool to_cp's entries starting at to_i. A total of | 994 // to the constant pool to_cp's entries starting at to_i. A total of |
1008 // (end_i - start_i) + 1 entries are copied. | 995 // (end_i - start_i) + 1 entries are copied. |
1009 void constantPoolOopDesc::copy_cp_to(int start_i, int end_i, | 996 void constantPoolOopDesc::copy_cp_to_impl(constantPoolHandle from_cp, int start_i, int end_i, |
1010 constantPoolHandle to_cp, int to_i, TRAPS) { | 997 constantPoolHandle to_cp, int to_i, TRAPS) { |
1011 | 998 |
1012 int dest_i = to_i; // leave original alone for debug purposes | 999 int dest_i = to_i; // leave original alone for debug purposes |
1013 | 1000 |
1014 if (operands() != NULL) { | |
1015 // pre-grow the target CP's operand buffer | |
1016 int nops = this->multi_operand_buffer_fill_pointer(); | |
1017 nops += to_cp->multi_operand_buffer_fill_pointer(); | |
1018 to_cp->multi_operand_buffer_grow(nops, CHECK); | |
1019 } | |
1020 | |
1021 for (int src_i = start_i; src_i <= end_i; /* see loop bottom */ ) { | 1001 for (int src_i = start_i; src_i <= end_i; /* see loop bottom */ ) { |
1022 copy_entry_to(src_i, to_cp, dest_i, CHECK); | 1002 copy_entry_to(from_cp, src_i, to_cp, dest_i, CHECK); |
1023 | 1003 |
1024 switch (tag_at(src_i).value()) { | 1004 switch (from_cp->tag_at(src_i).value()) { |
1025 case JVM_CONSTANT_Double: | 1005 case JVM_CONSTANT_Double: |
1026 case JVM_CONSTANT_Long: | 1006 case JVM_CONSTANT_Long: |
1027 // double and long take two constant pool entries | 1007 // double and long take two constant pool entries |
1028 src_i += 2; | 1008 src_i += 2; |
1029 dest_i += 2; | 1009 dest_i += 2; |
1034 src_i++; | 1014 src_i++; |
1035 dest_i++; | 1015 dest_i++; |
1036 break; | 1016 break; |
1037 } | 1017 } |
1038 } | 1018 } |
1019 | |
1020 int from_oplen = operand_array_length(from_cp->operands()); | |
1021 int old_oplen = operand_array_length(to_cp->operands()); | |
1022 if (from_oplen != 0) { | |
1023 // append my operands to the target's operands array | |
1024 if (old_oplen == 0) { | |
1025 to_cp->set_operands(from_cp->operands()); // reuse; do not merge | |
1026 } else { | |
1027 int old_len = to_cp->operands()->length(); | |
1028 int from_len = from_cp->operands()->length(); | |
1029 int old_off = old_oplen * sizeof(u2); | |
1030 int from_off = from_oplen * sizeof(u2); | |
1031 typeArrayHandle new_operands = oopFactory::new_permanent_shortArray(old_len + from_len, CHECK); | |
1032 int fillp = 0, len = 0; | |
1033 // first part of dest | |
1034 Copy::conjoint_memory_atomic(to_cp->operands()->short_at_addr(0), | |
1035 new_operands->short_at_addr(fillp), | |
1036 (len = old_off) * sizeof(u2)); | |
1037 fillp += len; | |
1038 // first part of src | |
1039 Copy::conjoint_memory_atomic(to_cp->operands()->short_at_addr(0), | |
1040 new_operands->short_at_addr(fillp), | |
1041 (len = from_off) * sizeof(u2)); | |
1042 fillp += len; | |
1043 // second part of dest | |
1044 Copy::conjoint_memory_atomic(to_cp->operands()->short_at_addr(old_off), | |
1045 new_operands->short_at_addr(fillp), | |
1046 (len = old_len - old_off) * sizeof(u2)); | |
1047 fillp += len; | |
1048 // second part of src | |
1049 Copy::conjoint_memory_atomic(to_cp->operands()->short_at_addr(from_off), | |
1050 new_operands->short_at_addr(fillp), | |
1051 (len = from_len - from_off) * sizeof(u2)); | |
1052 fillp += len; | |
1053 assert(fillp == new_operands->length(), ""); | |
1054 | |
1055 // Adjust indexes in the first part of the copied operands array. | |
1056 for (int j = 0; j < from_oplen; j++) { | |
1057 int offset = operand_offset_at(new_operands(), old_oplen + j); | |
1058 assert(offset == operand_offset_at(from_cp->operands(), j), "correct copy"); | |
1059 offset += old_len; // every new tuple is preceded by old_len extra u2's | |
1060 operand_offset_at_put(new_operands(), old_oplen + j, offset); | |
1061 } | |
1062 | |
1063 // replace target operands array with combined array | |
1064 to_cp->set_operands(new_operands()); | |
1065 } | |
1066 } | |
1067 | |
1039 } // end copy_cp_to() | 1068 } // end copy_cp_to() |
1040 | 1069 |
1041 | 1070 |
1042 // Copy this constant pool's entry at from_i to the constant pool | 1071 // Copy this constant pool's entry at from_i to the constant pool |
1043 // to_cp's entry at to_i. | 1072 // to_cp's entry at to_i. |
1044 void constantPoolOopDesc::copy_entry_to(int from_i, constantPoolHandle to_cp, | 1073 void constantPoolOopDesc::copy_entry_to(constantPoolHandle from_cp, int from_i, |
1045 int to_i, TRAPS) { | 1074 constantPoolHandle to_cp, int to_i, |
1046 | 1075 TRAPS) { |
1047 switch (tag_at(from_i).value()) { | 1076 |
1077 int tag = from_cp->tag_at(from_i).value(); | |
1078 switch (tag) { | |
1048 case JVM_CONSTANT_Class: | 1079 case JVM_CONSTANT_Class: |
1049 { | 1080 { |
1050 klassOop k = klass_at(from_i, CHECK); | 1081 klassOop k = from_cp->klass_at(from_i, CHECK); |
1051 to_cp->klass_at_put(to_i, k); | 1082 to_cp->klass_at_put(to_i, k); |
1052 } break; | 1083 } break; |
1053 | 1084 |
1054 case JVM_CONSTANT_ClassIndex: | 1085 case JVM_CONSTANT_ClassIndex: |
1055 { | 1086 { |
1056 jint ki = klass_index_at(from_i); | 1087 jint ki = from_cp->klass_index_at(from_i); |
1057 to_cp->klass_index_at_put(to_i, ki); | 1088 to_cp->klass_index_at_put(to_i, ki); |
1058 } break; | 1089 } break; |
1059 | 1090 |
1060 case JVM_CONSTANT_Double: | 1091 case JVM_CONSTANT_Double: |
1061 { | 1092 { |
1062 jdouble d = double_at(from_i); | 1093 jdouble d = from_cp->double_at(from_i); |
1063 to_cp->double_at_put(to_i, d); | 1094 to_cp->double_at_put(to_i, d); |
1064 // double takes two constant pool entries so init second entry's tag | 1095 // double takes two constant pool entries so init second entry's tag |
1065 to_cp->tag_at_put(to_i + 1, JVM_CONSTANT_Invalid); | 1096 to_cp->tag_at_put(to_i + 1, JVM_CONSTANT_Invalid); |
1066 } break; | 1097 } break; |
1067 | 1098 |
1068 case JVM_CONSTANT_Fieldref: | 1099 case JVM_CONSTANT_Fieldref: |
1069 { | 1100 { |
1070 int class_index = uncached_klass_ref_index_at(from_i); | 1101 int class_index = from_cp->uncached_klass_ref_index_at(from_i); |
1071 int name_and_type_index = uncached_name_and_type_ref_index_at(from_i); | 1102 int name_and_type_index = from_cp->uncached_name_and_type_ref_index_at(from_i); |
1072 to_cp->field_at_put(to_i, class_index, name_and_type_index); | 1103 to_cp->field_at_put(to_i, class_index, name_and_type_index); |
1073 } break; | 1104 } break; |
1074 | 1105 |
1075 case JVM_CONSTANT_Float: | 1106 case JVM_CONSTANT_Float: |
1076 { | 1107 { |
1077 jfloat f = float_at(from_i); | 1108 jfloat f = from_cp->float_at(from_i); |
1078 to_cp->float_at_put(to_i, f); | 1109 to_cp->float_at_put(to_i, f); |
1079 } break; | 1110 } break; |
1080 | 1111 |
1081 case JVM_CONSTANT_Integer: | 1112 case JVM_CONSTANT_Integer: |
1082 { | 1113 { |
1083 jint i = int_at(from_i); | 1114 jint i = from_cp->int_at(from_i); |
1084 to_cp->int_at_put(to_i, i); | 1115 to_cp->int_at_put(to_i, i); |
1085 } break; | 1116 } break; |
1086 | 1117 |
1087 case JVM_CONSTANT_InterfaceMethodref: | 1118 case JVM_CONSTANT_InterfaceMethodref: |
1088 { | 1119 { |
1089 int class_index = uncached_klass_ref_index_at(from_i); | 1120 int class_index = from_cp->uncached_klass_ref_index_at(from_i); |
1090 int name_and_type_index = uncached_name_and_type_ref_index_at(from_i); | 1121 int name_and_type_index = from_cp->uncached_name_and_type_ref_index_at(from_i); |
1091 to_cp->interface_method_at_put(to_i, class_index, name_and_type_index); | 1122 to_cp->interface_method_at_put(to_i, class_index, name_and_type_index); |
1092 } break; | 1123 } break; |
1093 | 1124 |
1094 case JVM_CONSTANT_Long: | 1125 case JVM_CONSTANT_Long: |
1095 { | 1126 { |
1096 jlong l = long_at(from_i); | 1127 jlong l = from_cp->long_at(from_i); |
1097 to_cp->long_at_put(to_i, l); | 1128 to_cp->long_at_put(to_i, l); |
1098 // long takes two constant pool entries so init second entry's tag | 1129 // long takes two constant pool entries so init second entry's tag |
1099 to_cp->tag_at_put(to_i + 1, JVM_CONSTANT_Invalid); | 1130 to_cp->tag_at_put(to_i + 1, JVM_CONSTANT_Invalid); |
1100 } break; | 1131 } break; |
1101 | 1132 |
1102 case JVM_CONSTANT_Methodref: | 1133 case JVM_CONSTANT_Methodref: |
1103 { | 1134 { |
1104 int class_index = uncached_klass_ref_index_at(from_i); | 1135 int class_index = from_cp->uncached_klass_ref_index_at(from_i); |
1105 int name_and_type_index = uncached_name_and_type_ref_index_at(from_i); | 1136 int name_and_type_index = from_cp->uncached_name_and_type_ref_index_at(from_i); |
1106 to_cp->method_at_put(to_i, class_index, name_and_type_index); | 1137 to_cp->method_at_put(to_i, class_index, name_and_type_index); |
1107 } break; | 1138 } break; |
1108 | 1139 |
1109 case JVM_CONSTANT_NameAndType: | 1140 case JVM_CONSTANT_NameAndType: |
1110 { | 1141 { |
1111 int name_ref_index = name_ref_index_at(from_i); | 1142 int name_ref_index = from_cp->name_ref_index_at(from_i); |
1112 int signature_ref_index = signature_ref_index_at(from_i); | 1143 int signature_ref_index = from_cp->signature_ref_index_at(from_i); |
1113 to_cp->name_and_type_at_put(to_i, name_ref_index, signature_ref_index); | 1144 to_cp->name_and_type_at_put(to_i, name_ref_index, signature_ref_index); |
1114 } break; | 1145 } break; |
1115 | 1146 |
1116 case JVM_CONSTANT_String: | 1147 case JVM_CONSTANT_String: |
1117 { | 1148 { |
1118 oop s = string_at(from_i, CHECK); | 1149 oop s = from_cp->string_at(from_i, CHECK); |
1119 to_cp->string_at_put(to_i, s); | 1150 to_cp->string_at_put(to_i, s); |
1120 } break; | 1151 } break; |
1121 | 1152 |
1122 case JVM_CONSTANT_StringIndex: | 1153 case JVM_CONSTANT_StringIndex: |
1123 { | 1154 { |
1124 jint si = string_index_at(from_i); | 1155 jint si = from_cp->string_index_at(from_i); |
1125 to_cp->string_index_at_put(to_i, si); | 1156 to_cp->string_index_at_put(to_i, si); |
1126 } break; | 1157 } break; |
1127 | 1158 |
1128 case JVM_CONSTANT_UnresolvedClass: | 1159 case JVM_CONSTANT_UnresolvedClass: |
1129 { | 1160 { |
1130 symbolOop k = unresolved_klass_at(from_i); | 1161 symbolOop k = from_cp->unresolved_klass_at(from_i); |
1131 to_cp->unresolved_klass_at_put(to_i, k); | 1162 to_cp->unresolved_klass_at_put(to_i, k); |
1132 } break; | 1163 } break; |
1133 | 1164 |
1134 case JVM_CONSTANT_UnresolvedClassInError: | 1165 case JVM_CONSTANT_UnresolvedClassInError: |
1135 { | 1166 { |
1136 symbolOop k = unresolved_klass_at(from_i); | 1167 symbolOop k = from_cp->unresolved_klass_at(from_i); |
1137 to_cp->unresolved_klass_at_put(to_i, k); | 1168 to_cp->unresolved_klass_at_put(to_i, k); |
1138 to_cp->tag_at_put(to_i, JVM_CONSTANT_UnresolvedClassInError); | 1169 to_cp->tag_at_put(to_i, JVM_CONSTANT_UnresolvedClassInError); |
1139 } break; | 1170 } break; |
1140 | 1171 |
1141 | 1172 |
1142 case JVM_CONSTANT_UnresolvedString: | 1173 case JVM_CONSTANT_UnresolvedString: |
1143 { | 1174 { |
1144 symbolOop s = unresolved_string_at(from_i); | 1175 symbolOop s = from_cp->unresolved_string_at(from_i); |
1145 to_cp->unresolved_string_at_put(to_i, s); | 1176 to_cp->unresolved_string_at_put(to_i, s); |
1146 } break; | 1177 } break; |
1147 | 1178 |
1148 case JVM_CONSTANT_Utf8: | 1179 case JVM_CONSTANT_Utf8: |
1149 { | 1180 { |
1150 symbolOop s = symbol_at(from_i); | 1181 symbolOop s = from_cp->symbol_at(from_i); |
1151 to_cp->symbol_at_put(to_i, s); | 1182 to_cp->symbol_at_put(to_i, s); |
1152 } break; | 1183 } break; |
1153 | 1184 |
1154 case JVM_CONSTANT_MethodType: | 1185 case JVM_CONSTANT_MethodType: |
1155 { | 1186 { |
1156 jint k = method_type_index_at(from_i); | 1187 jint k = from_cp->method_type_index_at(from_i); |
1157 to_cp->method_type_index_at_put(to_i, k); | 1188 to_cp->method_type_index_at_put(to_i, k); |
1158 } break; | 1189 } break; |
1159 | 1190 |
1160 case JVM_CONSTANT_MethodHandle: | 1191 case JVM_CONSTANT_MethodHandle: |
1161 { | 1192 { |
1162 int k1 = method_handle_ref_kind_at(from_i); | 1193 int k1 = from_cp->method_handle_ref_kind_at(from_i); |
1163 int k2 = method_handle_index_at(from_i); | 1194 int k2 = from_cp->method_handle_index_at(from_i); |
1164 to_cp->method_handle_index_at_put(to_i, k1, k2); | 1195 to_cp->method_handle_index_at_put(to_i, k1, k2); |
1165 } break; | 1196 } break; |
1166 | 1197 |
1198 case JVM_CONSTANT_InvokeDynamicTrans: | |
1199 { | |
1200 int k1 = from_cp->invoke_dynamic_bootstrap_method_ref_index_at(from_i); | |
1201 int k2 = from_cp->invoke_dynamic_name_and_type_ref_index_at(from_i); | |
1202 to_cp->invoke_dynamic_trans_at_put(to_i, k1, k2); | |
1203 } break; | |
1204 | |
1167 case JVM_CONSTANT_InvokeDynamic: | 1205 case JVM_CONSTANT_InvokeDynamic: |
1168 { | 1206 { |
1169 int op_count = multi_operand_count_at(from_i); | 1207 int k1 = from_cp->invoke_dynamic_bootstrap_specifier_index(from_i); |
1170 int fillp = to_cp->multi_operand_buffer_fill_pointer(); | 1208 int k2 = from_cp->invoke_dynamic_name_and_type_ref_index_at(from_i); |
1171 int to_op_base = fillp - _multi_operand_count_offset; // fillp is count offset; get to base | 1209 k1 += operand_array_length(to_cp->operands()); // to_cp might already have operands |
1172 to_cp->multi_operand_buffer_grow(to_op_base + op_count, CHECK); | 1210 to_cp->invoke_dynamic_at_put(to_i, k1, k2); |
1173 to_cp->operands()->int_at_put(fillp++, op_count); | |
1174 assert(fillp == to_op_base + _multi_operand_base_offset, "just wrote count, will now write args"); | |
1175 for (int op_i = 0; op_i < op_count; op_i++) { | |
1176 int op = multi_operand_ref_at(from_i, op_i); | |
1177 to_cp->operands()->int_at_put(fillp++, op); | |
1178 } | |
1179 assert(fillp <= to_cp->operands()->length(), "oob"); | |
1180 to_cp->set_multi_operand_buffer_fill_pointer(fillp); | |
1181 to_cp->invoke_dynamic_at_put(to_i, to_op_base, op_count); | |
1182 #ifdef ASSERT | |
1183 int k1 = invoke_dynamic_bootstrap_method_ref_index_at(from_i); | |
1184 int k2 = invoke_dynamic_name_and_type_ref_index_at(from_i); | |
1185 int k3 = invoke_dynamic_argument_count_at(from_i); | |
1186 assert(to_cp->check_invoke_dynamic_at(to_i, k1, k2, k3), | |
1187 "indy structure is OK"); | |
1188 #endif //ASSERT | |
1189 } break; | 1211 } break; |
1190 | 1212 |
1191 // Invalid is used as the tag for the second constant pool entry | 1213 // Invalid is used as the tag for the second constant pool entry |
1192 // occupied by JVM_CONSTANT_Double or JVM_CONSTANT_Long. It should | 1214 // occupied by JVM_CONSTANT_Double or JVM_CONSTANT_Long. It should |
1193 // not be seen by itself. | 1215 // not be seen by itself. |
1194 case JVM_CONSTANT_Invalid: // fall through | 1216 case JVM_CONSTANT_Invalid: // fall through |
1195 | 1217 |
1196 default: | 1218 default: |
1197 { | 1219 { |
1198 jbyte bad_value = tag_at(from_i).value(); // leave a breadcrumb | |
1199 ShouldNotReachHere(); | 1220 ShouldNotReachHere(); |
1200 } break; | 1221 } break; |
1201 } | 1222 } |
1202 } // end copy_entry_to() | 1223 } // end copy_entry_to() |
1203 | 1224 |
1404 case JVM_CONSTANT_InterfaceMethodref: | 1425 case JVM_CONSTANT_InterfaceMethodref: |
1405 case JVM_CONSTANT_NameAndType: | 1426 case JVM_CONSTANT_NameAndType: |
1406 return 5; | 1427 return 5; |
1407 | 1428 |
1408 case JVM_CONSTANT_InvokeDynamic: | 1429 case JVM_CONSTANT_InvokeDynamic: |
1409 // u1 tag, u2 bsm, u2 nt, u2 argc, u2 argv[argc] | 1430 case JVM_CONSTANT_InvokeDynamicTrans: |
1410 return 7 + 2 * invoke_dynamic_argument_count_at(idx); | 1431 // u1 tag, u2 bsm, u2 nt |
1432 return 5; | |
1411 | 1433 |
1412 case JVM_CONSTANT_Long: | 1434 case JVM_CONSTANT_Long: |
1413 case JVM_CONSTANT_Double: | 1435 case JVM_CONSTANT_Double: |
1414 return 9; | 1436 return 9; |
1415 } | 1437 } |
1618 idx1 = method_type_index_at(idx); | 1640 idx1 = method_type_index_at(idx); |
1619 Bytes::put_Java_u2((address) (bytes+1), idx1); | 1641 Bytes::put_Java_u2((address) (bytes+1), idx1); |
1620 DBG(printf("JVM_CONSTANT_MethodType: %hd", idx1)); | 1642 DBG(printf("JVM_CONSTANT_MethodType: %hd", idx1)); |
1621 break; | 1643 break; |
1622 } | 1644 } |
1645 case JVM_CONSTANT_InvokeDynamicTrans: | |
1623 case JVM_CONSTANT_InvokeDynamic: { | 1646 case JVM_CONSTANT_InvokeDynamic: { |
1624 *bytes = JVM_CONSTANT_InvokeDynamic; | 1647 *bytes = tag; |
1625 idx1 = invoke_dynamic_bootstrap_method_ref_index_at(idx); | 1648 idx1 = extract_low_short_from_int(*int_at_addr(idx)); |
1626 idx2 = invoke_dynamic_name_and_type_ref_index_at(idx); | 1649 idx2 = extract_high_short_from_int(*int_at_addr(idx)); |
1627 int argc = invoke_dynamic_argument_count_at(idx); | 1650 assert(idx2 == invoke_dynamic_name_and_type_ref_index_at(idx), "correct half of u4"); |
1628 Bytes::put_Java_u2((address) (bytes+1), idx1); | 1651 Bytes::put_Java_u2((address) (bytes+1), idx1); |
1629 Bytes::put_Java_u2((address) (bytes+3), idx2); | 1652 Bytes::put_Java_u2((address) (bytes+3), idx2); |
1630 Bytes::put_Java_u2((address) (bytes+5), argc); | 1653 DBG(printf("JVM_CONSTANT_InvokeDynamic: %hd %hd", idx1, idx2)); |
1631 for (int arg_i = 0; arg_i < argc; arg_i++) { | |
1632 int arg = invoke_dynamic_argument_index_at(idx, arg_i); | |
1633 Bytes::put_Java_u2((address) (bytes+7+2*arg_i), arg); | |
1634 } | |
1635 DBG(printf("JVM_CONSTANT_InvokeDynamic: %hd %hd [%d]", idx1, idx2, argc)); | |
1636 break; | 1654 break; |
1637 } | 1655 } |
1638 } | 1656 } |
1639 DBG(printf("\n")); | 1657 DBG(printf("\n")); |
1640 bytes += ent_size; | 1658 bytes += ent_size; |