Mercurial > hg > graal-jvmci-8
comparison src/share/vm/oops/constantPool.cpp @ 12845:b4a4fdc1f464
8025185: MethodHandleInError and MethodTypeInError not handled in ConstantPool::compare_entry_to and copy_entry_to
Summary: Add missing cases.
Reviewed-by: sspitsyn, dcubed
author | coleenp |
---|---|
date | Wed, 09 Oct 2013 21:45:28 -0400 |
parents | 190899198332 |
children | 28ca974cc21a |
comparison
equal
deleted
inserted
replaced
12822:cc4f5f8d885e | 12845:b4a4fdc1f464 |
---|---|
862 } | 862 } |
863 } | 863 } |
864 } | 864 } |
865 | 865 |
866 | 866 |
867 jbyte normalize_error_tag(jbyte tag) { | |
868 switch (tag) { | |
869 case JVM_CONSTANT_UnresolvedClassInError: | |
870 return JVM_CONSTANT_UnresolvedClass; | |
871 case JVM_CONSTANT_MethodHandleInError: | |
872 return JVM_CONSTANT_MethodHandle; | |
873 case JVM_CONSTANT_MethodTypeInError: | |
874 return JVM_CONSTANT_MethodType; | |
875 default: | |
876 return tag; | |
877 } | |
878 } | |
879 | |
867 // Compare this constant pool's entry at index1 to the constant pool | 880 // Compare this constant pool's entry at index1 to the constant pool |
868 // cp2's entry at index2. | 881 // cp2's entry at index2. |
869 bool ConstantPool::compare_entry_to(int index1, constantPoolHandle cp2, | 882 bool ConstantPool::compare_entry_to(int index1, constantPoolHandle cp2, |
870 int index2, TRAPS) { | 883 int index2, TRAPS) { |
871 | 884 |
872 jbyte t1 = tag_at(index1).value(); | 885 jbyte t1 = tag_at(index1).value(); |
873 jbyte t2 = cp2->tag_at(index2).value(); | 886 jbyte t2 = cp2->tag_at(index2).value(); |
874 | 887 |
875 | 888 |
876 // JVM_CONSTANT_UnresolvedClassInError is equal to JVM_CONSTANT_UnresolvedClass | 889 // JVM_CONSTANT_UnresolvedClassInError tag is equal to JVM_CONSTANT_UnresolvedClass |
877 // when comparing | 890 // when comparing (and the other error tags) |
878 if (t1 == JVM_CONSTANT_UnresolvedClassInError) { | 891 t1 = normalize_error_tag(t1); |
879 t1 = JVM_CONSTANT_UnresolvedClass; | 892 t2 = normalize_error_tag(t2); |
880 } | |
881 if (t2 == JVM_CONSTANT_UnresolvedClassInError) { | |
882 t2 = JVM_CONSTANT_UnresolvedClass; | |
883 } | |
884 | 893 |
885 if (t1 != t2) { | 894 if (t1 != t2) { |
886 // Not the same entry type so there is nothing else to check. Note | 895 // Not the same entry type so there is nothing else to check. Note |
887 // that this style of checking will consider resolved/unresolved | 896 // that this style of checking will consider resolved/unresolved |
888 // class pairs as different. | 897 // class pairs as different. |
999 } | 1008 } |
1000 } break; | 1009 } break; |
1001 | 1010 |
1002 case JVM_CONSTANT_MethodType: | 1011 case JVM_CONSTANT_MethodType: |
1003 { | 1012 { |
1004 int k1 = method_type_index_at(index1); | 1013 int k1 = method_type_index_at_error_ok(index1); |
1005 int k2 = cp2->method_type_index_at(index2); | 1014 int k2 = cp2->method_type_index_at_error_ok(index2); |
1006 bool match = compare_entry_to(k1, cp2, k2, CHECK_false); | 1015 bool match = compare_entry_to(k1, cp2, k2, CHECK_false); |
1007 if (match) { | 1016 if (match) { |
1008 return true; | 1017 return true; |
1009 } | 1018 } |
1010 } break; | 1019 } break; |
1011 | 1020 |
1012 case JVM_CONSTANT_MethodHandle: | 1021 case JVM_CONSTANT_MethodHandle: |
1013 { | 1022 { |
1014 int k1 = method_handle_ref_kind_at(index1); | 1023 int k1 = method_handle_ref_kind_at_error_ok(index1); |
1015 int k2 = cp2->method_handle_ref_kind_at(index2); | 1024 int k2 = cp2->method_handle_ref_kind_at_error_ok(index2); |
1016 if (k1 == k2) { | 1025 if (k1 == k2) { |
1017 int i1 = method_handle_index_at(index1); | 1026 int i1 = method_handle_index_at_error_ok(index1); |
1018 int i2 = cp2->method_handle_index_at(index2); | 1027 int i2 = cp2->method_handle_index_at_error_ok(index2); |
1019 bool match = compare_entry_to(i1, cp2, i2, CHECK_false); | 1028 bool match = compare_entry_to(i1, cp2, i2, CHECK_false); |
1020 if (match) { | 1029 if (match) { |
1021 return true; | 1030 return true; |
1022 } | 1031 } |
1023 } | 1032 } |
1327 } else { | 1336 } else { |
1328 to_cp->unresolved_klass_at_put(to_i, entry.get_symbol()); | 1337 to_cp->unresolved_klass_at_put(to_i, entry.get_symbol()); |
1329 } | 1338 } |
1330 } break; | 1339 } break; |
1331 | 1340 |
1332 case JVM_CONSTANT_UnresolvedClassInError: | |
1333 { | |
1334 Symbol* k = from_cp->unresolved_klass_at(from_i); | |
1335 to_cp->unresolved_klass_at_put(to_i, k); | |
1336 to_cp->tag_at_put(to_i, JVM_CONSTANT_UnresolvedClassInError); | |
1337 } break; | |
1338 | |
1339 | |
1340 case JVM_CONSTANT_String: | 1341 case JVM_CONSTANT_String: |
1341 { | 1342 { |
1342 Symbol* s = from_cp->unresolved_string_at(from_i); | 1343 Symbol* s = from_cp->unresolved_string_at(from_i); |
1343 to_cp->unresolved_string_at_put(to_i, s); | 1344 to_cp->unresolved_string_at_put(to_i, s); |
1344 } break; | 1345 } break; |
1350 s->increment_refcount(); | 1351 s->increment_refcount(); |
1351 to_cp->symbol_at_put(to_i, s); | 1352 to_cp->symbol_at_put(to_i, s); |
1352 } break; | 1353 } break; |
1353 | 1354 |
1354 case JVM_CONSTANT_MethodType: | 1355 case JVM_CONSTANT_MethodType: |
1355 { | 1356 case JVM_CONSTANT_MethodTypeInError: |
1356 jint k = from_cp->method_type_index_at(from_i); | 1357 { |
1358 jint k = from_cp->method_type_index_at_error_ok(from_i); | |
1357 to_cp->method_type_index_at_put(to_i, k); | 1359 to_cp->method_type_index_at_put(to_i, k); |
1358 } break; | 1360 } break; |
1359 | 1361 |
1360 case JVM_CONSTANT_MethodHandle: | 1362 case JVM_CONSTANT_MethodHandle: |
1361 { | 1363 case JVM_CONSTANT_MethodHandleInError: |
1362 int k1 = from_cp->method_handle_ref_kind_at(from_i); | 1364 { |
1363 int k2 = from_cp->method_handle_index_at(from_i); | 1365 int k1 = from_cp->method_handle_ref_kind_at_error_ok(from_i); |
1366 int k2 = from_cp->method_handle_index_at_error_ok(from_i); | |
1364 to_cp->method_handle_index_at_put(to_i, k1, k2); | 1367 to_cp->method_handle_index_at_put(to_i, k1, k2); |
1365 } break; | 1368 } break; |
1366 | 1369 |
1367 case JVM_CONSTANT_InvokeDynamic: | 1370 case JVM_CONSTANT_InvokeDynamic: |
1368 { | 1371 { |