Lines Matching refs:env
60 JNIEnv* env, in ConvertJavaArrayToDexFiles() argument
66 jsize array_size = env->GetArrayLength(array); in ConvertJavaArrayToDexFiles()
67 if (env->ExceptionCheck() == JNI_TRUE) { in ConvertJavaArrayToDexFiles()
73 jlong* long_data = env->GetLongArrayElements(reinterpret_cast<jlongArray>(array), in ConvertJavaArrayToDexFiles()
75 if (env->ExceptionCheck() == JNI_TRUE) { in ConvertJavaArrayToDexFiles()
85 env->ReleaseLongArrayElements(reinterpret_cast<jlongArray>(array), long_data, JNI_ABORT); in ConvertJavaArrayToDexFiles()
86 return env->ExceptionCheck() != JNI_TRUE; in ConvertJavaArrayToDexFiles()
89 static jlongArray ConvertDexFilesToJavaArray(JNIEnv* env, in ConvertDexFilesToJavaArray() argument
93 jlongArray long_array = env->NewLongArray(static_cast<jsize>(kDexFileIndexStart + vec.size())); in ConvertDexFilesToJavaArray()
94 if (env->ExceptionCheck() == JNI_TRUE) { in ConvertDexFilesToJavaArray()
99 jlong* long_data = env->GetLongArrayElements(long_array, &is_long_data_copied); in ConvertDexFilesToJavaArray()
100 if (env->ExceptionCheck() == JNI_TRUE) { in ConvertDexFilesToJavaArray()
109 env->ReleaseLongArrayElements(long_array, long_data, 0); in ConvertDexFilesToJavaArray()
110 if (env->ExceptionCheck() == JNI_TRUE) { in ConvertDexFilesToJavaArray()
135 NullableScopedUtfChars(JNIEnv* env, jstring s) : mEnv(env), mString(s) { in NullableScopedUtfChars() argument
136 mUtfChars = (s != nullptr) ? env->GetStringUTFChars(s, nullptr) : nullptr; in NullableScopedUtfChars()
169 JNIEnv* env, in CreateCookieFromOatFileManagerResult() argument
175 ScopedObjectAccess soa(env); in CreateCookieFromOatFileManagerResult()
187 jlongArray array = ConvertDexFilesToJavaArray(env, oat_file, dex_files); in CreateCookieFromOatFileManagerResult()
189 ScopedObjectAccess soa(env); in CreateCookieFromOatFileManagerResult()
199 static MemMap AllocateDexMemoryMap(JNIEnv* env, jint start, jint end) { in AllocateDexMemoryMap() argument
201 ScopedObjectAccess soa(env); in AllocateDexMemoryMap()
214 ScopedObjectAccess soa(env); in AllocateDexMemoryMap()
223 ScopedIntArrayAccessor(JNIEnv* env, jintArray arr) : env_(env), array_(arr) { in ScopedIntArrayAccessor()
240 static jobject DexFile_openInMemoryDexFilesNative(JNIEnv* env, in DexFile_openInMemoryDexFilesNative() argument
248 jsize buffers_length = env->GetArrayLength(buffers); in DexFile_openInMemoryDexFilesNative()
249 CHECK_EQ(buffers_length, env->GetArrayLength(arrays)); in DexFile_openInMemoryDexFilesNative()
250 CHECK_EQ(buffers_length, env->GetArrayLength(jstarts)); in DexFile_openInMemoryDexFilesNative()
251 CHECK_EQ(buffers_length, env->GetArrayLength(jends)); in DexFile_openInMemoryDexFilesNative()
253 ScopedIntArrayAccessor starts(env, jstarts); in DexFile_openInMemoryDexFilesNative()
254 ScopedIntArrayAccessor ends(env, jends); in DexFile_openInMemoryDexFilesNative()
260 jobject buffer = env->GetObjectArrayElement(buffers, i); in DexFile_openInMemoryDexFilesNative()
261 jbyteArray array = reinterpret_cast<jbyteArray>(env->GetObjectArrayElement(arrays, i)); in DexFile_openInMemoryDexFilesNative()
265 MemMap dex_data = AllocateDexMemoryMap(env, start, end); in DexFile_openInMemoryDexFilesNative()
273 uint8_t* base_address = reinterpret_cast<uint8_t*>(env->GetDirectBufferAddress(buffer)); in DexFile_openInMemoryDexFilesNative()
275 ScopedObjectAccess soa(env); in DexFile_openInMemoryDexFilesNative()
284 env->GetByteArrayRegion(array, start, end - start, destination); in DexFile_openInMemoryDexFilesNative()
300 return CreateCookieFromOatFileManagerResult(env, dex_files, oat_file, error_msgs); in DexFile_openInMemoryDexFilesNative()
304 static jobject DexFile_openDexFileNative(JNIEnv* env, in DexFile_openDexFileNative() argument
311 ScopedUtfChars sourceName(env, javaSourceName); in DexFile_openDexFileNative()
324 return CreateCookieFromOatFileManagerResult(env, dex_files, oat_file, error_msgs); in DexFile_openDexFileNative()
327 static jstring DexFile_getClassLoaderContext(JNIEnv* env, in DexFile_getClassLoaderContext() argument
340 return env->NewStringUTF(str_context.c_str()); in DexFile_getClassLoaderContext()
343 static void DexFile_verifyInBackgroundNative(JNIEnv* env, in DexFile_verifyInBackgroundNative() argument
354 if (!ConvertJavaArrayToDexFiles(env, cookie, dex_files, oat_file)) { in DexFile_verifyInBackgroundNative()
360 ScopedUtfChars class_loader_context_utf(env, class_loader_context); in DexFile_verifyInBackgroundNative()
361 if (env->ExceptionCheck()) { in DexFile_verifyInBackgroundNative()
373 static jboolean DexFile_closeDexFile(JNIEnv* env, jclass, jobject cookie) { in DexFile_closeDexFile() argument
376 if (!ConvertJavaArrayToDexFiles(env, cookie, dex_files, oat_file)) { in DexFile_closeDexFile()
386 ScopedObjectAccess soa(env); in DexFile_closeDexFile()
419 static jclass DexFile_defineClassNative(JNIEnv* env, in DexFile_defineClassNative() argument
427 if (!ConvertJavaArrayToDexFiles(env, cookie, /*out*/ dex_files, /*out*/ oat_file)) { in DexFile_defineClassNative()
429 DCHECK(env->ExceptionCheck()); in DexFile_defineClassNative()
433 ScopedUtfChars class_name(env, javaName); in DexFile_defineClassNative()
444 ScopedObjectAccess soa(env); in DexFile_defineClassNative()
485 static jobjectArray DexFile_getClassNameList(JNIEnv* env, jclass, jobject cookie) { in DexFile_getClassNameList() argument
488 if (!ConvertJavaArrayToDexFiles(env, cookie, /*out */ dex_files, /* out */ oat_file)) { in DexFile_getClassNameList()
489 DCHECK(env->ExceptionCheck()); in DexFile_getClassNameList()
505 jobjectArray result = env->NewObjectArray(descriptors.size(), in DexFile_getClassNameList()
514 ScopedLocalRef<jstring> jdescriptor(env, env->NewStringUTF(descriptor.c_str())); in DexFile_getClassNameList()
518 env->SetObjectArrayElement(result, i, jdescriptor.get()); in DexFile_getClassNameList()
524 static jint GetDexOptNeeded(JNIEnv* env, in GetDexOptNeeded() argument
533 ScopedLocalRef<jclass> fnfe(env, env->FindClass("java/io/FileNotFoundException")); in GetDexOptNeeded()
535 env->ThrowNew(fnfe.get(), message); in GetDexOptNeeded()
541 ScopedLocalRef<jclass> iae(env, env->FindClass("java/lang/IllegalArgumentException")); in GetDexOptNeeded()
543 env->ThrowNew(iae.get(), message.c_str()); in GetDexOptNeeded()
549 ScopedLocalRef<jclass> iae(env, env->FindClass("java/lang/IllegalArgumentException")); in GetDexOptNeeded()
551 env->ThrowNew(iae.get(), message.c_str()); in GetDexOptNeeded()
560 ScopedLocalRef<jclass> iae(env, env->FindClass("java/lang/IllegalArgumentException")); in GetDexOptNeeded()
563 env->ThrowNew(iae.get(), message.c_str()); in GetDexOptNeeded()
584 static jstring DexFile_getDexFileStatus(JNIEnv* env, in DexFile_getDexFileStatus() argument
588 ScopedUtfChars filename(env, javaFilename); in DexFile_getDexFileStatus()
589 if (env->ExceptionCheck()) { in DexFile_getDexFileStatus()
593 ScopedUtfChars instruction_set(env, javaInstructionSet); in DexFile_getDexFileStatus()
594 if (env->ExceptionCheck()) { in DexFile_getDexFileStatus()
601 ScopedLocalRef<jclass> iae(env, env->FindClass("java/lang/IllegalArgumentException")); in DexFile_getDexFileStatus()
603 env->ThrowNew(iae.get(), message.c_str()); in DexFile_getDexFileStatus()
609 return env->NewStringUTF(oat_file_assistant.GetStatusDump().c_str()); in DexFile_getDexFileStatus()
614 static jobjectArray DexFile_getDexFileOptimizationStatus(JNIEnv* env, in DexFile_getDexFileOptimizationStatus() argument
618 ScopedUtfChars filename(env, javaFilename); in DexFile_getDexFileOptimizationStatus()
619 if (env->ExceptionCheck()) { in DexFile_getDexFileOptimizationStatus()
623 ScopedUtfChars instruction_set(env, javaInstructionSet); in DexFile_getDexFileOptimizationStatus()
624 if (env->ExceptionCheck()) { in DexFile_getDexFileOptimizationStatus()
631 ScopedLocalRef<jclass> iae(env, env->FindClass("java/lang/IllegalArgumentException")); in DexFile_getDexFileOptimizationStatus()
633 env->ThrowNew(iae.get(), message.c_str()); in DexFile_getDexFileOptimizationStatus()
642 ScopedLocalRef<jstring> j_compilation_filter(env, env->NewStringUTF(compilation_filter.c_str())); in DexFile_getDexFileOptimizationStatus()
646 ScopedLocalRef<jstring> j_compilation_reason(env, env->NewStringUTF(compilation_reason.c_str())); in DexFile_getDexFileOptimizationStatus()
652 jobjectArray result = env->NewObjectArray(2, in DexFile_getDexFileOptimizationStatus()
655 env->SetObjectArrayElement(result, 0, j_compilation_filter.get()); in DexFile_getDexFileOptimizationStatus()
656 env->SetObjectArrayElement(result, 1, j_compilation_reason.get()); in DexFile_getDexFileOptimizationStatus()
661 static jint DexFile_getDexOptNeeded(JNIEnv* env, in DexFile_getDexOptNeeded() argument
669 ScopedUtfChars filename(env, javaFilename); in DexFile_getDexOptNeeded()
670 if (env->ExceptionCheck()) { in DexFile_getDexOptNeeded()
674 ScopedUtfChars instruction_set(env, javaInstructionSet); in DexFile_getDexOptNeeded()
675 if (env->ExceptionCheck()) { in DexFile_getDexOptNeeded()
679 ScopedUtfChars target_compiler_filter(env, javaTargetCompilerFilter); in DexFile_getDexOptNeeded()
680 if (env->ExceptionCheck()) { in DexFile_getDexOptNeeded()
684 NullableScopedUtfChars class_loader_context(env, javaClassLoaderContext); in DexFile_getDexOptNeeded()
685 if (env->ExceptionCheck()) { in DexFile_getDexOptNeeded()
689 return GetDexOptNeeded(env, in DexFile_getDexOptNeeded()
699 static jboolean DexFile_isDexOptNeeded(JNIEnv* env, jclass, jstring javaFilename) { in DexFile_isDexOptNeeded() argument
700 ScopedUtfChars filename_utf(env, javaFilename); in DexFile_isDexOptNeeded()
701 if (env->ExceptionCheck()) { in DexFile_isDexOptNeeded()
708 ScopedLocalRef<jclass> fnfe(env, env->FindClass("java/io/FileNotFoundException")); in DexFile_isDexOptNeeded()
710 env->ThrowNew(fnfe.get(), message); in DexFile_isDexOptNeeded()
718 static jboolean DexFile_isValidCompilerFilter(JNIEnv* env, in DexFile_isValidCompilerFilter() argument
721 ScopedUtfChars compiler_filter(env, javaCompilerFilter); in DexFile_isValidCompilerFilter()
722 if (env->ExceptionCheck()) { in DexFile_isValidCompilerFilter()
731 static jboolean DexFile_isProfileGuidedCompilerFilter(JNIEnv* env, in DexFile_isProfileGuidedCompilerFilter() argument
734 ScopedUtfChars compiler_filter(env, javaCompilerFilter); in DexFile_isProfileGuidedCompilerFilter()
735 if (env->ExceptionCheck()) { in DexFile_isProfileGuidedCompilerFilter()
746 static jstring DexFile_getNonProfileGuidedCompilerFilter(JNIEnv* env, in DexFile_getNonProfileGuidedCompilerFilter() argument
749 ScopedUtfChars compiler_filter(env, javaCompilerFilter); in DexFile_getNonProfileGuidedCompilerFilter()
750 if (env->ExceptionCheck()) { in DexFile_getNonProfileGuidedCompilerFilter()
768 return env->NewStringUTF(new_filter_str.c_str()); in DexFile_getNonProfileGuidedCompilerFilter()
771 static jstring DexFile_getSafeModeCompilerFilter(JNIEnv* env, in DexFile_getSafeModeCompilerFilter() argument
774 ScopedUtfChars compiler_filter(env, javaCompilerFilter); in DexFile_getSafeModeCompilerFilter()
775 if (env->ExceptionCheck()) { in DexFile_getSafeModeCompilerFilter()
793 return env->NewStringUTF(new_filter_str.c_str()); in DexFile_getSafeModeCompilerFilter()
796 static jboolean DexFile_isBackedByOatFile(JNIEnv* env, jclass, jobject cookie) { in DexFile_isBackedByOatFile() argument
799 if (!ConvertJavaArrayToDexFiles(env, cookie, /*out */ dex_files, /* out */ oat_file)) { in DexFile_isBackedByOatFile()
800 DCHECK(env->ExceptionCheck()); in DexFile_isBackedByOatFile()
806 static jobjectArray DexFile_getDexFileOutputPaths(JNIEnv* env, in DexFile_getDexFileOutputPaths() argument
810 ScopedUtfChars filename(env, javaFilename); in DexFile_getDexFileOutputPaths()
811 if (env->ExceptionCheck()) { in DexFile_getDexFileOutputPaths()
815 ScopedUtfChars instruction_set(env, javaInstructionSet); in DexFile_getDexFileOutputPaths()
816 if (env->ExceptionCheck()) { in DexFile_getDexFileOutputPaths()
823 ScopedLocalRef<jclass> iae(env, env->FindClass("java/lang/IllegalArgumentException")); in DexFile_getDexFileOutputPaths()
825 env->ThrowNew(iae.get(), message.c_str()); in DexFile_getDexFileOutputPaths()
841 ScopedLocalRef<jstring> jvdexFilename(env, env->NewStringUTF(vdex_filename.c_str())); in DexFile_getDexFileOutputPaths()
845 ScopedLocalRef<jstring> joatFilename(env, env->NewStringUTF(oat_filename.c_str())); in DexFile_getDexFileOutputPaths()
851 jobjectArray result = env->NewObjectArray(2, in DexFile_getDexFileOutputPaths()
854 env->SetObjectArrayElement(result, 0, jvdexFilename.get()); in DexFile_getDexFileOutputPaths()
855 env->SetObjectArrayElement(result, 1, joatFilename.get()); in DexFile_getDexFileOutputPaths()
860 static jlong DexFile_getStaticSizeOfDexFile(JNIEnv* env, jclass, jobject cookie) { in DexFile_getStaticSizeOfDexFile() argument
863 if (!ConvertJavaArrayToDexFiles(env, cookie, /*out */ dex_files, /* out */ oat_file)) { in DexFile_getStaticSizeOfDexFile()
864 DCHECK(env->ExceptionCheck()); in DexFile_getStaticSizeOfDexFile()
877 static void DexFile_setTrusted(JNIEnv* env, jclass, jobject j_cookie) { in DexFile_setTrusted() argument
879 ScopedObjectAccess soa(env); in DexFile_setTrusted()
889 if (!ConvertJavaArrayToDexFiles(env, j_cookie, dex_files, oat_file)) { in DexFile_setTrusted()
956 void register_dalvik_system_DexFile(JNIEnv* env) { in register_dalvik_system_DexFile() argument