提交 0bff90f6 编写于 作者: J jrose

6957004: MethodComparator uses the wrong CP index accessor

Summary: Change two uses of get_index_u2 to get_index_u2_cpcache; also tweak some debugging print functions
Reviewed-by: kvn
上级 032b930b
...@@ -310,15 +310,12 @@ void constantPoolKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -310,15 +310,12 @@ void constantPoolKlass::oop_print_on(oop obj, outputStream* st) {
Klass::oop_print_on(obj, st); Klass::oop_print_on(obj, st);
constantPoolOop cp = constantPoolOop(obj); constantPoolOop cp = constantPoolOop(obj);
if (cp->flags() != 0) { if (cp->flags() != 0) {
st->print(" - flags : 0x%x", cp->flags()); st->print(" - flags: 0x%x", cp->flags());
if (cp->has_pseudo_string()) st->print(" has_pseudo_string"); if (cp->has_pseudo_string()) st->print(" has_pseudo_string");
if (cp->has_invokedynamic()) st->print(" has_invokedynamic"); if (cp->has_invokedynamic()) st->print(" has_invokedynamic");
st->cr(); st->cr();
} }
st->print_cr(" - cache: " INTPTR_FORMAT, cp->cache());
// Temp. remove cache so we can do lookups with original indicies.
constantPoolCacheHandle cache (THREAD, cp->cache());
cp->set_cache(NULL);
for (int index = 1; index < cp->length(); index++) { // Index 0 is unused for (int index = 1; index < cp->length(); index++) { // Index 0 is unused
st->print(" - %3d : ", index); st->print(" - %3d : ", index);
...@@ -334,8 +331,8 @@ void constantPoolKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -334,8 +331,8 @@ void constantPoolKlass::oop_print_on(oop obj, outputStream* st) {
case JVM_CONSTANT_Fieldref : case JVM_CONSTANT_Fieldref :
case JVM_CONSTANT_Methodref : case JVM_CONSTANT_Methodref :
case JVM_CONSTANT_InterfaceMethodref : case JVM_CONSTANT_InterfaceMethodref :
st->print("klass_index=%d", cp->klass_ref_index_at(index)); st->print("klass_index=%d", cp->uncached_klass_ref_index_at(index));
st->print(" name_and_type_index=%d", cp->name_and_type_ref_index_at(index)); st->print(" name_and_type_index=%d", cp->uncached_name_and_type_ref_index_at(index));
break; break;
case JVM_CONSTANT_UnresolvedString : case JVM_CONSTANT_UnresolvedString :
case JVM_CONSTANT_String : case JVM_CONSTANT_String :
...@@ -382,9 +379,6 @@ void constantPoolKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -382,9 +379,6 @@ void constantPoolKlass::oop_print_on(oop obj, outputStream* st) {
st->cr(); st->cr();
} }
st->cr(); st->cr();
// Restore cache
cp->set_cache(cache());
} }
#endif #endif
...@@ -398,6 +392,9 @@ void constantPoolKlass::oop_print_value_on(oop obj, outputStream* st) { ...@@ -398,6 +392,9 @@ void constantPoolKlass::oop_print_value_on(oop obj, outputStream* st) {
cp->print_address_on(st); cp->print_address_on(st);
st->print(" for "); st->print(" for ");
cp->pool_holder()->print_value_on(st); cp->pool_holder()->print_value_on(st);
if (cp->cache() != NULL) {
st->print(" cache=" PTR_FORMAT, cp->cache());
}
} }
const char* constantPoolKlass::internal_name() const { const char* constantPoolKlass::internal_name() const {
......
...@@ -237,7 +237,7 @@ void methodKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -237,7 +237,7 @@ void methodKlass::oop_print_on(oop obj, outputStream* st) {
Klass::oop_print_on(obj, st); Klass::oop_print_on(obj, st);
methodOop m = methodOop(obj); methodOop m = methodOop(obj);
// get the effect of PrintOopAddress, always, for methods: // get the effect of PrintOopAddress, always, for methods:
st->print (" - this oop: "INTPTR_FORMAT, (intptr_t)m); st->print_cr(" - this oop: "INTPTR_FORMAT, (intptr_t)m);
st->print (" - method holder: "); m->method_holder()->print_value_on(st); st->cr(); st->print (" - method holder: "); m->method_holder()->print_value_on(st); st->cr();
st->print (" - constants: "INTPTR_FORMAT" ", (address)m->constants()); st->print (" - constants: "INTPTR_FORMAT" ", (address)m->constants());
m->constants()->print_value_on(st); st->cr(); m->constants()->print_value_on(st); st->cr();
......
...@@ -149,8 +149,8 @@ bool MethodComparator::args_same(Bytecodes::Code c_old, Bytecodes::Code c_new) { ...@@ -149,8 +149,8 @@ bool MethodComparator::args_same(Bytecodes::Code c_old, Bytecodes::Code c_new) {
case Bytecodes::_invokestatic : // fall through case Bytecodes::_invokestatic : // fall through
case Bytecodes::_invokedynamic : // fall through case Bytecodes::_invokedynamic : // fall through
case Bytecodes::_invokeinterface : { case Bytecodes::_invokeinterface : {
u2 cpci_old = _s_old->has_index_u4() ? _s_old->get_index_u4() : _s_old->get_index_u2(); int cpci_old = _s_old->has_index_u4() ? _s_old->get_index_u4() : _s_old->get_index_u2_cpcache();
u2 cpci_new = _s_new->has_index_u4() ? _s_new->get_index_u4() : _s_new->get_index_u2(); int cpci_new = _s_new->has_index_u4() ? _s_new->get_index_u4() : _s_new->get_index_u2_cpcache();
// Check if the names of classes, field/method names and signatures at these indexes // Check if the names of classes, field/method names and signatures at these indexes
// are the same. Indices which are really into constantpool cache (rather than constant // are the same. Indices which are really into constantpool cache (rather than constant
// pool itself) are accepted by the constantpool query routines below. // pool itself) are accepted by the constantpool query routines below.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册