Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
2 | |||||
3 | #ifndef ART_SRC_JNI_INTERNAL_H_ | ||||
4 | #define ART_SRC_JNI_INTERNAL_H_ | ||||
5 | |||||
6 | #include "jni.h" | ||||
Brian Carlstrom | 578bbdc | 2011-07-21 14:07:47 -0700 | [diff] [blame] | 7 | |
8 | #include "assembler.h" | ||||
Elliott Hughes | 6c1a394 | 2011-08-17 15:00:06 -0700 | [diff] [blame^] | 9 | #include "indirect_reference_table.h" |
Brian Carlstrom | 578bbdc | 2011-07-21 14:07:47 -0700 | [diff] [blame] | 10 | #include "macros.h" |
Elliott Hughes | bbd7671 | 2011-08-17 10:25:24 -0700 | [diff] [blame] | 11 | #include "reference_table.h" |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 12 | |
13 | namespace art { | ||||
14 | |||||
Elliott Hughes | f2682d5 | 2011-08-15 16:37:04 -0700 | [diff] [blame] | 15 | class Runtime; |
Elliott Hughes | 40ef99e | 2011-08-11 17:44:34 -0700 | [diff] [blame] | 16 | class Thread; |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 17 | |
Elliott Hughes | f2682d5 | 2011-08-15 16:37:04 -0700 | [diff] [blame] | 18 | struct JavaVMExt { |
Elliott Hughes | 515a5bc | 2011-08-17 11:08:34 -0700 | [diff] [blame] | 19 | JavaVMExt(Runtime* runtime, bool check_jni); |
Elliott Hughes | bbd7671 | 2011-08-17 10:25:24 -0700 | [diff] [blame] | 20 | |
Elliott Hughes | f2682d5 | 2011-08-15 16:37:04 -0700 | [diff] [blame] | 21 | // Must be first to correspond with JNIEnv. |
22 | const struct JNIInvokeInterface* fns; | ||||
23 | |||||
24 | Runtime* runtime; | ||||
Elliott Hughes | bbd7671 | 2011-08-17 10:25:24 -0700 | [diff] [blame] | 25 | |
Elliott Hughes | 515a5bc | 2011-08-17 11:08:34 -0700 | [diff] [blame] | 26 | bool check_jni; |
27 | |||||
Elliott Hughes | bbd7671 | 2011-08-17 10:25:24 -0700 | [diff] [blame] | 28 | // Used to hold references to pinned primitive arrays. |
29 | ReferenceTable pin_table; | ||||
Elliott Hughes | 6c1a394 | 2011-08-17 15:00:06 -0700 | [diff] [blame^] | 30 | |
31 | // JNI global references. | ||||
32 | IndirectReferenceTable globals; | ||||
33 | |||||
34 | // JNI weak global references. | ||||
35 | IndirectReferenceTable weak_globals; | ||||
Elliott Hughes | f2682d5 | 2011-08-15 16:37:04 -0700 | [diff] [blame] | 36 | }; |
37 | |||||
Elliott Hughes | 40ef99e | 2011-08-11 17:44:34 -0700 | [diff] [blame] | 38 | struct JNIEnvExt { |
Elliott Hughes | 515a5bc | 2011-08-17 11:08:34 -0700 | [diff] [blame] | 39 | JNIEnvExt(Thread* self, bool check_jni); |
Elliott Hughes | bbd7671 | 2011-08-17 10:25:24 -0700 | [diff] [blame] | 40 | |
Elliott Hughes | f2682d5 | 2011-08-15 16:37:04 -0700 | [diff] [blame] | 41 | // Must be first to correspond with JavaVM. |
42 | const struct JNINativeInterface* fns; | ||||
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 43 | |
Elliott Hughes | 40ef99e | 2011-08-11 17:44:34 -0700 | [diff] [blame] | 44 | Thread* self; |
Carl Shapiro | ea4dca8 | 2011-08-01 13:45:38 -0700 | [diff] [blame] | 45 | |
Elliott Hughes | 515a5bc | 2011-08-17 11:08:34 -0700 | [diff] [blame] | 46 | bool check_jni; |
47 | |||||
Elliott Hughes | 40ef99e | 2011-08-11 17:44:34 -0700 | [diff] [blame] | 48 | // Are we in a "critical" JNI call? |
49 | bool critical; | ||||
Carl Shapiro | 2ed144c | 2011-07-26 16:52:08 -0700 | [diff] [blame] | 50 | |
Elliott Hughes | bbd7671 | 2011-08-17 10:25:24 -0700 | [diff] [blame] | 51 | // Entered JNI monitors, for bulk exit on thread detach. |
Elliott Hughes | 6c1a394 | 2011-08-17 15:00:06 -0700 | [diff] [blame^] | 52 | ReferenceTable monitors; |
53 | |||||
54 | // JNI local references. | ||||
55 | IndirectReferenceTable locals; | ||||
Carl Shapiro | ea4dca8 | 2011-08-01 13:45:38 -0700 | [diff] [blame] | 56 | }; |
57 | |||||
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 58 | } // namespace art |
Carl Shapiro | ea4dca8 | 2011-08-01 13:45:38 -0700 | [diff] [blame] | 59 | |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 60 | #endif // ART_SRC_JNI_INTERNAL_H_ |