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" |
| 9 | #include "macros.h" |
Elliott Hughes | bbd7671 | 2011-08-17 10:25:24 -0700 | [diff] [blame^] | 10 | #include "reference_table.h" |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 11 | |
| 12 | namespace art { |
| 13 | |
Elliott Hughes | f2682d5 | 2011-08-15 16:37:04 -0700 | [diff] [blame] | 14 | class Runtime; |
Elliott Hughes | 40ef99e | 2011-08-11 17:44:34 -0700 | [diff] [blame] | 15 | class Thread; |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 16 | |
Elliott Hughes | f2682d5 | 2011-08-15 16:37:04 -0700 | [diff] [blame] | 17 | struct JavaVMExt { |
Elliott Hughes | bbd7671 | 2011-08-17 10:25:24 -0700 | [diff] [blame^] | 18 | JavaVMExt(Runtime* runtime); |
| 19 | |
Elliott Hughes | f2682d5 | 2011-08-15 16:37:04 -0700 | [diff] [blame] | 20 | // Must be first to correspond with JNIEnv. |
| 21 | const struct JNIInvokeInterface* fns; |
| 22 | |
| 23 | Runtime* runtime; |
Elliott Hughes | bbd7671 | 2011-08-17 10:25:24 -0700 | [diff] [blame^] | 24 | |
| 25 | // Used to hold references to pinned primitive arrays. |
| 26 | ReferenceTable pin_table; |
Elliott Hughes | f2682d5 | 2011-08-15 16:37:04 -0700 | [diff] [blame] | 27 | }; |
| 28 | |
Elliott Hughes | 40ef99e | 2011-08-11 17:44:34 -0700 | [diff] [blame] | 29 | struct JNIEnvExt { |
Elliott Hughes | bbd7671 | 2011-08-17 10:25:24 -0700 | [diff] [blame^] | 30 | JNIEnvExt(Thread* self); |
| 31 | |
Elliott Hughes | f2682d5 | 2011-08-15 16:37:04 -0700 | [diff] [blame] | 32 | // Must be first to correspond with JavaVM. |
| 33 | const struct JNINativeInterface* fns; |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 34 | |
Elliott Hughes | 40ef99e | 2011-08-11 17:44:34 -0700 | [diff] [blame] | 35 | Thread* self; |
Carl Shapiro | ea4dca8 | 2011-08-01 13:45:38 -0700 | [diff] [blame] | 36 | |
Elliott Hughes | 40ef99e | 2011-08-11 17:44:34 -0700 | [diff] [blame] | 37 | // Are we in a "critical" JNI call? |
| 38 | bool critical; |
Carl Shapiro | 2ed144c | 2011-07-26 16:52:08 -0700 | [diff] [blame] | 39 | |
Elliott Hughes | bbd7671 | 2011-08-17 10:25:24 -0700 | [diff] [blame^] | 40 | // Entered JNI monitors, for bulk exit on thread detach. |
| 41 | ReferenceTable monitor_table; |
| 42 | |
Elliott Hughes | 40ef99e | 2011-08-11 17:44:34 -0700 | [diff] [blame] | 43 | // Used to help call synchronized native methods. |
| 44 | // TODO: make jni_compiler.cc do the indirection itself. |
| 45 | void (*MonitorEnterHelper)(JNIEnv*, jobject); |
| 46 | void (*MonitorExitHelper)(JNIEnv*, jobject); |
Carl Shapiro | ea4dca8 | 2011-08-01 13:45:38 -0700 | [diff] [blame] | 47 | }; |
| 48 | |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 49 | } // namespace art |
Carl Shapiro | ea4dca8 | 2011-08-01 13:45:38 -0700 | [diff] [blame] | 50 | |
Ian Rogers | df20fe0 | 2011-07-20 20:34:16 -0700 | [diff] [blame] | 51 | #endif // ART_SRC_JNI_INTERNAL_H_ |