< prev index next > src/hotspot/share/prims/jvmtiRedefineClasses.cpp
Print this page
case JVM_CONSTANT_Invalid: // fall through
// At this stage, String could be here, but not StringIndex
case JVM_CONSTANT_StringIndex: // fall through
- // At this stage JVM_CONSTANT_UnresolvedClassInError should not be
- // here
+ // At this stage JVM_CONSTANT_UnresolvedClassInError should not be here
case JVM_CONSTANT_UnresolvedClassInError: // fall through
default:
{
// leave a breadcrumb
if (!rewrite_cp_refs_in_permitted_subclasses_attribute(scratch_class)) {
// propagate failure back to caller
return false;
}
+ // rewrite constant pool references in the LoadableDescriptors attribute:
+ if (!rewrite_cp_refs_in_loadable_descriptors_attribute(scratch_class)) {
+ // propagate failure back to caller
+ return false;
+ }
+
// rewrite constant pool references in the methods:
if (!rewrite_cp_refs_in_methods(scratch_class)) {
// propagate failure back to caller
return false;
}
permitted_subclasses->at_put(i, find_new_index(cp_index));
}
return true;
}
+ // Rewrite constant pool references in the LoadableDescriptors attribute.
+ bool VM_RedefineClasses::rewrite_cp_refs_in_loadable_descriptors_attribute(
+ InstanceKlass* scratch_class) {
+
+ Array<u2>* loadable_descriptors = scratch_class->loadable_descriptors();
+ assert(loadable_descriptors != nullptr, "unexpected null loadable_descriptors");
+ for (int i = 0; i < loadable_descriptors->length(); i++) {
+ u2 cp_index = loadable_descriptors->at(i);
+ loadable_descriptors->at_put(i, find_new_index(cp_index));
+ }
+ return true;
+ }
+
// Rewrite constant pool references in the methods.
bool VM_RedefineClasses::rewrite_cp_refs_in_methods(InstanceKlass* scratch_class) {
Array<Method*>* methods = scratch_class->methods();
< prev index next >