From 33c2ad1459746e53863dc5fddf72c186b6e0078c Mon Sep 17 00:00:00 2001 From: Xianzhi Yu Date: Fri, 29 Jul 2022 16:25:30 +0800 Subject: [PATCH 1/2] fix jni address cast bug --- inference/engine/src/BoltModel_Jni.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inference/engine/src/BoltModel_Jni.cpp b/inference/engine/src/BoltModel_Jni.cpp index 32957760..ca254146 100644 --- a/inference/engine/src/BoltModel_Jni.cpp +++ b/inference/engine/src/BoltModel_Jni.cpp @@ -267,7 +267,7 @@ extern "C" JNIEXPORT jlong JNICALL BOLT_JNI_PREFIX(BoltModel_createModel)( const char *affinityPtr = env->GetStringUTFChars(affinity, JNI_FALSE); std::string affinity_str = (std::string)affinityPtr; AFFINITY_TYPE affinity_cur = str2AFFINITY_TYPE(affinity_str); - long modelAddr = (long long)CreateModel(modelPathPtr, affinity_cur, NULL); + long long modelAddr = (long long)CreateModel(modelPathPtr, affinity_cur, NULL); ModelHandleInfo *ihInfo = (ModelHandleInfo *)modelAddr; if (nullptr == ihInfo) { UNI_ERROR_LOG("Bolt instance not created\n"); @@ -285,7 +285,7 @@ extern "C" JNIEXPORT jlong JNICALL BOLT_JNI_PREFIX(BoltModel_cloneModel)( UNI_DEBUG_LOG("JNI %s...\n", __FUNCTION__); ModelHandle handle = (ModelHandle)modelAddr; ModelHandle cloneHandle = CloneModel(handle); - long ret = (long long)cloneHandle; + long long ret = (long long)cloneHandle; UNI_DEBUG_LOG("JNI %s end.\n", __FUNCTION__); return ret; } @@ -433,7 +433,7 @@ extern "C" JNIEXPORT void JNICALL BOLT_JNI_PREFIX(BoltModel_setRuntimeDeviceDyna UNI_DEBUG_LOG("JNI %s end.\n", __FUNCTION__); } -extern "C" JNIEXPORT void JNICALL BOLT_JNI_PREFIX(BoltModel_setNumThreads)(JNIEnv *env, jint threads) +extern "C" JNIEXPORT void JNICALL BOLT_JNI_PREFIX(BoltModel_setNumThreads)(JNIEnv *env, jobject, jint threads) { UNI_DEBUG_LOG("JNI %s...\n", __FUNCTION__); SetNumThreads(threads); From 082853de0e078f83789e4d209f3f93442a800189 Mon Sep 17 00:00:00 2001 From: Xianzhi Yu Date: Fri, 29 Jul 2022 16:26:48 +0800 Subject: [PATCH 2/2] Update BoltModel.h --- inference/engine/include/BoltModel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inference/engine/include/BoltModel.h b/inference/engine/include/BoltModel.h index 3a34d9a1..676e75b3 100644 --- a/inference/engine/include/BoltModel.h +++ b/inference/engine/include/BoltModel.h @@ -110,7 +110,7 @@ JNIEXPORT void JNICALL BOLT_JNI_PREFIX(BoltModel_setRuntimeDeviceDynamicJNI)( * Method: setNumThreads * Signature: (I)V */ -JNIEXPORT void JNICALL BOLT_JNI_PREFIX(BoltModel_setNumThreads)(JNIEnv *, jint); +JNIEXPORT void JNICALL BOLT_JNI_PREFIX(BoltModel_setNumThreads)(JNIEnv *, jobject, jint); /* * Class: BoltModel