提交 2bc52948 编写于 作者: C coleenp

8025185: MethodHandleInError and MethodTypeInError not handled in...

8025185: MethodHandleInError and MethodTypeInError not handled in ConstantPool::compare_entry_to and copy_entry_to
Summary: Add missing cases.
Reviewed-by: sspitsyn, dcubed
上级 a65ebf06
...@@ -864,6 +864,19 @@ void ConstantPool::unreference_symbols() { ...@@ -864,6 +864,19 @@ void ConstantPool::unreference_symbols() {
} }
jbyte normalize_error_tag(jbyte tag) {
switch (tag) {
case JVM_CONSTANT_UnresolvedClassInError:
return JVM_CONSTANT_UnresolvedClass;
case JVM_CONSTANT_MethodHandleInError:
return JVM_CONSTANT_MethodHandle;
case JVM_CONSTANT_MethodTypeInError:
return JVM_CONSTANT_MethodType;
default:
return tag;
}
}
// Compare this constant pool's entry at index1 to the constant pool // Compare this constant pool's entry at index1 to the constant pool
// cp2's entry at index2. // cp2's entry at index2.
bool ConstantPool::compare_entry_to(int index1, constantPoolHandle cp2, bool ConstantPool::compare_entry_to(int index1, constantPoolHandle cp2,
...@@ -873,14 +886,10 @@ bool ConstantPool::compare_entry_to(int index1, constantPoolHandle cp2, ...@@ -873,14 +886,10 @@ bool ConstantPool::compare_entry_to(int index1, constantPoolHandle cp2,
jbyte t2 = cp2->tag_at(index2).value(); jbyte t2 = cp2->tag_at(index2).value();
// JVM_CONSTANT_UnresolvedClassInError is equal to JVM_CONSTANT_UnresolvedClass // JVM_CONSTANT_UnresolvedClassInError tag is equal to JVM_CONSTANT_UnresolvedClass
// when comparing // when comparing (and the other error tags)
if (t1 == JVM_CONSTANT_UnresolvedClassInError) { t1 = normalize_error_tag(t1);
t1 = JVM_CONSTANT_UnresolvedClass; t2 = normalize_error_tag(t2);
}
if (t2 == JVM_CONSTANT_UnresolvedClassInError) {
t2 = JVM_CONSTANT_UnresolvedClass;
}
if (t1 != t2) { if (t1 != t2) {
// Not the same entry type so there is nothing else to check. Note // Not the same entry type so there is nothing else to check. Note
...@@ -1001,8 +1010,8 @@ bool ConstantPool::compare_entry_to(int index1, constantPoolHandle cp2, ...@@ -1001,8 +1010,8 @@ bool ConstantPool::compare_entry_to(int index1, constantPoolHandle cp2,
case JVM_CONSTANT_MethodType: case JVM_CONSTANT_MethodType:
{ {
int k1 = method_type_index_at(index1); int k1 = method_type_index_at_error_ok(index1);
int k2 = cp2->method_type_index_at(index2); int k2 = cp2->method_type_index_at_error_ok(index2);
bool match = compare_entry_to(k1, cp2, k2, CHECK_false); bool match = compare_entry_to(k1, cp2, k2, CHECK_false);
if (match) { if (match) {
return true; return true;
...@@ -1011,11 +1020,11 @@ bool ConstantPool::compare_entry_to(int index1, constantPoolHandle cp2, ...@@ -1011,11 +1020,11 @@ bool ConstantPool::compare_entry_to(int index1, constantPoolHandle cp2,
case JVM_CONSTANT_MethodHandle: case JVM_CONSTANT_MethodHandle:
{ {
int k1 = method_handle_ref_kind_at(index1); int k1 = method_handle_ref_kind_at_error_ok(index1);
int k2 = cp2->method_handle_ref_kind_at(index2); int k2 = cp2->method_handle_ref_kind_at_error_ok(index2);
if (k1 == k2) { if (k1 == k2) {
int i1 = method_handle_index_at(index1); int i1 = method_handle_index_at_error_ok(index1);
int i2 = cp2->method_handle_index_at(index2); int i2 = cp2->method_handle_index_at_error_ok(index2);
bool match = compare_entry_to(i1, cp2, i2, CHECK_false); bool match = compare_entry_to(i1, cp2, i2, CHECK_false);
if (match) { if (match) {
return true; return true;
...@@ -1329,14 +1338,6 @@ void ConstantPool::copy_entry_to(constantPoolHandle from_cp, int from_i, ...@@ -1329,14 +1338,6 @@ void ConstantPool::copy_entry_to(constantPoolHandle from_cp, int from_i,
} }
} break; } break;
case JVM_CONSTANT_UnresolvedClassInError:
{
Symbol* k = from_cp->unresolved_klass_at(from_i);
to_cp->unresolved_klass_at_put(to_i, k);
to_cp->tag_at_put(to_i, JVM_CONSTANT_UnresolvedClassInError);
} break;
case JVM_CONSTANT_String: case JVM_CONSTANT_String:
{ {
Symbol* s = from_cp->unresolved_string_at(from_i); Symbol* s = from_cp->unresolved_string_at(from_i);
...@@ -1352,15 +1353,17 @@ void ConstantPool::copy_entry_to(constantPoolHandle from_cp, int from_i, ...@@ -1352,15 +1353,17 @@ void ConstantPool::copy_entry_to(constantPoolHandle from_cp, int from_i,
} break; } break;
case JVM_CONSTANT_MethodType: case JVM_CONSTANT_MethodType:
case JVM_CONSTANT_MethodTypeInError:
{ {
jint k = from_cp->method_type_index_at(from_i); jint k = from_cp->method_type_index_at_error_ok(from_i);
to_cp->method_type_index_at_put(to_i, k); to_cp->method_type_index_at_put(to_i, k);
} break; } break;
case JVM_CONSTANT_MethodHandle: case JVM_CONSTANT_MethodHandle:
case JVM_CONSTANT_MethodHandleInError:
{ {
int k1 = from_cp->method_handle_ref_kind_at(from_i); int k1 = from_cp->method_handle_ref_kind_at_error_ok(from_i);
int k2 = from_cp->method_handle_index_at(from_i); int k2 = from_cp->method_handle_index_at_error_ok(from_i);
to_cp->method_handle_index_at_put(to_i, k1, k2); to_cp->method_handle_index_at_put(to_i, k1, k2);
} break; } break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册