提交 1b35df39 编写于 作者: 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
上级 b9f1de1c
......@@ -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
// cp2's entry at index2.
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();
// JVM_CONSTANT_UnresolvedClassInError is equal to JVM_CONSTANT_UnresolvedClass
// when comparing
if (t1 == JVM_CONSTANT_UnresolvedClassInError) {
t1 = JVM_CONSTANT_UnresolvedClass;
}
if (t2 == JVM_CONSTANT_UnresolvedClassInError) {
t2 = JVM_CONSTANT_UnresolvedClass;
}
// JVM_CONSTANT_UnresolvedClassInError tag is equal to JVM_CONSTANT_UnresolvedClass
// when comparing (and the other error tags)
t1 = normalize_error_tag(t1);
t2 = normalize_error_tag(t2);
if (t1 != t2) {
// 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,
case JVM_CONSTANT_MethodType:
{
int k1 = method_type_index_at(index1);
int k2 = cp2->method_type_index_at(index2);
int k1 = method_type_index_at_error_ok(index1);
int k2 = cp2->method_type_index_at_error_ok(index2);
bool match = compare_entry_to(k1, cp2, k2, CHECK_false);
if (match) {
return true;
......@@ -1011,11 +1020,11 @@ bool ConstantPool::compare_entry_to(int index1, constantPoolHandle cp2,
case JVM_CONSTANT_MethodHandle:
{
int k1 = method_handle_ref_kind_at(index1);
int k2 = cp2->method_handle_ref_kind_at(index2);
int k1 = method_handle_ref_kind_at_error_ok(index1);
int k2 = cp2->method_handle_ref_kind_at_error_ok(index2);
if (k1 == k2) {
int i1 = method_handle_index_at(index1);
int i2 = cp2->method_handle_index_at(index2);
int i1 = method_handle_index_at_error_ok(index1);
int i2 = cp2->method_handle_index_at_error_ok(index2);
bool match = compare_entry_to(i1, cp2, i2, CHECK_false);
if (match) {
return true;
......@@ -1329,14 +1338,6 @@ void ConstantPool::copy_entry_to(constantPoolHandle from_cp, int from_i,
}
} 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:
{
Symbol* s = from_cp->unresolved_string_at(from_i);
......@@ -1352,15 +1353,17 @@ void ConstantPool::copy_entry_to(constantPoolHandle from_cp, int from_i,
} break;
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);
} break;
case JVM_CONSTANT_MethodHandle:
case JVM_CONSTANT_MethodHandleInError:
{
int k1 = from_cp->method_handle_ref_kind_at(from_i);
int k2 = from_cp->method_handle_index_at(from_i);
int k1 = from_cp->method_handle_ref_kind_at_error_ok(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);
} break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册