MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / loadMethodIDs

Method loadMethodIDs

src/vmEntry.cpp:371–401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

369}
370
371void VM::loadMethodIDs(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, bool update_count) {
372 if (loadAcquire(_jmethod_id_count) > JMETHOD_ID_LIMIT) {
373 if (__sync_bool_compare_and_swap(&_jmethod_id_count_warned, false, true)) {
374 Log::warn("Total number of generated jmethod-ids exceeds %d, stop generating more", JMETHOD_ID_LIMIT);
375 }
376 return;
377 }
378 if (VMStructs::hasClassLoaderData()) {
379 VMKlass* vmklass = VMKlass::fromJavaClass(jni, klass);
380 int method_count = vmklass->methodCount();
381 if (method_count > 0) {
382 ClassLoaderData* cld = vmklass->classLoaderData();
383 cld->lock();
384 // Workaround for JVM bug: preallocate space for jmethodIDs
385 // at the beginning of the list (rather than at the end)
386 for (int i = 0; i < method_count; i += MethodList::SIZE) {
387 *cld->methodList() = new MethodList(*cld->methodList());
388 }
389 cld->unlock();
390 }
391 }
392
393 jint method_count;
394 jmethodID* methods;
395 if (jvmti->GetClassMethods(klass, &method_count, &methods) == 0) {
396 if (update_count) {
397 atomicInc(_jmethod_id_count, method_count);
398 }
399 jvmti->Deallocate((unsigned char*)methods);
400 }
401}
402
403void VM::loadAllMethodIDs(jvmtiEnv* jvmti, JNIEnv* jni) {
404 jint class_count;

Callers

nothing calls this directly

Calls 7

loadAcquireFunction · 0.85
atomicIncFunction · 0.85
methodCountMethod · 0.80
classLoaderDataMethod · 0.80
methodListMethod · 0.80
lockMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected