Mercurial > hg > graal-jvmci-8
comparison src/share/vm/oops/constantPoolOop.cpp @ 2044:06f017f7daa7
Merge.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Fri, 07 Jan 2011 18:18:08 +0100 |
parents | dad31fc330cd |
children | 3582bf76420e |
comparison
equal
deleted
inserted
replaced
1942:00bc9eaf0e24 | 2044:06f017f7daa7 |
---|---|
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
25 # include "incls/_precompiled.incl" | 25 #include "precompiled.hpp" |
26 # include "incls/_constantPoolOop.cpp.incl" | 26 #include "classfile/javaClasses.hpp" |
27 #include "classfile/symbolTable.hpp" | |
28 #include "classfile/systemDictionary.hpp" | |
29 #include "classfile/vmSymbols.hpp" | |
30 #include "interpreter/linkResolver.hpp" | |
31 #include "memory/oopFactory.hpp" | |
32 #include "memory/universe.inline.hpp" | |
33 #include "oops/constantPoolOop.hpp" | |
34 #include "oops/instanceKlass.hpp" | |
35 #include "oops/objArrayKlass.hpp" | |
36 #include "oops/oop.inline.hpp" | |
37 #include "runtime/fieldType.hpp" | |
38 #include "runtime/init.hpp" | |
39 #include "runtime/signature.hpp" | |
40 #include "runtime/vframe.hpp" | |
27 | 41 |
28 void constantPoolOopDesc::set_flag_at(FlagBit fb) { | 42 void constantPoolOopDesc::set_flag_at(FlagBit fb) { |
29 const int MAX_STATE_CHANGES = 2; | 43 const int MAX_STATE_CHANGES = 2; |
30 for (int i = MAX_STATE_CHANGES + 10; i > 0; i--) { | 44 for (int i = MAX_STATE_CHANGES + 10; i > 0; i--) { |
31 int oflags = _flags; | 45 int oflags = _flags; |
899 | 913 |
900 case JVM_CONSTANT_MethodType: | 914 case JVM_CONSTANT_MethodType: |
901 { | 915 { |
902 int k1 = method_type_index_at(index1); | 916 int k1 = method_type_index_at(index1); |
903 int k2 = cp2->method_type_index_at(index2); | 917 int k2 = cp2->method_type_index_at(index2); |
904 if (k1 == k2) { | 918 bool match = compare_entry_to(k1, cp2, k2, CHECK_false); |
919 if (match) { | |
905 return true; | 920 return true; |
906 } | 921 } |
907 } break; | 922 } break; |
908 | 923 |
909 case JVM_CONSTANT_MethodHandle: | 924 case JVM_CONSTANT_MethodHandle: |
911 int k1 = method_handle_ref_kind_at(index1); | 926 int k1 = method_handle_ref_kind_at(index1); |
912 int k2 = cp2->method_handle_ref_kind_at(index2); | 927 int k2 = cp2->method_handle_ref_kind_at(index2); |
913 if (k1 == k2) { | 928 if (k1 == k2) { |
914 int i1 = method_handle_index_at(index1); | 929 int i1 = method_handle_index_at(index1); |
915 int i2 = cp2->method_handle_index_at(index2); | 930 int i2 = cp2->method_handle_index_at(index2); |
916 if (i1 == i2) { | 931 bool match = compare_entry_to(i1, cp2, i2, CHECK_false); |
932 if (match) { | |
917 return true; | 933 return true; |
918 } | 934 } |
919 } | 935 } |
920 } break; | 936 } break; |
921 | 937 |
922 case JVM_CONSTANT_InvokeDynamic: | 938 case JVM_CONSTANT_InvokeDynamic: |
923 { | 939 case JVM_CONSTANT_InvokeDynamicTrans: |
924 int op_count = multi_operand_count_at(index1); | 940 { |
925 if (op_count == cp2->multi_operand_count_at(index2)) { | 941 int k1 = invoke_dynamic_bootstrap_method_ref_index_at(index1); |
926 bool all_equal = true; | 942 int k2 = cp2->invoke_dynamic_bootstrap_method_ref_index_at(index2); |
927 for (int op_i = 0; op_i < op_count; op_i++) { | 943 bool match = compare_entry_to(k1, cp2, k2, CHECK_false); |
928 int k1 = multi_operand_ref_at(index1, op_i); | 944 if (!match) return false; |
929 int k2 = cp2->multi_operand_ref_at(index2, op_i); | 945 k1 = invoke_dynamic_name_and_type_ref_index_at(index1); |
930 if (k1 != k2) { | 946 k2 = cp2->invoke_dynamic_name_and_type_ref_index_at(index2); |
931 all_equal = false; | 947 match = compare_entry_to(k1, cp2, k2, CHECK_false); |
932 break; | 948 if (!match) return false; |
933 } | 949 int argc = invoke_dynamic_argument_count_at(index1); |
934 } | 950 if (argc == cp2->invoke_dynamic_argument_count_at(index2)) { |
935 if (all_equal) { | 951 for (int j = 0; j < argc; j++) { |
936 return true; // got through loop; all elements equal | 952 k1 = invoke_dynamic_argument_index_at(index1, j); |
937 } | 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 | |
938 } | 958 } |
939 } break; | 959 } break; |
940 | 960 |
941 case JVM_CONSTANT_UnresolvedString: | 961 case JVM_CONSTANT_UnresolvedString: |
942 { | 962 { |
968 | 988 |
969 return false; | 989 return false; |
970 } // end compare_entry_to() | 990 } // end compare_entry_to() |
971 | 991 |
972 | 992 |
973 // Grow this->operands() to the indicated length, unless it is already at least that long. | |
974 void constantPoolOopDesc::multi_operand_buffer_grow(int min_length, TRAPS) { | |
975 int old_length = multi_operand_buffer_fill_pointer(); | |
976 if (old_length >= min_length) return; | |
977 int new_length = min_length; | |
978 assert(new_length > _multi_operand_buffer_fill_pointer_offset, ""); | |
979 typeArrayHandle new_operands = oopFactory::new_permanent_intArray(new_length, CHECK); | |
980 if (operands() == NULL) { | |
981 new_operands->int_at_put(_multi_operand_buffer_fill_pointer_offset, old_length); | |
982 } else { | |
983 // copy fill pointer and everything else | |
984 for (int i = 0; i < old_length; i++) { | |
985 new_operands->int_at_put(i, operands()->int_at(i)); | |
986 } | |
987 } | |
988 set_operands(new_operands()); | |
989 } | |
990 | |
991 | |
992 // 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) |
993 // 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 |
994 // (end_i - start_i) + 1 entries are copied. | 995 // (end_i - start_i) + 1 entries are copied. |
995 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, |
996 constantPoolHandle to_cp, int to_i, TRAPS) { | 997 constantPoolHandle to_cp, int to_i, TRAPS) { |
997 | 998 |
998 int dest_i = to_i; // leave original alone for debug purposes | 999 int dest_i = to_i; // leave original alone for debug purposes |
999 | 1000 |
1000 if (operands() != NULL) { | |
1001 // pre-grow the target CP's operand buffer | |
1002 int nops = this->multi_operand_buffer_fill_pointer(); | |
1003 nops += to_cp->multi_operand_buffer_fill_pointer(); | |
1004 to_cp->multi_operand_buffer_grow(nops, CHECK); | |
1005 } | |
1006 | |
1007 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 */ ) { |
1008 copy_entry_to(src_i, to_cp, dest_i, CHECK); | 1002 copy_entry_to(from_cp, src_i, to_cp, dest_i, CHECK); |
1009 | 1003 |
1010 switch (tag_at(src_i).value()) { | 1004 switch (from_cp->tag_at(src_i).value()) { |
1011 case JVM_CONSTANT_Double: | 1005 case JVM_CONSTANT_Double: |
1012 case JVM_CONSTANT_Long: | 1006 case JVM_CONSTANT_Long: |
1013 // double and long take two constant pool entries | 1007 // double and long take two constant pool entries |
1014 src_i += 2; | 1008 src_i += 2; |
1015 dest_i += 2; | 1009 dest_i += 2; |
1020 src_i++; | 1014 src_i++; |
1021 dest_i++; | 1015 dest_i++; |
1022 break; | 1016 break; |
1023 } | 1017 } |
1024 } | 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 | |
1025 } // end copy_cp_to() | 1068 } // end copy_cp_to() |
1026 | 1069 |
1027 | 1070 |
1028 // 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 |
1029 // to_cp's entry at to_i. | 1072 // to_cp's entry at to_i. |
1030 void constantPoolOopDesc::copy_entry_to(int from_i, constantPoolHandle to_cp, | 1073 void constantPoolOopDesc::copy_entry_to(constantPoolHandle from_cp, int from_i, |
1031 int to_i, TRAPS) { | 1074 constantPoolHandle to_cp, int to_i, |
1032 | 1075 TRAPS) { |
1033 switch (tag_at(from_i).value()) { | 1076 |
1077 int tag = from_cp->tag_at(from_i).value(); | |
1078 switch (tag) { | |
1034 case JVM_CONSTANT_Class: | 1079 case JVM_CONSTANT_Class: |
1035 { | 1080 { |
1036 klassOop k = klass_at(from_i, CHECK); | 1081 klassOop k = from_cp->klass_at(from_i, CHECK); |
1037 to_cp->klass_at_put(to_i, k); | 1082 to_cp->klass_at_put(to_i, k); |
1038 } break; | 1083 } break; |
1039 | 1084 |
1040 case JVM_CONSTANT_ClassIndex: | 1085 case JVM_CONSTANT_ClassIndex: |
1041 { | 1086 { |
1042 jint ki = klass_index_at(from_i); | 1087 jint ki = from_cp->klass_index_at(from_i); |
1043 to_cp->klass_index_at_put(to_i, ki); | 1088 to_cp->klass_index_at_put(to_i, ki); |
1044 } break; | 1089 } break; |
1045 | 1090 |
1046 case JVM_CONSTANT_Double: | 1091 case JVM_CONSTANT_Double: |
1047 { | 1092 { |
1048 jdouble d = double_at(from_i); | 1093 jdouble d = from_cp->double_at(from_i); |
1049 to_cp->double_at_put(to_i, d); | 1094 to_cp->double_at_put(to_i, d); |
1050 // 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 |
1051 to_cp->tag_at_put(to_i + 1, JVM_CONSTANT_Invalid); | 1096 to_cp->tag_at_put(to_i + 1, JVM_CONSTANT_Invalid); |
1052 } break; | 1097 } break; |
1053 | 1098 |
1054 case JVM_CONSTANT_Fieldref: | 1099 case JVM_CONSTANT_Fieldref: |
1055 { | 1100 { |
1056 int class_index = uncached_klass_ref_index_at(from_i); | 1101 int class_index = from_cp->uncached_klass_ref_index_at(from_i); |
1057 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); |
1058 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); |
1059 } break; | 1104 } break; |
1060 | 1105 |
1061 case JVM_CONSTANT_Float: | 1106 case JVM_CONSTANT_Float: |
1062 { | 1107 { |
1063 jfloat f = float_at(from_i); | 1108 jfloat f = from_cp->float_at(from_i); |
1064 to_cp->float_at_put(to_i, f); | 1109 to_cp->float_at_put(to_i, f); |
1065 } break; | 1110 } break; |
1066 | 1111 |
1067 case JVM_CONSTANT_Integer: | 1112 case JVM_CONSTANT_Integer: |
1068 { | 1113 { |
1069 jint i = int_at(from_i); | 1114 jint i = from_cp->int_at(from_i); |
1070 to_cp->int_at_put(to_i, i); | 1115 to_cp->int_at_put(to_i, i); |
1071 } break; | 1116 } break; |
1072 | 1117 |
1073 case JVM_CONSTANT_InterfaceMethodref: | 1118 case JVM_CONSTANT_InterfaceMethodref: |
1074 { | 1119 { |
1075 int class_index = uncached_klass_ref_index_at(from_i); | 1120 int class_index = from_cp->uncached_klass_ref_index_at(from_i); |
1076 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); |
1077 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); |
1078 } break; | 1123 } break; |
1079 | 1124 |
1080 case JVM_CONSTANT_Long: | 1125 case JVM_CONSTANT_Long: |
1081 { | 1126 { |
1082 jlong l = long_at(from_i); | 1127 jlong l = from_cp->long_at(from_i); |
1083 to_cp->long_at_put(to_i, l); | 1128 to_cp->long_at_put(to_i, l); |
1084 // 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 |
1085 to_cp->tag_at_put(to_i + 1, JVM_CONSTANT_Invalid); | 1130 to_cp->tag_at_put(to_i + 1, JVM_CONSTANT_Invalid); |
1086 } break; | 1131 } break; |
1087 | 1132 |
1088 case JVM_CONSTANT_Methodref: | 1133 case JVM_CONSTANT_Methodref: |
1089 { | 1134 { |
1090 int class_index = uncached_klass_ref_index_at(from_i); | 1135 int class_index = from_cp->uncached_klass_ref_index_at(from_i); |
1091 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); |
1092 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); |
1093 } break; | 1138 } break; |
1094 | 1139 |
1095 case JVM_CONSTANT_NameAndType: | 1140 case JVM_CONSTANT_NameAndType: |
1096 { | 1141 { |
1097 int name_ref_index = name_ref_index_at(from_i); | 1142 int name_ref_index = from_cp->name_ref_index_at(from_i); |
1098 int signature_ref_index = signature_ref_index_at(from_i); | 1143 int signature_ref_index = from_cp->signature_ref_index_at(from_i); |
1099 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); |
1100 } break; | 1145 } break; |
1101 | 1146 |
1102 case JVM_CONSTANT_String: | 1147 case JVM_CONSTANT_String: |
1103 { | 1148 { |
1104 oop s = string_at(from_i, CHECK); | 1149 oop s = from_cp->string_at(from_i, CHECK); |
1105 to_cp->string_at_put(to_i, s); | 1150 to_cp->string_at_put(to_i, s); |
1106 } break; | 1151 } break; |
1107 | 1152 |
1108 case JVM_CONSTANT_StringIndex: | 1153 case JVM_CONSTANT_StringIndex: |
1109 { | 1154 { |
1110 jint si = string_index_at(from_i); | 1155 jint si = from_cp->string_index_at(from_i); |
1111 to_cp->string_index_at_put(to_i, si); | 1156 to_cp->string_index_at_put(to_i, si); |
1112 } break; | 1157 } break; |
1113 | 1158 |
1114 case JVM_CONSTANT_UnresolvedClass: | 1159 case JVM_CONSTANT_UnresolvedClass: |
1115 { | 1160 { |
1116 symbolOop k = unresolved_klass_at(from_i); | 1161 symbolOop k = from_cp->unresolved_klass_at(from_i); |
1117 to_cp->unresolved_klass_at_put(to_i, k); | 1162 to_cp->unresolved_klass_at_put(to_i, k); |
1118 } break; | 1163 } break; |
1119 | 1164 |
1120 case JVM_CONSTANT_UnresolvedClassInError: | 1165 case JVM_CONSTANT_UnresolvedClassInError: |
1121 { | 1166 { |
1122 symbolOop k = unresolved_klass_at(from_i); | 1167 symbolOop k = from_cp->unresolved_klass_at(from_i); |
1123 to_cp->unresolved_klass_at_put(to_i, k); | 1168 to_cp->unresolved_klass_at_put(to_i, k); |
1124 to_cp->tag_at_put(to_i, JVM_CONSTANT_UnresolvedClassInError); | 1169 to_cp->tag_at_put(to_i, JVM_CONSTANT_UnresolvedClassInError); |
1125 } break; | 1170 } break; |
1126 | 1171 |
1127 | 1172 |
1128 case JVM_CONSTANT_UnresolvedString: | 1173 case JVM_CONSTANT_UnresolvedString: |
1129 { | 1174 { |
1130 symbolOop s = unresolved_string_at(from_i); | 1175 symbolOop s = from_cp->unresolved_string_at(from_i); |
1131 to_cp->unresolved_string_at_put(to_i, s); | 1176 to_cp->unresolved_string_at_put(to_i, s); |
1132 } break; | 1177 } break; |
1133 | 1178 |
1134 case JVM_CONSTANT_Utf8: | 1179 case JVM_CONSTANT_Utf8: |
1135 { | 1180 { |
1136 symbolOop s = symbol_at(from_i); | 1181 symbolOop s = from_cp->symbol_at(from_i); |
1137 to_cp->symbol_at_put(to_i, s); | 1182 to_cp->symbol_at_put(to_i, s); |
1138 } break; | 1183 } break; |
1139 | 1184 |
1140 case JVM_CONSTANT_MethodType: | 1185 case JVM_CONSTANT_MethodType: |
1141 { | 1186 { |
1142 jint k = method_type_index_at(from_i); | 1187 jint k = from_cp->method_type_index_at(from_i); |
1143 to_cp->method_type_index_at_put(to_i, k); | 1188 to_cp->method_type_index_at_put(to_i, k); |
1144 } break; | 1189 } break; |
1145 | 1190 |
1146 case JVM_CONSTANT_MethodHandle: | 1191 case JVM_CONSTANT_MethodHandle: |
1147 { | 1192 { |
1148 int k1 = method_handle_ref_kind_at(from_i); | 1193 int k1 = from_cp->method_handle_ref_kind_at(from_i); |
1149 int k2 = method_handle_index_at(from_i); | 1194 int k2 = from_cp->method_handle_index_at(from_i); |
1150 to_cp->method_handle_index_at_put(to_i, k1, k2); | 1195 to_cp->method_handle_index_at_put(to_i, k1, k2); |
1151 } break; | 1196 } break; |
1152 | 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 | |
1153 case JVM_CONSTANT_InvokeDynamic: | 1205 case JVM_CONSTANT_InvokeDynamic: |
1154 { | 1206 { |
1155 int op_count = multi_operand_count_at(from_i); | 1207 int k1 = from_cp->invoke_dynamic_bootstrap_specifier_index(from_i); |
1156 int fillp = to_cp->multi_operand_buffer_fill_pointer(); | 1208 int k2 = from_cp->invoke_dynamic_name_and_type_ref_index_at(from_i); |
1157 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 |
1158 to_cp->multi_operand_buffer_grow(to_op_base + op_count, CHECK); | 1210 to_cp->invoke_dynamic_at_put(to_i, k1, k2); |
1159 to_cp->operands()->int_at_put(fillp++, op_count); | |
1160 assert(fillp == to_op_base + _multi_operand_base_offset, "just wrote count, will now write args"); | |
1161 for (int op_i = 0; op_i < op_count; op_i++) { | |
1162 int op = multi_operand_ref_at(from_i, op_i); | |
1163 to_cp->operands()->int_at_put(fillp++, op); | |
1164 } | |
1165 assert(fillp <= to_cp->operands()->length(), "oob"); | |
1166 to_cp->set_multi_operand_buffer_fill_pointer(fillp); | |
1167 to_cp->invoke_dynamic_at_put(to_i, to_op_base, op_count); | |
1168 #ifdef ASSERT | |
1169 int k1 = invoke_dynamic_bootstrap_method_ref_index_at(from_i); | |
1170 int k2 = invoke_dynamic_name_and_type_ref_index_at(from_i); | |
1171 int k3 = invoke_dynamic_argument_count_at(from_i); | |
1172 assert(to_cp->check_invoke_dynamic_at(to_i, k1, k2, k3), | |
1173 "indy structure is OK"); | |
1174 #endif //ASSERT | |
1175 } break; | 1211 } break; |
1176 | 1212 |
1177 // 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 |
1178 // occupied by JVM_CONSTANT_Double or JVM_CONSTANT_Long. It should | 1214 // occupied by JVM_CONSTANT_Double or JVM_CONSTANT_Long. It should |
1179 // not be seen by itself. | 1215 // not be seen by itself. |
1180 case JVM_CONSTANT_Invalid: // fall through | 1216 case JVM_CONSTANT_Invalid: // fall through |
1181 | 1217 |
1182 default: | 1218 default: |
1183 { | 1219 { |
1184 jbyte bad_value = tag_at(from_i).value(); // leave a breadcrumb | |
1185 ShouldNotReachHere(); | 1220 ShouldNotReachHere(); |
1186 } break; | 1221 } break; |
1187 } | 1222 } |
1188 } // end copy_entry_to() | 1223 } // end copy_entry_to() |
1189 | 1224 |
1390 case JVM_CONSTANT_InterfaceMethodref: | 1425 case JVM_CONSTANT_InterfaceMethodref: |
1391 case JVM_CONSTANT_NameAndType: | 1426 case JVM_CONSTANT_NameAndType: |
1392 return 5; | 1427 return 5; |
1393 | 1428 |
1394 case JVM_CONSTANT_InvokeDynamic: | 1429 case JVM_CONSTANT_InvokeDynamic: |
1395 // u1 tag, u2 bsm, u2 nt, u2 argc, u2 argv[argc] | 1430 case JVM_CONSTANT_InvokeDynamicTrans: |
1396 return 7 + 2 * invoke_dynamic_argument_count_at(idx); | 1431 // u1 tag, u2 bsm, u2 nt |
1432 return 5; | |
1397 | 1433 |
1398 case JVM_CONSTANT_Long: | 1434 case JVM_CONSTANT_Long: |
1399 case JVM_CONSTANT_Double: | 1435 case JVM_CONSTANT_Double: |
1400 return 9; | 1436 return 9; |
1401 } | 1437 } |
1604 idx1 = method_type_index_at(idx); | 1640 idx1 = method_type_index_at(idx); |
1605 Bytes::put_Java_u2((address) (bytes+1), idx1); | 1641 Bytes::put_Java_u2((address) (bytes+1), idx1); |
1606 DBG(printf("JVM_CONSTANT_MethodType: %hd", idx1)); | 1642 DBG(printf("JVM_CONSTANT_MethodType: %hd", idx1)); |
1607 break; | 1643 break; |
1608 } | 1644 } |
1645 case JVM_CONSTANT_InvokeDynamicTrans: | |
1609 case JVM_CONSTANT_InvokeDynamic: { | 1646 case JVM_CONSTANT_InvokeDynamic: { |
1610 *bytes = JVM_CONSTANT_InvokeDynamic; | 1647 *bytes = tag; |
1611 idx1 = invoke_dynamic_bootstrap_method_ref_index_at(idx); | 1648 idx1 = extract_low_short_from_int(*int_at_addr(idx)); |
1612 idx2 = invoke_dynamic_name_and_type_ref_index_at(idx); | 1649 idx2 = extract_high_short_from_int(*int_at_addr(idx)); |
1613 int argc = invoke_dynamic_argument_count_at(idx); | 1650 assert(idx2 == invoke_dynamic_name_and_type_ref_index_at(idx), "correct half of u4"); |
1614 Bytes::put_Java_u2((address) (bytes+1), idx1); | 1651 Bytes::put_Java_u2((address) (bytes+1), idx1); |
1615 Bytes::put_Java_u2((address) (bytes+3), idx2); | 1652 Bytes::put_Java_u2((address) (bytes+3), idx2); |
1616 Bytes::put_Java_u2((address) (bytes+5), argc); | 1653 DBG(printf("JVM_CONSTANT_InvokeDynamic: %hd %hd", idx1, idx2)); |
1617 for (int arg_i = 0; arg_i < argc; arg_i++) { | |
1618 int arg = invoke_dynamic_argument_index_at(idx, arg_i); | |
1619 Bytes::put_Java_u2((address) (bytes+7+2*arg_i), arg); | |
1620 } | |
1621 DBG(printf("JVM_CONSTANT_InvokeDynamic: %hd %hd [%d]", idx1, idx2, argc)); | |
1622 break; | 1654 break; |
1623 } | 1655 } |
1624 } | 1656 } |
1625 DBG(printf("\n")); | 1657 DBG(printf("\n")); |
1626 bytes += ent_size; | 1658 bytes += ent_size; |