blob: 6b5d7867e111395b6b43e405a0cef973d1330a8c [file] [log] [blame]
The Android Open Source Projectf6c38712009-03-03 19:28:47 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * Variables with library scope.
19 *
20 * Prefer this over scattered static and global variables -- it's easier to
21 * view the state in a debugger, it makes clean shutdown simpler, we can
22 * trivially dump the state into a crash log, and it dodges most naming
23 * collisions that will arise when we are embedded in a larger program.
24 *
25 * If we want multiple VMs per process, this can get stuffed into TLS (or
26 * accessed through a Thread field). May need to pass it around for some
27 * of the early initialization functions.
28 */
29#ifndef _DALVIK_GLOBALS
30#define _DALVIK_GLOBALS
31
Elliott Hughes49dc0602011-02-10 12:03:34 -080032#include <cutils/array.h>
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080033#include <stdarg.h>
34#include <pthread.h>
35
Carl Shapiroae188c62011-04-08 13:11:58 -070036#ifdef __cplusplus
37extern "C" {
38#endif
39
Andy McFadden96516932009-10-28 17:39:02 -070040/* private structures */
41typedef struct GcHeap GcHeap;
42typedef struct BreakpointSet BreakpointSet;
Andy McFaddencb3c5422010-04-07 15:56:16 -070043typedef struct InlineSub InlineSub;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080044
45/*
46 * One of these for each -ea/-da/-esa/-dsa on the command line.
47 */
48typedef struct AssertionControl {
49 char* pkgOrClass; /* package/class string, or NULL for esa/dsa */
50 int pkgOrClassLen; /* string length, for quick compare */
51 bool enable; /* enable or disable */
52 bool isPackage; /* string ended with "..."? */
53} AssertionControl;
54
55/*
Andy McFadden701d2722010-12-01 16:18:19 -080056 * Register map generation mode. Only applicable when generateRegisterMaps
57 * is enabled. (The "disabled" state is not folded into this because
58 * there are callers like dexopt that want to enable/disable without
59 * specifying the configuration details.)
60 *
61 * "TypePrecise" is slower and requires additional storage for the register
62 * maps, but allows type-precise GC. "LivePrecise" is even slower and
63 * requires additional heap during processing, but allows live-precise GC.
64 */
65typedef enum {
66 kRegisterMapModeUnknown = 0,
67 kRegisterMapModeTypePrecise,
68 kRegisterMapModeLivePrecise
69} RegisterMapMode;
70
71/*
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080072 * All fields are initialized to zero.
73 *
74 * Storage allocated here must be freed by a subsystem shutdown function or
75 * from within freeGlobals().
76 */
77struct DvmGlobals {
78 /*
79 * Some options from the command line or environment.
80 */
81 char* bootClassPathStr;
82 char* classPathStr;
83
Carl Shapirodf9f08b2011-01-18 17:59:30 -080084 size_t heapStartingSize;
85 size_t heapMaximumSize;
86 size_t heapGrowthLimit;
87 size_t stackSize;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080088
89 bool verboseGc;
90 bool verboseJni;
91 bool verboseClass;
Andy McFadden43eb5012010-02-01 16:56:53 -080092 bool verboseShutdown;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080093
94 bool jdwpAllowed; // debugging allowed for this process?
95 bool jdwpConfigured; // has debugging info been provided?
Carl Shapirod5c36b92011-04-15 18:38:06 -070096 JdwpTransportType jdwpTransport;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080097 bool jdwpServer;
98 char* jdwpHost;
99 int jdwpPort;
100 bool jdwpSuspend;
101
Andy McFaddenea414342010-08-25 12:05:44 -0700102 /* use wall clock as method profiler clock source? */
103 bool profilerWallClock;
104
Carl Shapirob8fcf572010-04-16 17:33:15 -0700105 /*
106 * Lock profiling threshold value in milliseconds. Acquires that
107 * exceed threshold are logged. Acquires within the threshold are
108 * logged with a probability of $\frac{time}{threshold}$ . If the
109 * threshold is unset no additional logging occurs.
110 */
Carl Shapirof0c514c2010-04-09 15:03:33 -0700111 u4 lockProfThreshold;
Carl Shapirof0c514c2010-04-09 15:03:33 -0700112
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800113 int (*vfprintfHook)(FILE*, const char*, va_list);
114 void (*exitHook)(int);
115 void (*abortHook)(void);
Brad Fitzpatrick3b556752010-12-13 16:53:28 -0800116 bool (*isSensitiveThreadHook)(void);
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800117
118 int jniGrefLimit; // 0 means no limit
Elliott Hughes8afa9df2010-07-07 14:47:25 -0700119 char* jniTrace;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800120 bool reduceSignals;
121 bool noQuitHandler;
122 bool verifyDexChecksum;
123 char* stackTraceFile; // for SIGQUIT-inspired output
124
125 bool logStdio;
126
127 DexOptimizerMode dexOptMode;
128 DexClassVerifyMode classVerifyMode;
Barry Hayes5cbb2302010-02-02 14:07:37 -0800129
Andy McFadden701d2722010-12-01 16:18:19 -0800130 bool generateRegisterMaps;
131 RegisterMapMode registerMapMode;
132
Andy McFadden3f64a022010-11-12 16:55:21 -0800133 bool monitorVerification;
134
Andy McFaddenc58b9ef2010-09-09 12:54:43 -0700135 bool dexOptForSmp;
136
Barry Hayes962adba2010-03-17 12:12:39 -0700137 /*
138 * GC option flags.
139 */
The Android Open Source Project99409882009-03-18 22:20:24 -0700140 bool preciseGc;
Barry Hayes962adba2010-03-17 12:12:39 -0700141 bool preVerify;
142 bool postVerify;
Carl Shapiroec805ea2010-06-28 16:28:26 -0700143 bool concurrentMarkSweep;
Barry Hayes6e5cf602010-06-22 12:32:59 -0700144 bool verifyCardTable;
Carl Shapiro821fd062011-01-19 12:56:14 -0800145 bool disableExplicitGc;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800146
147 int assertionCtrlCount;
148 AssertionControl* assertionCtrl;
149
150 ExecutionMode executionMode;
151
152 /*
153 * VM init management.
154 */
155 bool initializing;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800156 bool optimizing;
157
158 /*
Elliott Hughes49dc0602011-02-10 12:03:34 -0800159 * java.lang.System properties set from the command line with -D.
160 * This is effectively a set, where later entries override earlier
161 * ones.
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800162 */
Elliott Hughes49dc0602011-02-10 12:03:34 -0800163 Array* properties;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800164
165 /*
166 * Where the VM goes to find system classes.
167 */
168 ClassPathEntry* bootClassPath;
169 /* used by the DEX optimizer to load classes from an unfinished DEX */
170 DvmDex* bootClassPathOptExtra;
171 bool optimizingBootstrapClass;
172
173 /*
174 * Loaded classes, hashed by class name. Each entry is a ClassObject*,
175 * allocated in GC space.
176 */
177 HashTable* loadedClasses;
178
179 /*
180 * Value for the next class serial number to be assigned. This is
181 * incremented as we load classes. Failed loads and races may result
182 * in some numbers being skipped, and the serial number is not
183 * guaranteed to start at 1, so the current value should not be used
184 * as a count of loaded classes.
185 */
186 volatile int classSerialNumber;
187
188 /*
Barry Hayes2c987472009-04-06 10:03:48 -0700189 * Classes with a low classSerialNumber are probably in the zygote, and
190 * their InitiatingLoaderList is not used, to promote sharing. The list is
191 * kept here instead.
192 */
193 InitiatingLoaderList* initiatingLoaderList;
194
195 /*
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800196 * Interned strings.
197 */
Carl Shapirobb1e0e92010-07-21 14:49:25 -0700198
199 /* A mutex that guards access to the interned string tables. */
200 pthread_mutex_t internLock;
201
202 /* Hash table of strings interned by the user. */
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800203 HashTable* internedStrings;
204
Carl Shapirobb1e0e92010-07-21 14:49:25 -0700205 /* Hash table of strings interned by the class loader. */
206 HashTable* literalStrings;
207
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800208 /*
Dan Bornstein318839c2011-03-14 11:00:35 -0700209 * Classes constructed directly by the vm.
210 */
211
212 /* the class Class */
213 ClassObject* classJavaLangClass;
214
215 /* synthetic classes representing primitive types */
216 ClassObject* typeVoid;
217 ClassObject* typeBoolean;
218 ClassObject* typeByte;
219 ClassObject* typeShort;
220 ClassObject* typeChar;
221 ClassObject* typeInt;
222 ClassObject* typeLong;
223 ClassObject* typeFloat;
224 ClassObject* typeDouble;
225
226 /* synthetic classes for arrays of primitives */
227 ClassObject* classArrayBoolean;
228 ClassObject* classArrayByte;
229 ClassObject* classArrayShort;
230 ClassObject* classArrayChar;
231 ClassObject* classArrayInt;
232 ClassObject* classArrayLong;
233 ClassObject* classArrayFloat;
234 ClassObject* classArrayDouble;
235
236 /*
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800237 * Quick lookups for popular classes used internally.
238 */
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800239 ClassObject* classJavaLangClassArray;
Andy McFadden09709762011-03-18 14:27:06 -0700240 ClassObject* classJavaLangClassLoader;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800241 ClassObject* classJavaLangObject;
242 ClassObject* classJavaLangObjectArray;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800243 ClassObject* classJavaLangString;
244 ClassObject* classJavaLangThread;
245 ClassObject* classJavaLangVMThread;
246 ClassObject* classJavaLangThreadGroup;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800247 ClassObject* classJavaLangStackTraceElement;
248 ClassObject* classJavaLangStackTraceElementArray;
249 ClassObject* classJavaLangAnnotationAnnotationArray;
250 ClassObject* classJavaLangAnnotationAnnotationArrayArray;
251 ClassObject* classJavaLangReflectAccessibleObject;
252 ClassObject* classJavaLangReflectConstructor;
253 ClassObject* classJavaLangReflectConstructorArray;
254 ClassObject* classJavaLangReflectField;
255 ClassObject* classJavaLangReflectFieldArray;
256 ClassObject* classJavaLangReflectMethod;
257 ClassObject* classJavaLangReflectMethodArray;
258 ClassObject* classJavaLangReflectProxy;
Andy McFadden8e5c7842009-07-23 17:47:18 -0700259 ClassObject* classJavaNioReadWriteDirectByteBuffer;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800260 ClassObject* classOrgApacheHarmonyLangAnnotationAnnotationFactory;
261 ClassObject* classOrgApacheHarmonyLangAnnotationAnnotationMember;
262 ClassObject* classOrgApacheHarmonyLangAnnotationAnnotationMemberArray;
Andy McFadden4b17a1d2011-03-29 09:58:27 -0700263 ClassObject* classOrgApacheHarmonyDalvikDdmcChunk;
264 ClassObject* classOrgApacheHarmonyDalvikDdmcDdmServer;
Carl Shapiro3475f9c2011-03-21 13:35:24 -0700265 ClassObject* classJavaLangRefFinalizerReference;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800266
Dan Bornstein32bb3da2011-02-24 15:47:20 -0800267 /*
268 * classes representing exception types. The names here don't include
269 * packages, just to keep the use sites a bit less verbose. All are
270 * in java.lang, except where noted.
271 */
Dan Bornstein85ba81d2011-03-03 13:10:04 -0800272 ClassObject* exAbstractMethodError;
Dan Bornstein6d167a42011-02-25 13:31:45 -0800273 ClassObject* exArithmeticException;
274 ClassObject* exArrayIndexOutOfBoundsException;
275 ClassObject* exArrayStoreException;
276 ClassObject* exClassCastException;
Dan Bornstein85ba81d2011-03-03 13:10:04 -0800277 ClassObject* exClassCircularityError;
Dan Bornstein2c8e25b2011-02-25 15:49:29 -0800278 ClassObject* exClassFormatError;
Dan Bornstein9b598e32011-03-01 10:28:42 -0800279 ClassObject* exClassNotFoundException;
Dan Bornstein32bb3da2011-02-24 15:47:20 -0800280 ClassObject* exError;
281 ClassObject* exExceptionInInitializerError;
Dan Bornstein2c8e25b2011-02-25 15:49:29 -0800282 ClassObject* exFileNotFoundException; /* in java.io */
283 ClassObject* exIOException; /* in java.io */
Dan Bornstein537e29e2011-03-02 16:28:04 -0800284 ClassObject* exIllegalAccessError;
Dan Bornstein9b598e32011-03-01 10:28:42 -0800285 ClassObject* exIllegalAccessException;
Dan Bornsteinbc606f52011-03-01 13:22:13 -0800286 ClassObject* exIllegalArgumentException;
287 ClassObject* exIllegalMonitorStateException;
288 ClassObject* exIllegalStateException;
289 ClassObject* exIllegalThreadStateException;
Dan Bornstein537e29e2011-03-02 16:28:04 -0800290 ClassObject* exIncompatibleClassChangeError;
Dan Bornsteina3b35122011-03-03 16:17:37 -0800291 ClassObject* exInstantiationError;
Dan Bornsteinbc606f52011-03-01 13:22:13 -0800292 ClassObject* exInstantiationException;
Dan Bornstein85213112011-03-01 16:16:12 -0800293 ClassObject* exInternalError;
Dan Bornstein9b598e32011-03-01 10:28:42 -0800294 ClassObject* exInterruptedException;
Dan Bornstein537e29e2011-03-02 16:28:04 -0800295 ClassObject* exLinkageError;
Dan Bornstein2c8e25b2011-02-25 15:49:29 -0800296 ClassObject* exNegativeArraySizeException;
Dan Bornstein85213112011-03-01 16:16:12 -0800297 ClassObject* exNoClassDefFoundError;
Dan Bornstein537e29e2011-03-02 16:28:04 -0800298 ClassObject* exNoSuchFieldError;
Dan Bornstein9b598e32011-03-01 10:28:42 -0800299 ClassObject* exNoSuchFieldException;
Dan Bornstein537e29e2011-03-02 16:28:04 -0800300 ClassObject* exNoSuchMethodError;
Dan Bornstein2c8e25b2011-02-25 15:49:29 -0800301 ClassObject* exNullPointerException;
Dan Bornstein85ba81d2011-03-03 13:10:04 -0800302 ClassObject* exOutOfMemoryError;
Dan Bornstein32bb3da2011-02-24 15:47:20 -0800303 ClassObject* exRuntimeException;
304 ClassObject* exStackOverflowError;
Dan Bornstein9b598e32011-03-01 10:28:42 -0800305 ClassObject* exStaleDexCacheError; /* in dalvik.system */
Dan Bornstein7a86c442011-02-28 11:23:26 -0800306 ClassObject* exStringIndexOutOfBoundsException;
Dan Bornstein32bb3da2011-02-24 15:47:20 -0800307 ClassObject* exThrowable;
Dan Bornstein85ba81d2011-03-03 13:10:04 -0800308 ClassObject* exTypeNotPresentException;
Dan Bornstein85213112011-03-01 16:16:12 -0800309 ClassObject* exUnsatisfiedLinkError;
Dan Bornstein7a86c442011-02-28 11:23:26 -0800310 ClassObject* exUnsupportedOperationException;
Dan Bornstein85ba81d2011-03-03 13:10:04 -0800311 ClassObject* exVerifyError;
Dan Bornstein7a86c442011-02-28 11:23:26 -0800312 ClassObject* exVirtualMachineError;
Dan Bornstein32bb3da2011-02-24 15:47:20 -0800313
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800314 /* method offsets - Object */
315 int voffJavaLangObject_equals;
316 int voffJavaLangObject_hashCode;
317 int voffJavaLangObject_toString;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800318
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800319 /* field offsets - String */
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800320 int offJavaLangString_value;
321 int offJavaLangString_count;
322 int offJavaLangString_offset;
323 int offJavaLangString_hashCode;
324
325 /* field offsets - Thread */
326 int offJavaLangThread_vmThread;
327 int offJavaLangThread_group;
328 int offJavaLangThread_daemon;
329 int offJavaLangThread_name;
330 int offJavaLangThread_priority;
Andy McFadden19cd2fc2011-03-24 13:45:14 -0700331 int offJavaLangThread_uncaughtHandler;
Andy McFaddenf5e6de92011-03-25 07:37:31 -0700332 int offJavaLangThread_contextClassLoader;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800333
334 /* method offsets - Thread */
335 int voffJavaLangThread_run;
336
Andy McFadden86c95932011-03-23 16:15:36 -0700337 /* field offsets - ThreadGroup */
338 int offJavaLangThreadGroup_name;
339 int offJavaLangThreadGroup_parent;
340
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800341 /* field offsets - VMThread */
342 int offJavaLangVMThread_thread;
343 int offJavaLangVMThread_vmData;
344
345 /* method offsets - ThreadGroup */
346 int voffJavaLangThreadGroup_removeThread;
347
348 /* field offsets - Throwable */
349 int offJavaLangThrowable_stackState;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800350 int offJavaLangThrowable_cause;
351
Andy McFadden04771392010-10-07 15:12:14 -0700352 /* method offsets - ClassLoader */
353 int voffJavaLangClassLoader_loadClass;
354
Andy McFaddenf5e6de92011-03-25 07:37:31 -0700355 /* direct method pointers - ClassLoader */
356 Method* methJavaLangClassLoader_getSystemClassLoader;
357
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800358 /* field offsets - java.lang.reflect.* */
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800359 int offJavaLangReflectConstructor_slot;
360 int offJavaLangReflectConstructor_declClass;
361 int offJavaLangReflectField_slot;
362 int offJavaLangReflectField_declClass;
363 int offJavaLangReflectMethod_slot;
364 int offJavaLangReflectMethod_declClass;
365
366 /* field offsets - java.lang.ref.Reference */
367 int offJavaLangRefReference_referent;
368 int offJavaLangRefReference_queue;
369 int offJavaLangRefReference_queueNext;
Carl Shapiro2a6f4842010-07-09 16:50:54 -0700370 int offJavaLangRefReference_pendingNext;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800371
Carl Shapiroce87bfe2011-03-30 19:35:34 -0700372 /* field offsets - java.lang.ref.FinalizerReference */
373 int offJavaLangRefFinalizerReference_zombie;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800374
Carl Shapiroce87bfe2011-03-30 19:35:34 -0700375 /* method pointers - java.lang.ref.ReferenceQueue */
376 Method* methJavaLangRefReferenceQueueAdd;
377
378 /* method pointers - java.lang.ref.FinalizerReference */
379 Method* methJavaLangRefFinalizerReferenceAdd;
Carl Shapiro3475f9c2011-03-21 13:35:24 -0700380
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800381 /* constructor method pointers; no vtable involved, so use Method* */
382 Method* methJavaLangStackTraceElement_init;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800383 Method* methJavaLangReflectConstructor_init;
384 Method* methJavaLangReflectField_init;
385 Method* methJavaLangReflectMethod_init;
386 Method* methOrgApacheHarmonyLangAnnotationAnnotationMember_init;
387
388 /* static method pointers - android.lang.annotation.* */
389 Method*
390 methOrgApacheHarmonyLangAnnotationAnnotationFactory_createAnnotation;
391
392 /* direct method pointers - java.lang.reflect.Proxy */
393 Method* methJavaLangReflectProxy_constructorPrototype;
394
395 /* field offsets - java.lang.reflect.Proxy */
396 int offJavaLangReflectProxy_h;
397
Andy McFadden19cd2fc2011-03-24 13:45:14 -0700398 /* field offsets - java.io.FileDescriptor */
399 int offJavaIoFileDescriptor_descriptor;
400
Andy McFaddenf5e6de92011-03-25 07:37:31 -0700401 /* direct method pointers - dalvik.system.NativeStart */
402 Method* methDalvikSystemNativeStart_main;
403 Method* methDalvikSystemNativeStart_run;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800404
Andy McFadden8e5c7842009-07-23 17:47:18 -0700405 /* assorted direct buffer helpers */
406 Method* methJavaNioReadWriteDirectByteBuffer_init;
Andy McFadden8e5c7842009-07-23 17:47:18 -0700407 int offJavaNioBuffer_capacity;
Andy McFadden8e696dc2009-07-24 15:28:16 -0700408 int offJavaNioBuffer_effectiveDirectAddress;
Andy McFadden5f612b82009-07-22 15:07:27 -0700409
Andy McFaddence1762c2011-03-28 15:03:21 -0700410 /* direct method pointers - org.apache.harmony.dalvik.ddmc.DdmServer */
411 Method* methDalvikDdmcServer_dispatch;
412 Method* methDalvikDdmcServer_broadcast;
413
414 /* field offsets - org.apache.harmony.dalvik.ddmc.Chunk */
415 int offDalvikDdmcChunk_type;
416 int offDalvikDdmcChunk_data;
417 int offDalvikDdmcChunk_offset;
418 int offDalvikDdmcChunk_length;
419
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800420 /*
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800421 * Thread list. This always has at least one element in it (main),
422 * and main is always the first entry.
423 *
424 * The threadListLock is used for several things, including the thread
425 * start condition variable. Generally speaking, you must hold the
426 * threadListLock when:
427 * - adding/removing items from the list
428 * - waiting on or signaling threadStartCond
429 * - examining the Thread struct for another thread (this is to avoid
430 * one thread freeing the Thread struct while another thread is
431 * perusing it)
432 */
433 Thread* threadList;
434 pthread_mutex_t threadListLock;
435
436 pthread_cond_t threadStartCond;
437
438 /*
439 * The thread code grabs this before suspending all threads. There
Andy McFadden2aa43612009-06-17 16:29:30 -0700440 * are a few things that can cause a "suspend all":
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800441 * (1) the GC is starting;
442 * (2) the debugger has sent a "suspend all" request;
443 * (3) a thread has hit a breakpoint or exception that the debugger
444 * has marked as a "suspend all" event;
445 * (4) the SignalCatcher caught a signal that requires suspension.
Ben Chengba4fc8b2009-06-01 13:00:29 -0700446 * (5) (if implemented) the JIT needs to perform a heavyweight
447 * rearrangement of the translation cache or JitTable.
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800448 *
449 * Because we use "safe point" self-suspension, it is never safe to
450 * do a blocking "lock" call on this mutex -- if it has been acquired,
451 * somebody is probably trying to put you to sleep. The leading '_' is
452 * intended as a reminder that this lock is special.
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800453 */
454 pthread_mutex_t _threadSuspendLock;
455
456 /*
buzbee389e2582011-04-22 15:12:40 -0700457 * Guards Thread->suspendCount for all threads, and
buzbee9a3147c2011-03-02 15:43:48 -0800458 * provides the lock for the condition variable that all suspended threads
459 * sleep on (threadSuspendCountCond).
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800460 *
461 * This has to be separate from threadListLock because of the way
462 * threads put themselves to sleep.
463 */
464 pthread_mutex_t threadSuspendCountLock;
465
466 /*
467 * Suspended threads sleep on this. They should sleep on the condition
468 * variable until their "suspend count" is zero.
469 *
470 * Paired with "threadSuspendCountLock".
471 */
472 pthread_cond_t threadSuspendCountCond;
473
474 /*
buzbeecb3081f2011-01-14 13:37:31 -0800475 * Sum of all threads' suspendCount fields. Guarded by
476 * threadSuspendCountLock.
Bill Buzbee46cd5b62009-06-05 15:36:06 -0700477 */
478 int sumThreadSuspendCount;
479
480 /*
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800481 * MUTEX ORDERING: when locking multiple mutexes, always grab them in
482 * this order to avoid deadlock:
483 *
484 * (1) _threadSuspendLock (use lockThreadSuspend())
485 * (2) threadListLock (use dvmLockThreadList())
486 * (3) threadSuspendCountLock (use lockThreadSuspendCount())
487 */
488
489
490 /*
491 * Thread ID bitmap. We want threads to have small integer IDs so
492 * we can use them in "thin locks".
493 */
494 BitVector* threadIdMap;
495
496 /*
497 * Manage exit conditions. The VM exits when all non-daemon threads
498 * have exited. If the main thread returns early, we need to sleep
499 * on a condition variable.
500 */
501 int nonDaemonThreadCount; /* must hold threadListLock to access */
502 //pthread_mutex_t vmExitLock;
503 pthread_cond_t vmExitCond;
504
505 /*
506 * The set of DEX files loaded by custom class loaders.
507 */
508 HashTable* userDexFiles;
509
510 /*
511 * JNI global reference table.
512 */
Andy McFaddend5ab7262009-08-25 07:19:34 -0700513 IndirectRefTable jniGlobalRefTable;
Carl Shapiroe4c3b5e2011-03-08 13:44:51 -0800514 IndirectRefTable jniWeakGlobalRefTable;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800515 pthread_mutex_t jniGlobalRefLock;
Carl Shapiroe4c3b5e2011-03-08 13:44:51 -0800516 pthread_mutex_t jniWeakGlobalRefLock;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800517 int jniGlobalRefHiMark;
518 int jniGlobalRefLoMark;
519
520 /*
Andy McFaddenc26bb632009-08-21 12:01:31 -0700521 * JNI pinned object table (used for primitive arrays).
522 */
523 ReferenceTable jniPinRefTable;
524 pthread_mutex_t jniPinRefLock;
525
526 /*
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800527 * Native shared library table.
528 */
529 HashTable* nativeLibs;
530
531 /*
532 * GC heap lock. Functions like gcMalloc() acquire this before making
533 * any changes to the heap. It is held throughout garbage collection.
534 */
535 pthread_mutex_t gcHeapLock;
536
Carl Shapiroec47e2e2010-07-01 17:44:46 -0700537 /*
538 * Condition variable to queue threads waiting to retry an
539 * allocation. Signaled after a concurrent GC is completed.
540 */
541 pthread_cond_t gcHeapCond;
542
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800543 /* Opaque pointer representing the heap. */
544 GcHeap* gcHeap;
545
Barry Hayes4496ed92010-07-12 09:52:20 -0700546 /* The card table base, modified as needed for marking cards. */
547 u1* biasedCardTableBase;
548
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800549 /*
Andy McFadden7fc3ce82009-07-14 15:57:23 -0700550 * Pre-allocated throwables.
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800551 */
552 Object* outOfMemoryObj;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800553 Object* internalErrorObj;
Andy McFadden7fc3ce82009-07-14 15:57:23 -0700554 Object* noClassDefFoundErrorObj;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800555
556 /* Monitor list, so we can free them */
557 /*volatile*/ Monitor* monitorList;
558
559 /* Monitor for Thread.sleep() implementation */
560 Monitor* threadSleepMon;
561
562 /* set when we create a second heap inside the zygote */
563 bool newZygoteHeapAllocated;
564
565 /*
566 * TLS keys.
567 */
568 pthread_key_t pthreadKeySelf; /* Thread*, for dvmThreadSelf */
569
570 /*
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800571 * Cache results of "A instanceof B".
572 */
573 AtomicCache* instanceofCache;
574
Andy McFaddencb3c5422010-04-07 15:56:16 -0700575 /* inline substitution table, used during optimization */
576 InlineSub* inlineSubs;
577
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800578 /*
579 * Bootstrap class loader linear allocator.
580 */
581 LinearAllocHdr* pBootLoaderAlloc;
582
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800583 /*
584 * Compute some stats on loaded classes.
585 */
The Android Open Source Project99409882009-03-18 22:20:24 -0700586 int numLoadedClasses;
587 int numDeclaredMethods;
588 int numDeclaredInstFields;
589 int numDeclaredStaticFields;
590
591 /* when using a native debugger, set this to suppress watchdog timers */
592 bool nativeDebuggerActive;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800593
594 /*
595 * JDWP debugger support.
buzbee9a3147c2011-03-02 15:43:48 -0800596 *
597 * Note: Each thread will normally determine whether the debugger is active
598 * for it by referring to its subMode flags. "debuggerActive" here should be
599 * seen as "debugger is making requests of 1 or more threads".
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800600 */
601 bool debuggerConnected; /* debugger or DDMS is connected */
buzbee9a3147c2011-03-02 15:43:48 -0800602 bool debuggerActive; /* debugger is making requests */
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800603 JdwpState* jdwpState;
604
605 /*
606 * Registry of objects known to the debugger.
607 */
608 HashTable* dbgRegistry;
609
610 /*
Andy McFadden96516932009-10-28 17:39:02 -0700611 * Debugger breakpoint table.
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800612 */
Andy McFadden96516932009-10-28 17:39:02 -0700613 BreakpointSet* breakpointSet;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800614
615 /*
616 * Single-step control struct. We currently only allow one thread to
617 * be single-stepping at a time, which is all that really makes sense,
618 * but it's possible we may need to expand this to be per-thread.
619 */
620 StepControl stepControl;
621
622 /*
623 * DDM features embedded in the VM.
624 */
625 bool ddmThreadNotification;
626
627 /*
628 * Zygote (partially-started process) support
629 */
630 bool zygote;
631
632 /*
633 * Used for tracking allocations that we report to DDMS. When the feature
634 * is enabled (through a DDMS request) the "allocRecords" pointer becomes
635 * non-NULL.
636 */
637 pthread_mutex_t allocTrackerLock;
638 AllocRecord* allocRecords;
639 int allocRecordHead; /* most-recently-added entry */
640 int allocRecordCount; /* #of valid entries */
641
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800642 /*
buzbee9a3147c2011-03-02 15:43:48 -0800643 * When a profiler is enabled, this is incremented. Distinct profilers
644 * include "dmtrace" method tracing, emulator method tracing, and
645 * possibly instruction counting.
646 *
647 * The purpose of this is to have a single value that shows whether any
648 * profiling is going on. Individual thread will normally check their
649 * thread-private subMode flags to take any profiling action.
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800650 */
buzbee9a3147c2011-03-02 15:43:48 -0800651 volatile int activeProfilers;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800652
653 /*
654 * State for method-trace profiling.
655 */
656 MethodTraceState methodTrace;
Andy McFadden2ff04ab2011-03-08 15:22:14 -0800657 Method* methodTraceGcMethod;
658 Method* methodTraceClassPrepMethod;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800659
660 /*
661 * State for emulator tracing.
662 */
663 void* emulatorTracePage;
664 int emulatorTraceEnableCount;
665
666 /*
667 * Global state for memory allocation profiling.
668 */
669 AllocProfState allocProf;
670
671 /*
672 * Pointers to the original methods for things that have been inlined.
673 * This makes it easy for us to output method entry/exit records for
Andy McFadden0d615c32010-08-18 12:19:51 -0700674 * the method calls we're not actually making. (Used by method
675 * profiling.)
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800676 */
677 Method** inlinedMethods;
678
679 /*
Dan Bornsteinccaab182010-12-03 15:32:40 -0800680 * Dalvik instruction counts (kNumPackedOpcodes entries).
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800681 */
682 int* executedInstrCounts;
Andy McFadden5183a192010-10-22 15:26:07 -0700683 int instructionCountEnableCount;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800684
685 /*
686 * Signal catcher thread (for SIGQUIT).
687 */
688 pthread_t signalCatcherHandle;
689 bool haltSignalCatcher;
690
691 /*
692 * Stdout/stderr conversion thread.
693 */
694 bool haltStdioConverter;
695 bool stdioConverterReady;
696 pthread_t stdioConverterHandle;
697 pthread_mutex_t stdioConverterLock;
698 pthread_cond_t stdioConverterCond;
699
700 /*
701 * pid of the system_server process. We track it so that when system server
702 * crashes the Zygote process will be killed and restarted.
703 */
704 pid_t systemServerPid;
705
San Mehat894dd462009-09-08 20:29:15 -0700706 int kernelGroupScheduling;
707
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800708//#define COUNT_PRECISE_METHODS
709#ifdef COUNT_PRECISE_METHODS
710 PointerSet* preciseMethods;
711#endif
The Android Open Source Project99409882009-03-18 22:20:24 -0700712
713 /* some RegisterMap statistics, useful during development */
714 void* registerMapStats;
Andy McFadden470cbbb2010-11-04 16:31:37 -0700715
716#ifdef VERIFIER_STATS
717 VerifierStats verifierStats;
718#endif
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800719};
720
721extern struct DvmGlobals gDvm;
722
Ben Chengba4fc8b2009-06-01 13:00:29 -0700723#if defined(WITH_JIT)
Ben Cheng38329f52009-07-07 14:19:20 -0700724
buzbee2e152ba2010-12-15 16:32:35 -0800725/* Trace profiling modes. Ordering matters - off states before on states */
726typedef enum TraceProfilingModes {
727 kTraceProfilingDisabled = 0, // Not profiling
728 kTraceProfilingPeriodicOff = 1, // Periodic profiling, off phase
729 kTraceProfilingContinuous = 2, // Always profiling
730 kTraceProfilingPeriodicOn = 3 // Periodic profiling, on phase
731} TraceProfilingModes;
732
Ben Chengba4fc8b2009-06-01 13:00:29 -0700733/*
Ben Cheng6c10a972009-10-29 14:39:18 -0700734 * Exiting the compiled code w/o chaining will incur overhead to look up the
735 * target in the code cache which is extra work only when JIT is enabled. So
736 * we want to monitor it closely to make sure we don't have performance bugs.
737 */
738typedef enum NoChainExits {
739 kInlineCacheMiss = 0,
740 kCallsiteInterpreted,
741 kSwitchOverflow,
Bill Buzbeefccb31d2010-02-04 16:09:55 -0800742 kHeavyweightMonitor,
Ben Cheng6c10a972009-10-29 14:39:18 -0700743 kNoChainExitLast,
744} NoChainExits;
745
746/*
Ben Chengba4fc8b2009-06-01 13:00:29 -0700747 * JIT-specific global state
748 */
749struct DvmJitGlobals {
750 /*
751 * Guards writes to Dalvik PC (dPC), translated code address (codeAddr) and
752 * chain fields within the JIT hash table. Note carefully the access
753 * mechanism.
754 * Only writes are guarded, and the guarded fields must be updated in a
755 * specific order using atomic operations. Further, once a field is
756 * written it cannot be changed without halting all threads.
757 *
758 * The write order is:
759 * 1) codeAddr
760 * 2) dPC
761 * 3) chain [if necessary]
762 *
763 * This mutex also guards both read and write of curJitTableEntries.
764 */
765 pthread_mutex_t tableLock;
766
767 /* The JIT hash table. Note that for access speed, copies of this pointer
768 * are stored in each thread. */
769 struct JitEntry *pJitEntryTable;
770
buzbee2e152ba2010-12-15 16:32:35 -0800771 /* Array of compilation trigger threshold counters */
Ben Chengba4fc8b2009-06-01 13:00:29 -0700772 unsigned char *pProfTable;
Ben Chengba4fc8b2009-06-01 13:00:29 -0700773
buzbee2e152ba2010-12-15 16:32:35 -0800774 /* Trace profiling counters */
775 struct JitTraceProfCounters *pJitTraceProfCounters;
776
Bill Buzbee06bb8392010-01-31 18:53:15 -0800777 /* Copy of pProfTable used for temporarily disabling the Jit */
778 unsigned char *pProfTableCopy;
779
Ben Chengba4fc8b2009-06-01 13:00:29 -0700780 /* Size of JIT hash table in entries. Must be a power of 2 */
Bill Buzbee27176222009-06-09 09:20:16 -0700781 unsigned int jitTableSize;
782
783 /* Mask used in hash function for JitTable. Should be jitTableSize-1 */
784 unsigned int jitTableMask;
785
786 /* How many entries in the JitEntryTable are in use */
787 unsigned int jitTableEntriesUsed;
Ben Chengba4fc8b2009-06-01 13:00:29 -0700788
Ben Cheng94e79eb2010-02-04 16:15:59 -0800789 /* Bytes allocated for the code cache */
790 unsigned int codeCacheSize;
791
Ben Chengba4fc8b2009-06-01 13:00:29 -0700792 /* Trigger for trace selection */
793 unsigned short threshold;
794
795 /* JIT Compiler Control */
796 bool haltCompilerThread;
797 bool blockingMode;
buzbee18fba342011-01-19 15:31:15 -0800798 bool methodTraceSupport;
Ben Cheng7ab74e12011-02-03 14:02:06 -0800799 bool genSuspendPoll;
Ben Cheng385828e2011-03-04 16:48:33 -0800800 Thread* compilerThread;
Ben Chengba4fc8b2009-06-01 13:00:29 -0700801 pthread_t compilerHandle;
802 pthread_mutex_t compilerLock;
Ben Chengc3b92b22010-01-26 16:46:15 -0800803 pthread_mutex_t compilerICPatchLock;
Ben Chengba4fc8b2009-06-01 13:00:29 -0700804 pthread_cond_t compilerQueueActivity;
805 pthread_cond_t compilerQueueEmpty;
Ben Cheng88a0f972010-02-24 15:00:40 -0800806 volatile int compilerQueueLength;
Ben Chengba4fc8b2009-06-01 13:00:29 -0700807 int compilerHighWater;
808 int compilerWorkEnqueueIndex;
809 int compilerWorkDequeueIndex;
Ben Chengc3b92b22010-01-26 16:46:15 -0800810 int compilerICPatchIndex;
Ben Chengba4fc8b2009-06-01 13:00:29 -0700811
812 /* JIT internal stats */
813 int compilerMaxQueued;
Ben Chengba4fc8b2009-06-01 13:00:29 -0700814 int translationChains;
Ben Chengba4fc8b2009-06-01 13:00:29 -0700815
816 /* Compiled code cache */
817 void* codeCache;
818
Ben Cheng385828e2011-03-04 16:48:33 -0800819 /*
820 * This is used to store the base address of an in-flight compilation whose
821 * class object pointers have been calculated to populate literal pool.
822 * Once the compiler thread has changed its status to VM_WAIT, we cannot
823 * guarantee whether GC has happened before the code address has been
824 * installed to the JIT table. Because of that, this field can only
825 * been cleared/overwritten by the compiler thread if it is in the
826 * THREAD_RUNNING state or in a safe point.
827 */
828 void *inflightBaseAddr;
829
buzbee18fba342011-01-19 15:31:15 -0800830 /* Translation cache version (protected by compilerLock */
831 int cacheVersion;
832
Ben Cheng8b258bf2009-06-24 17:27:07 -0700833 /* Bytes used by the code templates */
834 unsigned int templateSize;
835
Ben Chengba4fc8b2009-06-01 13:00:29 -0700836 /* Bytes already used in the code cache */
837 unsigned int codeCacheByteUsed;
838
839 /* Number of installed compilations in the cache */
840 unsigned int numCompilations;
841
842 /* Flag to indicate that the code cache is full */
843 bool codeCacheFull;
844
Ben Chengb88ec3c2010-05-17 12:50:33 -0700845 /* Page size - 1 */
846 unsigned int pageSizeMask;
847
848 /* Lock to change the protection type of the code cache */
849 pthread_mutex_t codeCacheProtectionLock;
850
Ben Cheng7a0bcd02010-01-22 16:45:45 -0800851 /* Number of times that the code cache has been reset */
852 int numCodeCacheReset;
853
Ben Chengc3b92b22010-01-26 16:46:15 -0800854 /* Number of times that the code cache reset request has been delayed */
855 int numCodeCacheResetDelayed;
856
Ben Chengba4fc8b2009-06-01 13:00:29 -0700857 /* true/false: compile/reject opcodes specified in the -Xjitop list */
858 bool includeSelectedOp;
859
860 /* true/false: compile/reject methods specified in the -Xjitmethod list */
861 bool includeSelectedMethod;
862
863 /* Disable JIT for selected opcodes - one bit for each opcode */
864 char opList[32];
865
866 /* Disable JIT for selected methods */
867 HashTable *methodTable;
868
Ben Chengba4fc8b2009-06-01 13:00:29 -0700869 /* Flag to dump all compiled code */
870 bool printMe;
Bill Buzbee6e963e12009-06-17 16:56:19 -0700871
Ben Cheng46cd4fb2011-03-16 17:19:06 -0700872 /* Per-process debug flag toggled when receiving a SIGUSR2 */
873 bool receivedSIGUSR2;
874
buzbee2e152ba2010-12-15 16:32:35 -0800875 /* Trace profiling mode */
876 TraceProfilingModes profileMode;
877
878 /* Periodic trace profiling countdown timer */
879 int profileCountdown;
Ben Cheng8b258bf2009-06-24 17:27:07 -0700880
Ben Chengdcf3e5d2009-09-11 13:42:05 -0700881 /* Vector to disable selected optimizations */
882 int disableOpt;
883
Ben Cheng8b258bf2009-06-24 17:27:07 -0700884 /* Table to track the overall and trace statistics of hot methods */
885 HashTable* methodStatsTable;
Ben Chengbcdc1de2009-08-21 16:18:46 -0700886
Ben Cheng33672452010-01-12 14:59:30 -0800887 /* Filter method compilation blacklist with call-graph information */
888 bool checkCallGraph;
889
Ben Chengc3b92b22010-01-26 16:46:15 -0800890 /* New translation chain has been set up */
891 volatile bool hasNewChain;
892
Ben Chengbcdc1de2009-08-21 16:18:46 -0700893#if defined(WITH_SELF_VERIFICATION)
894 /* Spin when error is detected, volatile so GDB can reset it */
895 volatile bool selfVerificationSpin;
896#endif
Ben Chengc3b92b22010-01-26 16:46:15 -0800897
Bill Buzbeefccb31d2010-02-04 16:09:55 -0800898 /* Framework or stand-alone? */
899 bool runningInAndroidFramework;
900
Ben Chengc5285b32010-02-14 16:17:36 -0800901 /* Framework callback happened? */
902 bool alreadyEnabledViaFramework;
903
904 /* Framework requests to disable the JIT for good */
905 bool disableJit;
906
Ben Chengdca71432010-03-16 16:04:11 -0700907#if defined(SIGNATURE_BREAKPOINT)
908 /* Signature breakpoint */
909 u4 signatureBreakpointSize; // # of words
910 u4 *signatureBreakpoint; // Signature content
911#endif
912
Ben Cheng978738d2010-05-13 13:45:57 -0700913#if defined(WITH_JIT_TUNING)
914 /* Performance tuning counters */
915 int addrLookupsFound;
916 int addrLookupsNotFound;
917 int noChainExit[kNoChainExitLast];
918 int normalExit;
919 int puntExit;
920 int invokeMonomorphic;
921 int invokePolymorphic;
922 int invokeNative;
Ben Cheng7a2697d2010-06-07 13:44:23 -0700923 int invokeMonoGetterInlined;
924 int invokeMonoSetterInlined;
925 int invokePolyGetterInlined;
926 int invokePolySetterInlined;
Ben Cheng978738d2010-05-13 13:45:57 -0700927 int returnOp;
Ben Chengb88ec3c2010-05-17 12:50:33 -0700928 int icPatchInit;
929 int icPatchLockFree;
Ben Cheng978738d2010-05-13 13:45:57 -0700930 int icPatchQueued;
Ben Chengb88ec3c2010-05-17 12:50:33 -0700931 int icPatchRejected;
Ben Cheng978738d2010-05-13 13:45:57 -0700932 int icPatchDropped;
Ben Cheng978738d2010-05-13 13:45:57 -0700933 int codeCachePatches;
Ben Cheng385828e2011-03-04 16:48:33 -0800934 int numCompilerThreadBlockGC;
935 u8 jitTime;
936 u8 compilerThreadBlockGCStart;
937 u8 compilerThreadBlockGCTime;
938 u8 maxCompilerThreadBlockGCTime;
Ben Cheng978738d2010-05-13 13:45:57 -0700939#endif
940
Ben Chengc3b92b22010-01-26 16:46:15 -0800941 /* Place arrays at the end to ease the display in gdb sessions */
942
943 /* Work order queue for compilations */
944 CompilerWorkOrder compilerWorkQueue[COMPILER_WORK_QUEUE_SIZE];
945
946 /* Work order queue for predicted chain patching */
947 ICPatchWorkOrder compilerICPatchQueue[COMPILER_IC_PATCH_QUEUE_SIZE];
Ben Chengba4fc8b2009-06-01 13:00:29 -0700948};
949
950extern struct DvmJitGlobals gDvmJit;
951
Ben Cheng978738d2010-05-13 13:45:57 -0700952#if defined(WITH_JIT_TUNING)
953extern int gDvmICHitCount;
954#endif
955
Ben Chengba4fc8b2009-06-01 13:00:29 -0700956#endif
957
Elliott Hughesa5f3ed82011-04-26 18:32:17 -0700958struct DvmJniGlobals {
959 bool useCheckJni;
960 bool warnOnly;
Elliott Hughesd5c80e02011-04-27 12:23:43 -0700961 bool forceCopy;
962
963 /**
964 * The JNI JavaVM object. Dalvik only supports a single VM per process.
965 */
966 JavaVM* jniVm;
Elliott Hughesa5f3ed82011-04-26 18:32:17 -0700967};
968
969extern struct DvmJniGlobals gDvmJni;
970
Carl Shapiroae188c62011-04-08 13:11:58 -0700971#ifdef __cplusplus
972}
973#endif
974
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800975#endif /*_DALVIK_GLOBALS*/