blob: 3ff12d8d1e7b13416a60b19ef21337e3c2272e0c [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"
Ian Rogersdf20fe02011-07-20 20:34:16 -070010
11namespace art {
12
Elliott Hughesf2682d52011-08-15 16:37:04 -070013class Runtime;
Elliott Hughes40ef99e2011-08-11 17:44:34 -070014class Thread;
Ian Rogersdf20fe02011-07-20 20:34:16 -070015
Elliott Hughesf2682d52011-08-15 16:37:04 -070016JavaVM* CreateJavaVM(Runtime* runtime);
Elliott Hughes40ef99e2011-08-11 17:44:34 -070017JNIEnv* CreateJNIEnv();
Ian Rogersdf20fe02011-07-20 20:34:16 -070018
Elliott Hughesf2682d52011-08-15 16:37:04 -070019struct JavaVMExt {
20 // Must be first to correspond with JNIEnv.
21 const struct JNIInvokeInterface* fns;
22
23 Runtime* runtime;
24};
25
Elliott Hughes40ef99e2011-08-11 17:44:34 -070026struct JNIEnvExt {
Elliott Hughesf2682d52011-08-15 16:37:04 -070027 // Must be first to correspond with JavaVM.
28 const struct JNINativeInterface* fns;
Ian Rogersdf20fe02011-07-20 20:34:16 -070029
Elliott Hughes40ef99e2011-08-11 17:44:34 -070030 Thread* self;
Carl Shapiroea4dca82011-08-01 13:45:38 -070031
Elliott Hughes40ef99e2011-08-11 17:44:34 -070032 // Are we in a "critical" JNI call?
33 bool critical;
Carl Shapiro2ed144c2011-07-26 16:52:08 -070034
Elliott Hughes40ef99e2011-08-11 17:44:34 -070035 // Used to help call synchronized native methods.
36 // TODO: make jni_compiler.cc do the indirection itself.
37 void (*MonitorEnterHelper)(JNIEnv*, jobject);
38 void (*MonitorExitHelper)(JNIEnv*, jobject);
Carl Shapiroea4dca82011-08-01 13:45:38 -070039};
40
Ian Rogersdf20fe02011-07-20 20:34:16 -070041} // namespace art
Carl Shapiroea4dca82011-08-01 13:45:38 -070042
Ian Rogersdf20fe02011-07-20 20:34:16 -070043#endif // ART_SRC_JNI_INTERNAL_H_