hotspot/src/share/vm/oops/instanceKlass.cpp
changeset 46505 fd4bc78630b1
parent 46464 6432a858a220
child 46553 7030aea81558
equal deleted inserted replaced
46504:38048d4d20e7 46505:fd4bc78630b1
  2129   if (jmeths != (jmethodID*)NULL) {
  2129   if (jmeths != (jmethodID*)NULL) {
  2130     release_set_methods_jmethod_ids(NULL);
  2130     release_set_methods_jmethod_ids(NULL);
  2131     FreeHeap(jmeths);
  2131     FreeHeap(jmeths);
  2132   }
  2132   }
  2133 
  2133 
  2134   // Deallocate MemberNameTable
       
  2135   {
       
  2136     Mutex* lock_or_null = SafepointSynchronize::is_at_safepoint() ? NULL : MemberNameTable_lock;
       
  2137     MutexLockerEx ml(lock_or_null, Mutex::_no_safepoint_check_flag);
       
  2138     MemberNameTable* mnt = member_names();
       
  2139     if (mnt != NULL) {
       
  2140       delete mnt;
       
  2141       set_member_names(NULL);
       
  2142     }
       
  2143   }
       
  2144 
       
  2145   // Release dependencies.
  2134   // Release dependencies.
  2146   // It is desirable to use DC::remove_all_dependents() here, but, unfortunately,
  2135   // It is desirable to use DC::remove_all_dependents() here, but, unfortunately,
  2147   // it is not safe (see JDK-8143408). The problem is that the klass dependency
  2136   // it is not safe (see JDK-8143408). The problem is that the klass dependency
  2148   // context can contain live dependencies, since there's a race between nmethod &
  2137   // context can contain live dependencies, since there's a race between nmethod &
  2149   // klass unloading. If the klass is dead when nmethod unloading happens, relevant
  2138   // klass unloading. If the klass is dead when nmethod unloading happens, relevant
  2766   }
  2755   }
  2767   if (best != NULL && best->comp_level() >= comp_level && match_level == false) {
  2756   if (best != NULL && best->comp_level() >= comp_level && match_level == false) {
  2768     return best;
  2757     return best;
  2769   }
  2758   }
  2770   return NULL;
  2759   return NULL;
  2771 }
       
  2772 
       
  2773 oop InstanceKlass::add_member_name(Handle mem_name, bool intern) {
       
  2774   jweak mem_name_wref = JNIHandles::make_weak_global(mem_name);
       
  2775   MutexLocker ml(MemberNameTable_lock);
       
  2776   DEBUG_ONLY(NoSafepointVerifier nsv);
       
  2777 
       
  2778   // Check if method has been redefined while taking out MemberNameTable_lock, if so
       
  2779   // return false.  We cannot cache obsolete methods. They will crash when the function
       
  2780   // is called!
       
  2781   Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mem_name());
       
  2782   if (method->is_obsolete()) {
       
  2783     return NULL;
       
  2784   } else if (method->is_old()) {
       
  2785     // Replace method with redefined version
       
  2786     java_lang_invoke_MemberName::set_vmtarget(mem_name(), method_with_idnum(method->method_idnum()));
       
  2787   }
       
  2788 
       
  2789   if (_member_names == NULL) {
       
  2790     _member_names = new (ResourceObj::C_HEAP, mtClass) MemberNameTable(idnum_allocated_count());
       
  2791   }
       
  2792   if (intern) {
       
  2793     return _member_names->find_or_add_member_name(mem_name_wref);
       
  2794   } else {
       
  2795     return _member_names->add_member_name(mem_name_wref);
       
  2796   }
       
  2797 }
  2760 }
  2798 
  2761 
  2799 // -----------------------------------------------------------------------------------------------------
  2762 // -----------------------------------------------------------------------------------------------------
  2800 // Printing
  2763 // Printing
  2801 
  2764