Mercurial > hg > truffle
comparison src/share/vm/oops/constantPool.cpp @ 7952:edd76a5856f7
8005128: JSR 292: the mlvm redefineClassInBootstrap test crashes in ConstantPool::compare_entry_to
Summary: When constant pool is copied in merge_constant_pools the invokedynamic operands must be copied before.
Reviewed-by: coleenp, twisti
Contributed-by: serguei.spitsyn@oracle.com
author | sspitsyn |
---|---|
date | Thu, 24 Jan 2013 22:13:32 -0800 |
parents | 5daaddd917a1 |
children | 0d26ce8e9251 |
comparison
equal
deleted
inserted
replaced
7949:5daaddd917a1 | 7952:edd76a5856f7 |
---|---|
1096 | 1096 |
1097 return false; | 1097 return false; |
1098 } // end compare_entry_to() | 1098 } // end compare_entry_to() |
1099 | 1099 |
1100 | 1100 |
1101 // Copy this constant pool's entries at start_i to end_i (inclusive) | 1101 void ConstantPool::copy_operands(constantPoolHandle from_cp, |
1102 // to the constant pool to_cp's entries starting at to_i. A total of | 1102 constantPoolHandle to_cp, |
1103 // (end_i - start_i) + 1 entries are copied. | 1103 TRAPS) { |
1104 void ConstantPool::copy_cp_to_impl(constantPoolHandle from_cp, int start_i, int end_i, | |
1105 constantPoolHandle to_cp, int to_i, TRAPS) { | |
1106 | |
1107 int dest_i = to_i; // leave original alone for debug purposes | |
1108 | |
1109 for (int src_i = start_i; src_i <= end_i; /* see loop bottom */ ) { | |
1110 copy_entry_to(from_cp, src_i, to_cp, dest_i, CHECK); | |
1111 | |
1112 switch (from_cp->tag_at(src_i).value()) { | |
1113 case JVM_CONSTANT_Double: | |
1114 case JVM_CONSTANT_Long: | |
1115 // double and long take two constant pool entries | |
1116 src_i += 2; | |
1117 dest_i += 2; | |
1118 break; | |
1119 | |
1120 default: | |
1121 // all others take one constant pool entry | |
1122 src_i++; | |
1123 dest_i++; | |
1124 break; | |
1125 } | |
1126 } | |
1127 | 1104 |
1128 int from_oplen = operand_array_length(from_cp->operands()); | 1105 int from_oplen = operand_array_length(from_cp->operands()); |
1129 int old_oplen = operand_array_length(to_cp->operands()); | 1106 int old_oplen = operand_array_length(to_cp->operands()); |
1130 if (from_oplen != 0) { | 1107 if (from_oplen != 0) { |
1131 ClassLoaderData* loader_data = to_cp->pool_holder()->class_loader_data(); | 1108 ClassLoaderData* loader_data = to_cp->pool_holder()->class_loader_data(); |
1177 | 1154 |
1178 // replace target operands array with combined array | 1155 // replace target operands array with combined array |
1179 to_cp->set_operands(new_operands); | 1156 to_cp->set_operands(new_operands); |
1180 } | 1157 } |
1181 } | 1158 } |
1182 | 1159 } // end copy_operands() |
1183 } // end copy_cp_to() | 1160 |
1161 | |
1162 // Copy this constant pool's entries at start_i to end_i (inclusive) | |
1163 // to the constant pool to_cp's entries starting at to_i. A total of | |
1164 // (end_i - start_i) + 1 entries are copied. | |
1165 void ConstantPool::copy_cp_to_impl(constantPoolHandle from_cp, int start_i, int end_i, | |
1166 constantPoolHandle to_cp, int to_i, TRAPS) { | |
1167 | |
1168 | |
1169 int dest_i = to_i; // leave original alone for debug purposes | |
1170 | |
1171 for (int src_i = start_i; src_i <= end_i; /* see loop bottom */ ) { | |
1172 copy_entry_to(from_cp, src_i, to_cp, dest_i, CHECK); | |
1173 | |
1174 switch (from_cp->tag_at(src_i).value()) { | |
1175 case JVM_CONSTANT_Double: | |
1176 case JVM_CONSTANT_Long: | |
1177 // double and long take two constant pool entries | |
1178 src_i += 2; | |
1179 dest_i += 2; | |
1180 break; | |
1181 | |
1182 default: | |
1183 // all others take one constant pool entry | |
1184 src_i++; | |
1185 dest_i++; | |
1186 break; | |
1187 } | |
1188 } | |
1189 copy_operands(from_cp, to_cp, CHECK); | |
1190 | |
1191 } // end copy_cp_to_impl() | |
1184 | 1192 |
1185 | 1193 |
1186 // Copy this constant pool's entry at from_i to the constant pool | 1194 // Copy this constant pool's entry at from_i to the constant pool |
1187 // to_cp's entry at to_i. | 1195 // to_cp's entry at to_i. |
1188 void ConstantPool::copy_entry_to(constantPoolHandle from_cp, int from_i, | 1196 void ConstantPool::copy_entry_to(constantPoolHandle from_cp, int from_i, |