blob: 50e39256188256be191b74ec2a9e5b2ca47ae08b [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"
Elliott Hughes6c1a3942011-08-17 15:00:06 -07009#include "indirect_reference_table.h"
Brian Carlstrom578bbdc2011-07-21 14:07:47 -070010#include "macros.h"
Elliott Hughesbbd76712011-08-17 10:25:24 -070011#include "reference_table.h"
Ian Rogersdf20fe02011-07-20 20:34:16 -070012
13namespace art {
14
Elliott Hughesf2682d52011-08-15 16:37:04 -070015class Runtime;
Elliott Hughes40ef99e2011-08-11 17:44:34 -070016class Thread;
Ian Rogersdf20fe02011-07-20 20:34:16 -070017
Elliott Hughesf2682d52011-08-15 16:37:04 -070018struct JavaVMExt {
Elliott Hughes515a5bc2011-08-17 11:08:34 -070019 JavaVMExt(Runtime* runtime, bool check_jni);
Elliott Hughesbbd76712011-08-17 10:25:24 -070020
Elliott Hughesf2682d52011-08-15 16:37:04 -070021 // Must be first to correspond with JNIEnv.
22 const struct JNIInvokeInterface* fns;
23
24 Runtime* runtime;
Elliott Hughesbbd76712011-08-17 10:25:24 -070025
Elliott Hughes515a5bc2011-08-17 11:08:34 -070026 bool check_jni;
27
Elliott Hughesbbd76712011-08-17 10:25:24 -070028 // Used to hold references to pinned primitive arrays.
29 ReferenceTable pin_table;
Elliott Hughes6c1a3942011-08-17 15:00:06 -070030
31 // JNI global references.
32 IndirectReferenceTable globals;
33
34 // JNI weak global references.
35 IndirectReferenceTable weak_globals;
Elliott Hughesf2682d52011-08-15 16:37:04 -070036};
37
Elliott Hughes40ef99e2011-08-11 17:44:34 -070038struct JNIEnvExt {
Elliott Hughes515a5bc2011-08-17 11:08:34 -070039 JNIEnvExt(Thread* self, bool check_jni);
Elliott Hughesbbd76712011-08-17 10:25:24 -070040
Elliott Hughesf2682d52011-08-15 16:37:04 -070041 // Must be first to correspond with JavaVM.
42 const struct JNINativeInterface* fns;
Ian Rogersdf20fe02011-07-20 20:34:16 -070043
Elliott Hughes40ef99e2011-08-11 17:44:34 -070044 Thread* self;
Carl Shapiroea4dca82011-08-01 13:45:38 -070045
Elliott Hughes515a5bc2011-08-17 11:08:34 -070046 bool check_jni;
47
Elliott Hughes40ef99e2011-08-11 17:44:34 -070048 // Are we in a "critical" JNI call?
49 bool critical;
Carl Shapiro2ed144c2011-07-26 16:52:08 -070050
Elliott Hughesbbd76712011-08-17 10:25:24 -070051 // Entered JNI monitors, for bulk exit on thread detach.
Elliott Hughes6c1a3942011-08-17 15:00:06 -070052 ReferenceTable monitors;
53
54 // JNI local references.
55 IndirectReferenceTable locals;
Carl Shapiroea4dca82011-08-01 13:45:38 -070056};
57
Ian Rogersdf20fe02011-07-20 20:34:16 -070058} // namespace art
Carl Shapiroea4dca82011-08-01 13:45:38 -070059
Ian Rogersdf20fe02011-07-20 20:34:16 -070060#endif // ART_SRC_JNI_INTERNAL_H_