From 49dfe083f0c86d730f67e5e8275d8ceae6894b88 Mon Sep 17 00:00:00 2001 From: Yizhi Liu Date: Thu, 4 Apr 2019 19:49:08 -0700 Subject: [PATCH] [tvm4j] provide error msg for failure function call (#2967) --- jvm/native/src/main/native/ml_dmlc_tvm_native_c_api.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jvm/native/src/main/native/ml_dmlc_tvm_native_c_api.cc b/jvm/native/src/main/native/ml_dmlc_tvm_native_c_api.cc index fada50ca76e26..d22e0459cdbcb 100644 --- a/jvm/native/src/main/native/ml_dmlc_tvm_native_c_api.cc +++ b/jvm/native/src/main/native/ml_dmlc_tvm_native_c_api.cc @@ -178,6 +178,10 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncCall( int ret = TVMFuncCall(reinterpret_cast(jhandle), &argValues[0], &argTypes[0], numArgs, &retVal, &retTypeCode); + if (ret != 0) { + return ret; + } + for (auto iter = pushedStrs.cbegin(); iter != pushedStrs.cend(); iter++) { env->ReleaseStringUTFChars(iter->first, iter->second); env->DeleteGlobalRef(iter->first);