src/share/vm/oops/instanceKlass.cpp
Print this page
*** 2342,2373 ****
return best;
}
return NULL;
}
! void instanceKlass::add_member_name(int index, Handle mem_name) {
jweak mem_name_wref = JNIHandles::make_weak_global(mem_name);
MutexLocker ml(MemberNameTable_lock);
- assert(0 <= index && index < idnum_allocated_count(), "index is out of bounds");
DEBUG_ONLY(No_Safepoint_Verifier nsv);
! if (_member_names == NULL) {
! _member_names = new (ResourceObj::C_HEAP, mtClass) MemberNameTable(idnum_allocated_count());
}
- _member_names->add_member_name(index, mem_name_wref);
- }
- oop instanceKlass::get_member_name(int index) {
- MutexLocker ml(MemberNameTable_lock);
- assert(0 <= index && index < idnum_allocated_count(), "index is out of bounds");
- DEBUG_ONLY(No_Safepoint_Verifier nsv);
-
if (_member_names == NULL) {
! return NULL;
}
! oop mem_name =_member_names->get_member_name(index);
! return mem_name;
}
// -----------------------------------------------------------------------------------------------------
#ifndef PRODUCT
--- 2342,2372 ----
return best;
}
return NULL;
}
! bool instanceKlass::add_member_name(Handle mem_name) {
jweak mem_name_wref = JNIHandles::make_weak_global(mem_name);
MutexLocker ml(MemberNameTable_lock);
DEBUG_ONLY(No_Safepoint_Verifier nsv);
! // Check if method has been redefined while taking out MemberNameTable_lock, if so
! // return false. We cannot cache obsolete methods. They will crash when the function
! // is called!
! methodOop method = (methodOop) java_lang_invoke_MemberName::vmtarget(mem_name());
! if (method->is_obsolete()) {
! return false;
! } else if (method->is_old()) {
! // Replace method with redefined version
! java_lang_invoke_MemberName::set_vmtarget(mem_name(), method_with_idnum(method->method_idnum()));
}
if (_member_names == NULL) {
! _member_names = new (ResourceObj::C_HEAP, mtClass) MemberNameTable(idnum_allocated_count());
}
! _member_names->add_member_name(mem_name_wref);
! return true;
}
// -----------------------------------------------------------------------------------------------------
#ifndef PRODUCT