< prev index next >

src/share/vm/prims/jvmtiRedefineClasses.cpp

Print this page
rev 12858 : 8184323: compile-time guard some UseSharedSpaces-only coding with the INCLUDE_CDS macro


 156         ClassLoaderData* cld = _scratch_classes[i]->class_loader_data();
 157         // Free the memory for this class at class unloading time.  Not before
 158         // because CMS might think this is still live.
 159         cld->add_to_deallocate_list(InstanceKlass::cast(_scratch_classes[i]));
 160       }
 161     }
 162     // Free os::malloc allocated memory in load_new_class_version.
 163     os::free(_scratch_classes);
 164     _timer_vm_op_prologue.stop();
 165     unlock_classes();
 166     return false;
 167   }
 168 
 169   _timer_vm_op_prologue.stop();
 170   return true;
 171 }
 172 
 173 void VM_RedefineClasses::doit() {
 174   Thread *thread = Thread::current();
 175 

 176   if (UseSharedSpaces) {
 177     // Sharing is enabled so we remap the shared readonly space to
 178     // shared readwrite, private just in case we need to redefine
 179     // a shared class. We do the remap during the doit() phase of
 180     // the safepoint to be safer.
 181     if (!MetaspaceShared::remap_shared_readonly_as_readwrite()) {
 182       log_info(redefine, class, load)("failed to remap shared readonly space to readwrite, private");
 183       _res = JVMTI_ERROR_INTERNAL;
 184       return;
 185     }
 186   }

 187 
 188   // Mark methods seen on stack and everywhere else so old methods are not
 189   // cleaned up if they're on the stack.
 190   MetadataOnStackMark md_on_stack(true);
 191   HandleMark hm(thread);   // make sure any handles created are deleted
 192                            // before the stack walk again.
 193 
 194   for (int i = 0; i < _class_count; i++) {
 195     redefine_single_class(_class_defs[i].klass, _scratch_classes[i], thread);
 196   }
 197 
 198   // Clean out MethodData pointing to old Method*
 199   // Have to do this after all classes are redefined and all methods that
 200   // are redefined are marked as old.
 201   MethodDataCleaner clean_weak_method_links;
 202   ClassLoaderDataGraph::classes_do(&clean_weak_method_links);
 203 
 204   // Disable any dependent concurrent compilations
 205   SystemDictionary::notice_modification();
 206 




 156         ClassLoaderData* cld = _scratch_classes[i]->class_loader_data();
 157         // Free the memory for this class at class unloading time.  Not before
 158         // because CMS might think this is still live.
 159         cld->add_to_deallocate_list(InstanceKlass::cast(_scratch_classes[i]));
 160       }
 161     }
 162     // Free os::malloc allocated memory in load_new_class_version.
 163     os::free(_scratch_classes);
 164     _timer_vm_op_prologue.stop();
 165     unlock_classes();
 166     return false;
 167   }
 168 
 169   _timer_vm_op_prologue.stop();
 170   return true;
 171 }
 172 
 173 void VM_RedefineClasses::doit() {
 174   Thread *thread = Thread::current();
 175 
 176 #if INCLUDE_CDS
 177   if (UseSharedSpaces) {
 178     // Sharing is enabled so we remap the shared readonly space to
 179     // shared readwrite, private just in case we need to redefine
 180     // a shared class. We do the remap during the doit() phase of
 181     // the safepoint to be safer.
 182     if (!MetaspaceShared::remap_shared_readonly_as_readwrite()) {
 183       log_info(redefine, class, load)("failed to remap shared readonly space to readwrite, private");
 184       _res = JVMTI_ERROR_INTERNAL;
 185       return;
 186     }
 187   }
 188 #endif
 189 
 190   // Mark methods seen on stack and everywhere else so old methods are not
 191   // cleaned up if they're on the stack.
 192   MetadataOnStackMark md_on_stack(true);
 193   HandleMark hm(thread);   // make sure any handles created are deleted
 194                            // before the stack walk again.
 195 
 196   for (int i = 0; i < _class_count; i++) {
 197     redefine_single_class(_class_defs[i].klass, _scratch_classes[i], thread);
 198   }
 199 
 200   // Clean out MethodData pointing to old Method*
 201   // Have to do this after all classes are redefined and all methods that
 202   // are redefined are marked as old.
 203   MethodDataCleaner clean_weak_method_links;
 204   ClassLoaderDataGraph::classes_do(&clean_weak_method_links);
 205 
 206   // Disable any dependent concurrent compilations
 207   SystemDictionary::notice_modification();
 208 


< prev index next >