< prev index next >

src/share/vm/prims/jvmtiRedefineClasses.cpp

Print this page

*** 290,305 **** // and directly resolve constant pool entries to load classes. The // split-verifier can accept either Class entries or UnresolvedClass // entries in the input constant pool. We revert the appended copy // back to UnresolvedClass so that either verifier will be happy // with the constant pool entry. case JVM_CONSTANT_Class: { ! // revert the copy to JVM_CONSTANT_UnresolvedClass ! (*merge_cp_p)->unresolved_klass_at_put(*merge_cp_length_p, ! scratch_cp->klass_name_at(scratch_i)); if (scratch_i != *merge_cp_length_p) { // The new entry in *merge_cp_p is at a different index than // the new entry in scratch_cp so we need to map the index values. map_index(scratch_cp, scratch_i, *merge_cp_length_p); } --- 290,315 ---- // and directly resolve constant pool entries to load classes. The // split-verifier can accept either Class entries or UnresolvedClass // entries in the input constant pool. We revert the appended copy // back to UnresolvedClass so that either verifier will be happy // with the constant pool entry. + // + // this is an indirect CP entry so it needs special handling case JVM_CONSTANT_Class: + case JVM_CONSTANT_UnresolvedClass: { ! int name_i = scratch_cp->klass_name_index_at(scratch_i); ! int new_name_i = find_or_append_indirect_entry(scratch_cp, name_i, merge_cp_p, ! merge_cp_length_p, THREAD); + if (new_name_i != name_i) { + log_trace(redefine, class, constantpool) + ("Class entry@%d name_index change: %d to %d", + *merge_cp_length_p, name_i, new_name_i); + } + + (*merge_cp_p)->temp_unresolved_klass_at_put(*merge_cp_length_p, new_name_i); if (scratch_i != *merge_cp_length_p) { // The new entry in *merge_cp_p is at a different index than // the new entry in scratch_cp so we need to map the index values. map_index(scratch_cp, scratch_i, *merge_cp_length_p); }
*** 328,341 **** case JVM_CONSTANT_Utf8: // fall through // This was an indirect CP entry, but it has been changed into // Symbol*s so this entry can be directly appended. case JVM_CONSTANT_String: // fall through - - // These were indirect CP entries, but they have been changed into - // Symbol*s so these entries can be directly appended. - case JVM_CONSTANT_UnresolvedClass: // fall through { ConstantPool::copy_entry_to(scratch_cp, scratch_i, *merge_cp_p, *merge_cp_length_p, THREAD); if (scratch_i != *merge_cp_length_p) { --- 338,347 ----
*** 502,512 **** map_index(scratch_cp, scratch_i, *merge_cp_length_p); } (*merge_cp_length_p)++; } break; ! // At this stage, Class or UnresolvedClass could be here, but not // ClassIndex case JVM_CONSTANT_ClassIndex: // fall through // Invalid is used as the tag for the second constant pool entry // occupied by JVM_CONSTANT_Double or JVM_CONSTANT_Long. It should --- 508,518 ---- map_index(scratch_cp, scratch_i, *merge_cp_length_p); } (*merge_cp_length_p)++; } break; ! // At this stage, Class or UnresolvedClass could be in scratch_cp, but not // ClassIndex case JVM_CONSTANT_ClassIndex: // fall through // Invalid is used as the tag for the second constant pool entry // occupied by JVM_CONSTANT_Double or JVM_CONSTANT_Long. It should
*** 1268,1279 **** case JVM_CONSTANT_Class: case 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, ! old_cp->klass_name_at(old_i)); break; case JVM_CONSTANT_Double: case JVM_CONSTANT_Long: // just copy the entry to *merge_cp_p, but double and long take --- 1274,1285 ---- case JVM_CONSTANT_Class: case 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)->temp_unresolved_klass_at_put(old_i, ! old_cp->klass_name_index_at(old_i)); break; case JVM_CONSTANT_Double: case JVM_CONSTANT_Long: // just copy the entry to *merge_cp_p, but double and long take
*** 3100,3109 **** --- 3106,3116 ---- } scratch_cp = smaller_cp; // attach new constant pool to klass scratch_class->set_constants(scratch_cp()); + scratch_cp->initialize_unresolved_klasses(loader_data, CHECK); int i; // for portability // update each field in klass to use new constant pool indices as needed for (JavaFieldStream fs(scratch_class); !fs.done(); fs.next()) {
< prev index next >