Lines Matching refs:jni_env
222 static std::string GetClassName(jvmtiEnv* jenv, JNIEnv* jni_env, jclass klass) { in GetClassName() argument
226 if (jni_env != nullptr) { in GetClassName()
227 JvmtiErrorToException(jni_env, jenv, result); in GetClassName()
298 JNIEnv* jni_env, in ClassLoadCallback() argument
301 std::string name = GetClassName(jenv, jni_env, klass); in ClassLoadCallback()
305 std::string thread_name = GetThreadName(jenv, jni_env, thread); in ClassLoadCallback()
320 JNIEnv* jni_env, in ClassPrepareCallback() argument
323 std::string name = GetClassName(jenv, jni_env, klass); in ClassPrepareCallback()
327 std::string thread_name = GetThreadName(jenv, jni_env, thread); in ClassPrepareCallback()
334 std::string cur_thread_name = GetThreadName(jenv, jni_env, nullptr); in ClassPrepareCallback()
343 static std::string GetThreadName(jvmtiEnv* jenv, JNIEnv* jni_env, jthread thread) { in GetThreadName() argument
347 if (jni_env != nullptr) { in GetThreadName()
348 JvmtiErrorToException(jni_env, jenv, result); in GetThreadName()
357 jni_env->DeleteLocalRef(info.context_class_loader); in GetThreadName()
358 jni_env->DeleteLocalRef(info.thread_group); in GetThreadName()
451 JNIEnv* jni_env, in ClassLoadCallback() argument
454 std::string name = GetClassName(jenv, jni_env, klass); in ClassLoadCallback()
457 stored_class_ = jni_env->NewGlobalRef(klass); in ClassLoadCallback()
458 weakly_stored_class_ = jni_env->NewWeakGlobalRef(klass); in ClassLoadCallback()
460 agent_thread_ = static_cast<jthread>(jni_env->NewGlobalRef(RunEventThread<jobject>( in ClassLoadCallback()
461 "local-ref", jenv, jni_env, &AgentThreadTest, static_cast<jobject*>(&stored_class_)))); in ClassLoadCallback()
467 SetOrCompare(jni_env, klass, true); in ClassLoadCallback()
472 JNIEnv* jni_env, in ClassPrepareCallback() argument
475 std::string name = GetClassName(jenv, jni_env, klass); in ClassPrepareCallback()
478 CHECK(jni_env->IsSameObject(stored_class_, klass)); in ClassPrepareCallback()
479 CHECK(jni_env->IsSameObject(weakly_stored_class_, klass)); in ClassPrepareCallback()
486 SetOrCompare(jni_env, klass, false); in ClassPrepareCallback()
487 JoinTread(jni_env, agent_thread_); in ClassPrepareCallback()
492 static void SetOrCompare(JNIEnv* jni_env, jobject value, bool set) { in SetOrCompare() argument
496 jfieldID field = jni_env->GetStaticFieldID(storage_class_, kStorageFieldName, kStorageFieldSig); in SetOrCompare()
500 jni_env->SetStaticObjectField(storage_class_, field, value); in SetOrCompare()
501 CHECK(!jni_env->ExceptionCheck()); in SetOrCompare()
503 ScopedLocalRef<jobject> stored(jni_env, jni_env->GetStaticObjectField(storage_class_, field)); in SetOrCompare()
504 CHECK(jni_env->IsSameObject(value, stored.get())); in SetOrCompare()
508 ScopedLocalRef<jclass> weak_ref_class(jni_env, jni_env->FindClass(kWeakClassName)); in SetOrCompare()
510 jfieldID weak_field = jni_env->GetStaticFieldID(storage_class_, in SetOrCompare()
516 jmethodID weak_init = jni_env->GetMethodID(weak_ref_class.get(), "<init>", kWeakInitSig); in SetOrCompare()
518 ScopedLocalRef<jobject> weak_obj(jni_env, jni_env->NewObject(weak_ref_class.get(), in SetOrCompare()
522 jni_env->SetStaticObjectField(storage_class_, weak_field, weak_obj.get()); in SetOrCompare()
523 CHECK(!jni_env->ExceptionCheck()); in SetOrCompare()
526 jmethodID get_referent = jni_env->GetMethodID(weak_ref_class.get(), "get", kWeakGetSig); in SetOrCompare()
528 ScopedLocalRef<jobject> weak_obj(jni_env, jni_env->GetStaticObjectField(storage_class_, in SetOrCompare()
531 ScopedLocalRef<jobject> weak_referent(jni_env, jni_env->CallObjectMethod(weak_obj.get(), in SetOrCompare()
534 CHECK(jni_env->IsSameObject(value, weak_referent.get())); in SetOrCompare()
610 JNIEnv* jni_env, in Java_art_Test912_runRecursiveClassPrepareEvents()
613 jclass runnable_class = jni_env->FindClass("java/lang/Runnable"); in Java_art_Test912_runRecursiveClassPrepareEvents()
614 jni_env->CallVoidMethod( in Java_art_Test912_runRecursiveClassPrepareEvents()
615 gRunnableGlobal, jni_env->GetMethodID(runnable_class, "run", "()V")); in Java_art_Test912_runRecursiveClassPrepareEvents()