hotspot/src/share/vm/oops/instanceKlass.cpp
changeset 38059 86ab3f0a9f87
parent 37248 11a660dbbb8e
child 38094 46977cd73d86
equal deleted inserted replaced
38058:17294a77a970 38059:86ab3f0a9f87
  2030   }
  2030   }
  2031 
  2031 
  2032   return (old_state != is_in_error_state());
  2032   return (old_state != is_in_error_state());
  2033 }
  2033 }
  2034 
  2034 
       
  2035 #if INCLUDE_JVMTI
  2035 static void clear_all_breakpoints(Method* m) {
  2036 static void clear_all_breakpoints(Method* m) {
  2036   m->clear_all_breakpoints();
  2037   m->clear_all_breakpoints();
  2037 }
  2038 }
  2038 
  2039 #endif
  2039 
  2040 
  2040 void InstanceKlass::notify_unload_class(InstanceKlass* ik) {
  2041 void InstanceKlass::notify_unload_class(InstanceKlass* ik) {
  2041   // notify the debugger
  2042   // notify the debugger
  2042   if (JvmtiExport::should_post_class_unload()) {
  2043   if (JvmtiExport::should_post_class_unload()) {
  2043     JvmtiExport::post_class_unload(ik);
  2044     JvmtiExport::post_class_unload(ik);
  2095   // nmethod::flush_dependencies). It ends up during klass unloading as seemingly
  2096   // nmethod::flush_dependencies). It ends up during klass unloading as seemingly
  2096   // live dependencies pointing to unloaded nmethods and causes a crash in
  2097   // live dependencies pointing to unloaded nmethods and causes a crash in
  2097   // DC::remove_all_dependents() when it touches unloaded nmethod.
  2098   // DC::remove_all_dependents() when it touches unloaded nmethod.
  2098   dependencies().wipe();
  2099   dependencies().wipe();
  2099 
  2100 
       
  2101 #if INCLUDE_JVMTI
  2100   // Deallocate breakpoint records
  2102   // Deallocate breakpoint records
  2101   if (breakpoints() != 0x0) {
  2103   if (breakpoints() != 0x0) {
  2102     methods_do(clear_all_breakpoints);
  2104     methods_do(clear_all_breakpoints);
  2103     assert(breakpoints() == 0x0, "should have cleared breakpoints");
  2105     assert(breakpoints() == 0x0, "should have cleared breakpoints");
  2104   }
  2106   }
  2106   // deallocate the cached class file
  2108   // deallocate the cached class file
  2107   if (_cached_class_file != NULL) {
  2109   if (_cached_class_file != NULL) {
  2108     os::free(_cached_class_file);
  2110     os::free(_cached_class_file);
  2109     _cached_class_file = NULL;
  2111     _cached_class_file = NULL;
  2110   }
  2112   }
       
  2113 #endif
  2111 
  2114 
  2112   // Decrement symbol reference counts associated with the unloaded class.
  2115   // Decrement symbol reference counts associated with the unloaded class.
  2113   if (_name != NULL) _name->decrement_refcount();
  2116   if (_name != NULL) _name->decrement_refcount();
  2114   // unreference array name derived from this class name (arrays of an unloaded
  2117   // unreference array name derived from this class name (arrays of an unloaded
  2115   // class can't be referenced anymore).
  2118   // class can't be referenced anymore).
  2839   st->print(BULLET"field annotations:       "); fields_annotations()->print_value_on(st); st->cr();
  2842   st->print(BULLET"field annotations:       "); fields_annotations()->print_value_on(st); st->cr();
  2840   st->print(BULLET"field type annotations:  "); fields_type_annotations()->print_value_on(st); st->cr();
  2843   st->print(BULLET"field type annotations:  "); fields_type_annotations()->print_value_on(st); st->cr();
  2841   {
  2844   {
  2842     bool have_pv = false;
  2845     bool have_pv = false;
  2843     // previous versions are linked together through the InstanceKlass
  2846     // previous versions are linked together through the InstanceKlass
  2844     for (InstanceKlass* pv_node = _previous_versions;
  2847     for (InstanceKlass* pv_node = previous_versions();
  2845          pv_node != NULL;
  2848          pv_node != NULL;
  2846          pv_node = pv_node->previous_versions()) {
  2849          pv_node = pv_node->previous_versions()) {
  2847       if (!have_pv)
  2850       if (!have_pv)
  2848         st->print(BULLET"previous version:  ");
  2851         st->print(BULLET"previous version:  ");
  2849       have_pv = true;
  2852       have_pv = true;
  3332   assert(good_state || state == allocated, "illegal state transition");
  3335   assert(good_state || state == allocated, "illegal state transition");
  3333   _init_state = (u1)state;
  3336   _init_state = (u1)state;
  3334 }
  3337 }
  3335 #endif
  3338 #endif
  3336 
  3339 
  3337 
  3340 #if INCLUDE_JVMTI
  3338 
  3341 
  3339 // RedefineClasses() support for previous versions:
  3342 // RedefineClasses() support for previous versions:
  3340 int InstanceKlass::_previous_version_count = 0;
  3343 int InstanceKlass::_previous_version_count = 0;
  3341 
  3344 
  3342 // Purge previous versions before adding new previous versions of the class.
  3345 // Purge previous versions before adding new previous versions of the class.
  3547   link_previous_versions(scratch_class());
  3550   link_previous_versions(scratch_class());
  3548   // Update count for class unloading.
  3551   // Update count for class unloading.
  3549   _previous_version_count++;
  3552   _previous_version_count++;
  3550 } // end add_previous_version()
  3553 } // end add_previous_version()
  3551 
  3554 
       
  3555 #endif // INCLUDE_JVMTI
  3552 
  3556 
  3553 Method* InstanceKlass::method_with_idnum(int idnum) {
  3557 Method* InstanceKlass::method_with_idnum(int idnum) {
  3554   Method* m = NULL;
  3558   Method* m = NULL;
  3555   if (idnum < methods()->length()) {
  3559   if (idnum < methods()->length()) {
  3556     m = methods()->at(idnum);
  3560     m = methods()->at(idnum);
  3596   }
  3600   }
  3597   Method* method = holder->method_with_orig_idnum(idnum);
  3601   Method* method = holder->method_with_orig_idnum(idnum);
  3598   return method;
  3602   return method;
  3599 }
  3603 }
  3600 
  3604 
  3601 
  3605 #if INCLUDE_JVMTI
  3602 jint InstanceKlass::get_cached_class_file_len() {
  3606 jint InstanceKlass::get_cached_class_file_len() {
  3603   return VM_RedefineClasses::get_cached_class_file_len(_cached_class_file);
  3607   return VM_RedefineClasses::get_cached_class_file_len(_cached_class_file);
  3604 }
  3608 }
  3605 
  3609 
  3606 unsigned char * InstanceKlass::get_cached_class_file_bytes() {
  3610 unsigned char * InstanceKlass::get_cached_class_file_bytes() {
  3607   return VM_RedefineClasses::get_cached_class_file_bytes(_cached_class_file);
  3611   return VM_RedefineClasses::get_cached_class_file_bytes(_cached_class_file);
  3608 }
  3612 }
       
  3613 #endif