Add -Xcheck:jni.
I think this is as complete as possible right now. The remaining
two #if 0 sections require:
1. a way to get the Method* of the current native method.
2. a way to get the Class* of the type of a given Field*.
Change-Id: I331586022095fb36ccc10c9ac1890a59a9224d01
diff --git a/src/indirect_reference_table.cc b/src/indirect_reference_table.cc
index 76d5379..6e5446f 100644
--- a/src/indirect_reference_table.cc
+++ b/src/indirect_reference_table.cc
@@ -15,20 +15,21 @@
*/
#include "indirect_reference_table.h"
+#include "jni_internal.h"
#include "reference_table.h"
+#include "runtime.h"
#include "utils.h"
#include <cstdlib>
namespace art {
-// TODO: implement this for art. (only needed for non-CheckJNI operation.)
static void AbortMaybe() {
- // If CheckJNI is on, it'll give a more detailed error before aborting.
- // Otherwise, we want to abort rather than hand back a bad reference.
-// if (!gDvmJni.useCheckJni) {
-// LOG(FATAL) << "bye!";
-// }
+ // If -Xcheck:jni is on, it'll give a more detailed error before aborting.
+ if (!Runtime::Current()->GetJavaVM()->check_jni) {
+ // Otherwise, we want to abort rather than hand back a bad reference.
+ LOG(FATAL) << "JNI ERROR (app bug): see above.";
+ }
}
IndirectReferenceTable::IndirectReferenceTable(size_t initialCount,