Switch to indirect references rather than direct pointers.
This also required a bit of fiddling to break cyclic dependencies,
now "jni_internal.h" needs Mutex from "thread.h".
Change-Id: I1d6fb2d801c190f72255f5e447a0a8a65cc3e673
diff --git a/src/jni_internal.h b/src/jni_internal.h
index 5d89dd8..74366d3 100644
--- a/src/jni_internal.h
+++ b/src/jni_internal.h
@@ -9,6 +9,7 @@
#include "indirect_reference_table.h"
#include "macros.h"
#include "reference_table.h"
+#include "thread.h"
#include <map>
#include <string>
@@ -17,7 +18,6 @@
class Runtime;
class SharedLibrary;
-class Thread;
struct JavaVMExt {
JavaVMExt(Runtime* runtime, bool check_jni, bool verbose_jni);
@@ -53,9 +53,11 @@
ReferenceTable pin_table;
// JNI global references.
+ Mutex globals_lock;
IndirectReferenceTable globals;
// JNI weak global references.
+ Mutex weak_globals_lock;
IndirectReferenceTable weak_globals;
std::map<std::string, SharedLibrary*> libraries;