Lines Matching refs:jni_env

221 static std::string GetClassName(jvmtiEnv* jenv, JNIEnv* jni_env, jclass klass) {  in GetClassName()  argument
225 if (jni_env != nullptr) { in GetClassName()
226 JvmtiErrorToException(jni_env, jenv, result); in GetClassName()
297 JNIEnv* jni_env, in ClassLoadCallback() argument
300 std::string name = GetClassName(jenv, jni_env, klass); in ClassLoadCallback()
304 std::string thread_name = GetThreadName(jenv, jni_env, thread); in ClassLoadCallback()
319 JNIEnv* jni_env, in ClassPrepareCallback() argument
322 std::string name = GetClassName(jenv, jni_env, klass); in ClassPrepareCallback()
326 std::string thread_name = GetThreadName(jenv, jni_env, thread); in ClassPrepareCallback()
333 std::string cur_thread_name = GetThreadName(jenv, jni_env, nullptr); in ClassPrepareCallback()
342 static std::string GetThreadName(jvmtiEnv* jenv, JNIEnv* jni_env, jthread thread) { in GetThreadName() argument
346 if (jni_env != nullptr) { in GetThreadName()
347 JvmtiErrorToException(jni_env, jenv, result); in GetThreadName()
356 jni_env->DeleteLocalRef(info.context_class_loader); in GetThreadName()
357 jni_env->DeleteLocalRef(info.thread_group); in GetThreadName()
393 JNIEnv* jni_env, in ClassLoadCallback() argument
396 std::string name = GetClassName(jenv, jni_env, klass); in ClassLoadCallback()
399 stored_class_ = jni_env->NewGlobalRef(klass); in ClassLoadCallback()
400 weakly_stored_class_ = jni_env->NewWeakGlobalRef(klass); in ClassLoadCallback()
403 local_stored_class_ = jni_env->NewLocalRef(klass); in ClassLoadCallback()
405 SetOrCompare(jni_env, klass, true); in ClassLoadCallback()
410 JNIEnv* jni_env, in ClassPrepareCallback() argument
413 std::string name = GetClassName(jenv, jni_env, klass); in ClassPrepareCallback()
416 CHECK(jni_env->IsSameObject(stored_class_, klass)); in ClassPrepareCallback()
417 CHECK(jni_env->IsSameObject(weakly_stored_class_, klass)); in ClassPrepareCallback()
418 CHECK(jni_env->IsSameObject(local_stored_class_, klass)); in ClassPrepareCallback()
420 SetOrCompare(jni_env, klass, false); in ClassPrepareCallback()
425 static void SetOrCompare(JNIEnv* jni_env, jobject value, bool set) { in SetOrCompare() argument
429 jfieldID field = jni_env->GetStaticFieldID(storage_class_, kStorageFieldName, kStorageFieldSig); in SetOrCompare()
433 jni_env->SetStaticObjectField(storage_class_, field, value); in SetOrCompare()
434 CHECK(!jni_env->ExceptionCheck()); in SetOrCompare()
436 ScopedLocalRef<jobject> stored(jni_env, jni_env->GetStaticObjectField(storage_class_, field)); in SetOrCompare()
437 CHECK(jni_env->IsSameObject(value, stored.get())); in SetOrCompare()
441 ScopedLocalRef<jclass> weak_ref_class(jni_env, jni_env->FindClass(kWeakClassName)); in SetOrCompare()
443 jfieldID weak_field = jni_env->GetStaticFieldID(storage_class_, in SetOrCompare()
449 jmethodID weak_init = jni_env->GetMethodID(weak_ref_class.get(), "<init>", kWeakInitSig); in SetOrCompare()
451 ScopedLocalRef<jobject> weak_obj(jni_env, jni_env->NewObject(weak_ref_class.get(), in SetOrCompare()
455 jni_env->SetStaticObjectField(storage_class_, weak_field, weak_obj.get()); in SetOrCompare()
456 CHECK(!jni_env->ExceptionCheck()); in SetOrCompare()
459 jmethodID get_referent = jni_env->GetMethodID(weak_ref_class.get(), "get", kWeakGetSig); in SetOrCompare()
461 ScopedLocalRef<jobject> weak_obj(jni_env, jni_env->GetStaticObjectField(storage_class_, in SetOrCompare()
464 ScopedLocalRef<jobject> weak_referent(jni_env, jni_env->CallObjectMethod(weak_obj.get(), in SetOrCompare()
467 CHECK(jni_env->IsSameObject(value, weak_referent.get())); in SetOrCompare()