blob: 03dbfa0359976976e90ca8b42f09993f503890c8 [file] [log] [blame]
Ian Rogersdf20fe02011-07-20 20:34:16 -07001// 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 Carlstrom578bbdc2011-07-21 14:07:47 -07007
8#include "assembler.h"
9#include "macros.h"
Elliott Hughesbbd76712011-08-17 10:25:24 -070010#include "reference_table.h"
Ian Rogersdf20fe02011-07-20 20:34:16 -070011
12namespace art {
13
Elliott Hughesf2682d52011-08-15 16:37:04 -070014class Runtime;
Elliott Hughes40ef99e2011-08-11 17:44:34 -070015class Thread;
Ian Rogersdf20fe02011-07-20 20:34:16 -070016
Elliott Hughesf2682d52011-08-15 16:37:04 -070017struct JavaVMExt {
Elliott Hughesbbd76712011-08-17 10:25:24 -070018 JavaVMExt(Runtime* runtime);
19
Elliott Hughesf2682d52011-08-15 16:37:04 -070020 // Must be first to correspond with JNIEnv.
21 const struct JNIInvokeInterface* fns;
22
23 Runtime* runtime;
Elliott Hughesbbd76712011-08-17 10:25:24 -070024
25 // Used to hold references to pinned primitive arrays.
26 ReferenceTable pin_table;
Elliott Hughesf2682d52011-08-15 16:37:04 -070027};
28
Elliott Hughes40ef99e2011-08-11 17:44:34 -070029struct JNIEnvExt {
Elliott Hughesbbd76712011-08-17 10:25:24 -070030 JNIEnvExt(Thread* self);
31
Elliott Hughesf2682d52011-08-15 16:37:04 -070032 // Must be first to correspond with JavaVM.
33 const struct JNINativeInterface* fns;
Ian Rogersdf20fe02011-07-20 20:34:16 -070034
Elliott Hughes40ef99e2011-08-11 17:44:34 -070035 Thread* self;
Carl Shapiroea4dca82011-08-01 13:45:38 -070036
Elliott Hughes40ef99e2011-08-11 17:44:34 -070037 // Are we in a "critical" JNI call?
38 bool critical;
Carl Shapiro2ed144c2011-07-26 16:52:08 -070039
Elliott Hughesbbd76712011-08-17 10:25:24 -070040 // Entered JNI monitors, for bulk exit on thread detach.
41 ReferenceTable monitor_table;
42
Elliott Hughes40ef99e2011-08-11 17:44:34 -070043 // 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 Shapiroea4dca82011-08-01 13:45:38 -070047};
48
Ian Rogersdf20fe02011-07-20 20:34:16 -070049} // namespace art
Carl Shapiroea4dca82011-08-01 13:45:38 -070050
Ian Rogersdf20fe02011-07-20 20:34:16 -070051#endif // ART_SRC_JNI_INTERNAL_H_