提交 df4b4484 编写于 作者: C coleenp

6512830: Error: assert(tag_at(which).is_unresolved_klass(), "Corrupted constant pool")

Summary: Redefine classes copies the constant pool while the constant pool may be resolving strings or classes
Reviewed-by: dcubed, dsamersoff, acorn
上级 aa506154
...@@ -1175,8 +1175,15 @@ void constantPoolOopDesc::copy_entry_to(constantPoolHandle from_cp, int from_i, ...@@ -1175,8 +1175,15 @@ void constantPoolOopDesc::copy_entry_to(constantPoolHandle from_cp, int from_i,
case JVM_CONSTANT_UnresolvedClass: case JVM_CONSTANT_UnresolvedClass:
{ {
Symbol* k = from_cp->unresolved_klass_at(from_i); // Can be resolved after checking tag, so check the slot first.
to_cp->unresolved_klass_at_put(to_i, k); CPSlot entry = from_cp->slot_at(from_i);
if (entry.is_oop()) {
assert(entry.get_oop()->is_klass(), "must be");
// Already resolved
to_cp->klass_at_put(to_i, (klassOop)entry.get_oop());
} else {
to_cp->unresolved_klass_at_put(to_i, entry.get_symbol());
}
} break; } break;
case JVM_CONSTANT_UnresolvedClassInError: case JVM_CONSTANT_UnresolvedClassInError:
...@@ -1189,8 +1196,14 @@ void constantPoolOopDesc::copy_entry_to(constantPoolHandle from_cp, int from_i, ...@@ -1189,8 +1196,14 @@ void constantPoolOopDesc::copy_entry_to(constantPoolHandle from_cp, int from_i,
case JVM_CONSTANT_UnresolvedString: case JVM_CONSTANT_UnresolvedString:
{ {
Symbol* s = from_cp->unresolved_string_at(from_i); // Can be resolved after checking tag, so check the slot first.
to_cp->unresolved_string_at_put(to_i, s); CPSlot entry = from_cp->slot_at(from_i);
if (entry.is_oop()) {
// Already resolved (either string or pseudo-string)
to_cp->string_at_put(to_i, entry.get_oop());
} else {
to_cp->unresolved_string_at_put(to_i, entry.get_symbol());
}
} break; } break;
case JVM_CONSTANT_Utf8: case JVM_CONSTANT_Utf8:
......
...@@ -1084,7 +1084,10 @@ bool VM_RedefineClasses::merge_constant_pools(constantPoolHandle old_cp, ...@@ -1084,7 +1084,10 @@ bool VM_RedefineClasses::merge_constant_pools(constantPoolHandle old_cp,
jbyte old_tag = old_cp->tag_at(old_i).value(); jbyte old_tag = old_cp->tag_at(old_i).value();
switch (old_tag) { switch (old_tag) {
case JVM_CONSTANT_Class: case JVM_CONSTANT_Class:
case JVM_CONSTANT_UnresolvedClass:
// revert the copy to JVM_CONSTANT_UnresolvedClass // revert the copy to JVM_CONSTANT_UnresolvedClass
// May be resolving while calling this so do the same for
// JVM_CONSTANT_UnresolvedClass (klass_name_at() deals with transition)
(*merge_cp_p)->unresolved_klass_at_put(old_i, (*merge_cp_p)->unresolved_klass_at_put(old_i,
old_cp->klass_name_at(old_i)); old_cp->klass_name_at(old_i));
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册