• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
32 #include <stdarg.h>
33 #include <pthread.h>
34 
35 #define MAX_BREAKPOINTS 20      /* used for a debugger optimization */
36 
37 // fwd
38 typedef struct GcHeap GcHeap;   /* heap internal structure */
39 
40 /*
41  * One of these for each -ea/-da/-esa/-dsa on the command line.
42  */
43 typedef struct AssertionControl {
44     char*   pkgOrClass;         /* package/class string, or NULL for esa/dsa */
45     int     pkgOrClassLen;      /* string length, for quick compare */
46     bool    enable;             /* enable or disable */
47     bool    isPackage;          /* string ended with "..."? */
48 } AssertionControl;
49 
50 /*
51  * Execution mode, e.g. interpreter vs. JIT.
52  */
53 typedef enum ExecutionMode {
54     kExecutionModeUnknown = 0,
55     kExecutionModeInterpPortable,
56     kExecutionModeInterpFast,
57 #if defined(WITH_JIT)
58     kExecutionModeJit,
59 #endif
60 } ExecutionMode;
61 
62 /*
63  * All fields are initialized to zero.
64  *
65  * Storage allocated here must be freed by a subsystem shutdown function or
66  * from within freeGlobals().
67  */
68 struct DvmGlobals {
69     /*
70      * Some options from the command line or environment.
71      */
72     char*       bootClassPathStr;
73     char*       classPathStr;
74 
75     unsigned int    heapSizeStart;
76     unsigned int    heapSizeMax;
77     unsigned int    stackSize;
78 
79     bool        verboseGc;
80     bool        verboseJni;
81     bool        verboseClass;
82 
83     bool        jdwpAllowed;        // debugging allowed for this process?
84     bool        jdwpConfigured;     // has debugging info been provided?
85     int         jdwpTransport;
86     bool        jdwpServer;
87     char*       jdwpHost;
88     int         jdwpPort;
89     bool        jdwpSuspend;
90 
91     int         (*vfprintfHook)(FILE*, const char*, va_list);
92     void        (*exitHook)(int);
93     void        (*abortHook)(void);
94 
95     int         jniGrefLimit;       // 0 means no limit
96     bool        reduceSignals;
97     bool        noQuitHandler;
98     bool        verifyDexChecksum;
99     char*       stackTraceFile;     // for SIGQUIT-inspired output
100 
101     bool        logStdio;
102 
103     DexOptimizerMode    dexOptMode;
104     DexClassVerifyMode  classVerifyMode;
105     bool        preciseGc;
106     bool        generateRegisterMaps;
107 
108     int         assertionCtrlCount;
109     AssertionControl*   assertionCtrl;
110 
111     ExecutionMode   executionMode;
112 
113     /*
114      * VM init management.
115      */
116     bool        initializing;
117     int         initExceptionCount;
118     bool        optimizing;
119 
120     /*
121      * java.lang.System properties set from the command line.
122      */
123     int         numProps;
124     int         maxProps;
125     char**      propList;
126 
127     /*
128      * Where the VM goes to find system classes.
129      */
130     ClassPathEntry* bootClassPath;
131     /* used by the DEX optimizer to load classes from an unfinished DEX */
132     DvmDex*     bootClassPathOptExtra;
133     bool        optimizingBootstrapClass;
134 
135     /*
136      * Loaded classes, hashed by class name.  Each entry is a ClassObject*,
137      * allocated in GC space.
138      */
139     HashTable*  loadedClasses;
140 
141     /*
142      * Value for the next class serial number to be assigned.  This is
143      * incremented as we load classes.  Failed loads and races may result
144      * in some numbers being skipped, and the serial number is not
145      * guaranteed to start at 1, so the current value should not be used
146      * as a count of loaded classes.
147      */
148     volatile int classSerialNumber;
149 
150     /*
151      * Classes with a low classSerialNumber are probably in the zygote, and
152      * their InitiatingLoaderList is not used, to promote sharing. The list is
153      * kept here instead.
154      */
155     InitiatingLoaderList* initiatingLoaderList;
156 
157     /*
158      * Interned strings.
159      */
160     HashTable*  internedStrings;
161 
162     /*
163      * Quick lookups for popular classes used internally.
164      */
165     ClassObject* unlinkedJavaLangClass;    // see unlinkedJavaLangClassObject
166     ClassObject* classJavaLangClass;
167     ClassObject* classJavaLangClassArray;
168     ClassObject* classJavaLangError;
169     ClassObject* classJavaLangObject;
170     ClassObject* classJavaLangObjectArray;
171     ClassObject* classJavaLangRuntimeException;
172     ClassObject* classJavaLangString;
173     ClassObject* classJavaLangThread;
174     ClassObject* classJavaLangVMThread;
175     ClassObject* classJavaLangThreadGroup;
176     ClassObject* classJavaLangThrowable;
177     ClassObject* classJavaLangStackTraceElement;
178     ClassObject* classJavaLangStackTraceElementArray;
179     ClassObject* classJavaLangAnnotationAnnotationArray;
180     ClassObject* classJavaLangAnnotationAnnotationArrayArray;
181     ClassObject* classJavaLangReflectAccessibleObject;
182     ClassObject* classJavaLangReflectConstructor;
183     ClassObject* classJavaLangReflectConstructorArray;
184     ClassObject* classJavaLangReflectField;
185     ClassObject* classJavaLangReflectFieldArray;
186     ClassObject* classJavaLangReflectMethod;
187     ClassObject* classJavaLangReflectMethodArray;
188     ClassObject* classJavaLangReflectProxy;
189     ClassObject* classJavaLangExceptionInInitializerError;
190     ClassObject* classJavaLangRefReference;
191     ClassObject* classJavaNioReadWriteDirectByteBuffer;
192     ClassObject* classJavaSecurityAccessController;
193     ClassObject* classOrgApacheHarmonyLangAnnotationAnnotationFactory;
194     ClassObject* classOrgApacheHarmonyLangAnnotationAnnotationMember;
195     ClassObject* classOrgApacheHarmonyLangAnnotationAnnotationMemberArray;
196     ClassObject* classOrgApacheHarmonyNioInternalDirectBuffer;
197     jclass      jclassOrgApacheHarmonyNioInternalDirectBuffer;
198 
199     /* synthetic classes for arrays of primitives */
200     ClassObject* classArrayBoolean;
201     ClassObject* classArrayChar;
202     ClassObject* classArrayFloat;
203     ClassObject* classArrayDouble;
204     ClassObject* classArrayByte;
205     ClassObject* classArrayShort;
206     ClassObject* classArrayInt;
207     ClassObject* classArrayLong;
208 
209     /* method offsets - Object */
210     int         voffJavaLangObject_equals;
211     int         voffJavaLangObject_hashCode;
212     int         voffJavaLangObject_toString;
213     int         voffJavaLangObject_finalize;
214 
215     /* field offsets - Class */
216     int         offJavaLangClass_pd;
217 
218     /* field offsets - String */
219     volatile int javaLangStringReady;   /* 0=not init, 1=ready, -1=initing */
220     int         offJavaLangString_value;
221     int         offJavaLangString_count;
222     int         offJavaLangString_offset;
223     int         offJavaLangString_hashCode;
224 
225     /* field offsets - Thread */
226     int         offJavaLangThread_vmThread;
227     int         offJavaLangThread_group;
228     int         offJavaLangThread_daemon;
229     int         offJavaLangThread_name;
230     int         offJavaLangThread_priority;
231 
232     /* method offsets - Thread */
233     int         voffJavaLangThread_run;
234 
235     /* field offsets - VMThread */
236     int         offJavaLangVMThread_thread;
237     int         offJavaLangVMThread_vmData;
238 
239     /* method offsets - ThreadGroup */
240     int         voffJavaLangThreadGroup_removeThread;
241 
242     /* field offsets - Throwable */
243     int         offJavaLangThrowable_stackState;
244     int         offJavaLangThrowable_message;
245     int         offJavaLangThrowable_cause;
246 
247     /* field offsets - java.lang.reflect.* */
248     int         offJavaLangReflectAccessibleObject_flag;
249     int         offJavaLangReflectConstructor_slot;
250     int         offJavaLangReflectConstructor_declClass;
251     int         offJavaLangReflectField_slot;
252     int         offJavaLangReflectField_declClass;
253     int         offJavaLangReflectMethod_slot;
254     int         offJavaLangReflectMethod_declClass;
255 
256     /* field offsets - java.lang.ref.Reference */
257     int         offJavaLangRefReference_referent;
258     int         offJavaLangRefReference_queue;
259     int         offJavaLangRefReference_queueNext;
260     int         offJavaLangRefReference_vmData;
261 
262 #if FANCY_REFERENCE_SUBCLASS
263     /* method offsets - java.lang.ref.Reference */
264     int         voffJavaLangRefReference_clear;
265     int         voffJavaLangRefReference_enqueue;
266 #else
267     /* method pointers - java.lang.ref.Reference */
268     Method*     methJavaLangRefReference_enqueueInternal;
269 #endif
270 
271     /* field offsets - java.nio.Buffer and java.nio.DirectByteBufferImpl */
272     //int         offJavaNioBuffer_capacity;
273     //int         offJavaNioDirectByteBufferImpl_pointer;
274 
275     /* method pointers - java.security.AccessController */
276     volatile bool javaSecurityAccessControllerReady;
277     Method*     methJavaSecurityAccessController_doPrivileged[4];
278 
279     /* constructor method pointers; no vtable involved, so use Method* */
280     Method*     methJavaLangStackTraceElement_init;
281     Method*     methJavaLangExceptionInInitializerError_init;
282     Method*     methJavaLangReflectConstructor_init;
283     Method*     methJavaLangReflectField_init;
284     Method*     methJavaLangReflectMethod_init;
285     Method*     methOrgApacheHarmonyLangAnnotationAnnotationMember_init;
286 
287     /* static method pointers - android.lang.annotation.* */
288     Method*
289         methOrgApacheHarmonyLangAnnotationAnnotationFactory_createAnnotation;
290 
291     /* direct method pointers - java.lang.reflect.Proxy */
292     Method*     methJavaLangReflectProxy_constructorPrototype;
293 
294     /* field offsets - java.lang.reflect.Proxy */
295     int         offJavaLangReflectProxy_h;
296 
297     /* fake native entry point method */
298     Method*     methFakeNativeEntry;
299 
300     /* assorted direct buffer helpers */
301     Method*     methJavaNioReadWriteDirectByteBuffer_init;
302     Method*     methOrgApacheHarmonyLuniPlatformPlatformAddress_on;
303     Method*     methOrgApacheHarmonyNioInternalDirectBuffer_getEffectiveAddress;
304     int         offJavaNioBuffer_capacity;
305     int         offJavaNioBuffer_effectiveDirectAddress;
306     int         offOrgApacheHarmonyLuniPlatformPlatformAddress_osaddr;
307     int         voffOrgApacheHarmonyLuniPlatformPlatformAddress_toLong;
308 
309     /*
310      * VM-synthesized primitive classes, for arrays.
311      */
312     ClassObject* volatile primitiveClass[PRIM_MAX];
313 
314     /*
315      * A placeholder ClassObject used during ClassObject
316      * construction.
317      */
318     ClassObject  unlinkedJavaLangClassObject;
319 
320     /*
321      * Thread list.  This always has at least one element in it (main),
322      * and main is always the first entry.
323      *
324      * The threadListLock is used for several things, including the thread
325      * start condition variable.  Generally speaking, you must hold the
326      * threadListLock when:
327      *  - adding/removing items from the list
328      *  - waiting on or signaling threadStartCond
329      *  - examining the Thread struct for another thread (this is to avoid
330      *    one thread freeing the Thread struct while another thread is
331      *    perusing it)
332      */
333     Thread*     threadList;
334     pthread_mutex_t threadListLock;
335 
336     pthread_cond_t threadStartCond;
337 
338     /*
339      * The thread code grabs this before suspending all threads.  There
340      * are a few things that can cause a "suspend all":
341      *  (1) the GC is starting;
342      *  (2) the debugger has sent a "suspend all" request;
343      *  (3) a thread has hit a breakpoint or exception that the debugger
344      *      has marked as a "suspend all" event;
345      *  (4) the SignalCatcher caught a signal that requires suspension.
346      *  (5) (if implemented) the JIT needs to perform a heavyweight
347      *      rearrangement of the translation cache or JitTable.
348      *
349      * Because we use "safe point" self-suspension, it is never safe to
350      * do a blocking "lock" call on this mutex -- if it has been acquired,
351      * somebody is probably trying to put you to sleep.  The leading '_' is
352      * intended as a reminder that this lock is special.
353      */
354     pthread_mutex_t _threadSuspendLock;
355 
356     /*
357      * Guards Thread->suspendCount for all threads, and provides the lock
358      * for the condition variable that all suspended threads sleep on
359      * (threadSuspendCountCond).
360      *
361      * This has to be separate from threadListLock because of the way
362      * threads put themselves to sleep.
363      */
364     pthread_mutex_t threadSuspendCountLock;
365 
366     /*
367      * Suspended threads sleep on this.  They should sleep on the condition
368      * variable until their "suspend count" is zero.
369      *
370      * Paired with "threadSuspendCountLock".
371      */
372     pthread_cond_t  threadSuspendCountCond;
373 
374     /*
375      * Sum of all threads' suspendCount fields.  The JIT needs to know if any
376      * thread is suspended.  Guarded by threadSuspendCountLock.
377      */
378     int  sumThreadSuspendCount;
379 
380     /*
381      * MUTEX ORDERING: when locking multiple mutexes, always grab them in
382      * this order to avoid deadlock:
383      *
384      *  (1) _threadSuspendLock      (use lockThreadSuspend())
385      *  (2) threadListLock          (use dvmLockThreadList())
386      *  (3) threadSuspendCountLock  (use lockThreadSuspendCount())
387      */
388 
389 
390     /*
391      * Thread ID bitmap.  We want threads to have small integer IDs so
392      * we can use them in "thin locks".
393      */
394     BitVector*  threadIdMap;
395 
396     /*
397      * Manage exit conditions.  The VM exits when all non-daemon threads
398      * have exited.  If the main thread returns early, we need to sleep
399      * on a condition variable.
400      */
401     int         nonDaemonThreadCount;   /* must hold threadListLock to access */
402     //pthread_mutex_t vmExitLock;
403     pthread_cond_t  vmExitCond;
404 
405     /*
406      * The set of DEX files loaded by custom class loaders.
407      */
408     HashTable*  userDexFiles;
409 
410     /*
411      * JNI global reference table.
412      */
413 #ifdef USE_INDIRECT_REF
414     IndirectRefTable jniGlobalRefTable;
415 #else
416     ReferenceTable  jniGlobalRefTable;
417 #endif
418     pthread_mutex_t jniGlobalRefLock;
419     int         jniGlobalRefHiMark;
420     int         jniGlobalRefLoMark;
421 
422     /*
423      * JNI pinned object table (used for primitive arrays).
424      */
425     ReferenceTable  jniPinRefTable;
426     pthread_mutex_t jniPinRefLock;
427 
428     /*
429      * Native shared library table.
430      */
431     HashTable*  nativeLibs;
432 
433     /*
434      * GC heap lock.  Functions like gcMalloc() acquire this before making
435      * any changes to the heap.  It is held throughout garbage collection.
436      */
437     pthread_mutex_t gcHeapLock;
438 
439     /* Opaque pointer representing the heap. */
440     GcHeap*     gcHeap;
441 
442     /*
443      * Pre-allocated throwables.
444      */
445     Object*     outOfMemoryObj;
446     Object*     internalErrorObj;
447     Object*     noClassDefFoundErrorObj;
448 
449     /* Monitor list, so we can free them */
450     /*volatile*/ Monitor* monitorList;
451 
452     /* Monitor for Thread.sleep() implementation */
453     Monitor*    threadSleepMon;
454 
455     /* set when we create a second heap inside the zygote */
456     bool        newZygoteHeapAllocated;
457 
458     /*
459      * TLS keys.
460      */
461     pthread_key_t pthreadKeySelf;       /* Thread*, for dvmThreadSelf */
462 
463     /*
464      * JNI allows you to have multiple VMs, but we limit ourselves to 1,
465      * so "vmList" is really just a pointer to the one and only VM.
466      */
467     JavaVM*     vmList;
468 
469     /*
470      * Cache results of "A instanceof B".
471      */
472     AtomicCache* instanceofCache;
473 
474     /* instruction width table, used for optimization and verification */
475     InstructionWidth*   instrWidth;
476     /* instruction flags table, used for verification */
477     InstructionFlags*   instrFlags;
478     /* instruction format table, used for verification */
479     InstructionFormat*  instrFormat;
480 
481     /*
482      * Bootstrap class loader linear allocator.
483      */
484     LinearAllocHdr* pBootLoaderAlloc;
485 
486 
487     /*
488      * Heap worker thread.
489      */
490     bool            heapWorkerInitialized;
491     bool            heapWorkerReady;
492     bool            haltHeapWorker;
493     pthread_t       heapWorkerHandle;
494     pthread_mutex_t heapWorkerLock;
495     pthread_cond_t  heapWorkerCond;
496     pthread_cond_t  heapWorkerIdleCond;
497     pthread_mutex_t heapWorkerListLock;
498 
499     /*
500      * Compute some stats on loaded classes.
501      */
502     int         numLoadedClasses;
503     int         numDeclaredMethods;
504     int         numDeclaredInstFields;
505     int         numDeclaredStaticFields;
506 
507     /* when using a native debugger, set this to suppress watchdog timers */
508     bool        nativeDebuggerActive;
509 
510     /*
511      * JDWP debugger support.
512      *
513      * Note "debuggerActive" is accessed from mterp, so its storage size and
514      * meaning must not be changed without updating the assembly sources.
515      */
516     bool        debuggerConnected;      /* debugger or DDMS is connected */
517     u1          debuggerActive;         /* debugger is making requests */
518     JdwpState*  jdwpState;
519 
520     /*
521      * Registry of objects known to the debugger.
522      */
523     HashTable*  dbgRegistry;
524 
525     /*
526      * Breakpoint optimization table.  This is global and NOT explicitly
527      * synchronized, but all operations that modify the table are made
528      * from relatively-synchronized functions.  False-positives are
529      * possible, false-negatives (i.e. missing a breakpoint) should not be.
530      */
531     const u2*   debugBreakAddr[MAX_BREAKPOINTS];
532 
533     /*
534      * Single-step control struct.  We currently only allow one thread to
535      * be single-stepping at a time, which is all that really makes sense,
536      * but it's possible we may need to expand this to be per-thread.
537      */
538     StepControl stepControl;
539 
540     /*
541      * DDM features embedded in the VM.
542      */
543     bool        ddmThreadNotification;
544 
545     /*
546      * Zygote (partially-started process) support
547      */
548     bool        zygote;
549 
550     /*
551      * Used for tracking allocations that we report to DDMS.  When the feature
552      * is enabled (through a DDMS request) the "allocRecords" pointer becomes
553      * non-NULL.
554      */
555     pthread_mutex_t allocTrackerLock;
556     AllocRecord*    allocRecords;
557     int             allocRecordHead;        /* most-recently-added entry */
558     int             allocRecordCount;       /* #of valid entries */
559 
560 #ifdef WITH_ALLOC_LIMITS
561     /* set on first use of an alloc limit, never cleared */
562     bool        checkAllocLimits;
563     /* allocation limit, for setGlobalAllocationLimit() regression testing */
564     int         allocationLimit;
565 #endif
566 
567 #ifdef WITH_DEADLOCK_PREDICTION
568     /* global lock on history tree accesses */
569     pthread_mutex_t deadlockHistoryLock;
570 
571     enum { kDPOff=0, kDPWarn, kDPErr, kDPAbort } deadlockPredictMode;
572 #endif
573 
574 #ifdef WITH_PROFILER
575     /*
576      * When a profiler is enabled, this is incremented.  Distinct profilers
577      * include "dmtrace" method tracing, emulator method tracing, and
578      * possibly instruction counting.
579      *
580      * The purpose of this is to have a single value that the interpreter
581      * can check to see if any profiling activity is enabled.
582      */
583     volatile int activeProfilers;
584 
585     /*
586      * State for method-trace profiling.
587      */
588     MethodTraceState methodTrace;
589 
590     /*
591      * State for emulator tracing.
592      */
593     void*       emulatorTracePage;
594     int         emulatorTraceEnableCount;
595 
596     /*
597      * Global state for memory allocation profiling.
598      */
599     AllocProfState allocProf;
600 
601     /*
602      * Pointers to the original methods for things that have been inlined.
603      * This makes it easy for us to output method entry/exit records for
604      * the method calls we're not actually making.
605      */
606     Method**    inlinedMethods;
607 
608     /*
609      * Dalvik instruction counts (256 entries).
610      */
611     int*        executedInstrCounts;
612     bool        instructionCountEnableCount;
613 #endif
614 
615     /*
616      * Signal catcher thread (for SIGQUIT).
617      */
618     pthread_t   signalCatcherHandle;
619     bool        haltSignalCatcher;
620 
621     /*
622      * Stdout/stderr conversion thread.
623      */
624     bool            haltStdioConverter;
625     bool            stdioConverterReady;
626     pthread_t       stdioConverterHandle;
627     pthread_mutex_t stdioConverterLock;
628     pthread_cond_t  stdioConverterCond;
629 
630     /*
631      * pid of the system_server process. We track it so that when system server
632      * crashes the Zygote process will be killed and restarted.
633      */
634     pid_t systemServerPid;
635 
636     int kernelGroupScheduling;
637 
638 //#define COUNT_PRECISE_METHODS
639 #ifdef COUNT_PRECISE_METHODS
640     PointerSet* preciseMethods;
641 #endif
642 
643     /* some RegisterMap statistics, useful during development */
644     void*       registerMapStats;
645 };
646 
647 extern struct DvmGlobals gDvm;
648 
649 #if defined(WITH_JIT)
650 
651 /*
652  * JIT-specific global state
653  */
654 struct DvmJitGlobals {
655     /*
656      * Guards writes to Dalvik PC (dPC), translated code address (codeAddr) and
657      * chain fields within the JIT hash table.  Note carefully the access
658      * mechanism.
659      * Only writes are guarded, and the guarded fields must be updated in a
660      * specific order using atomic operations.  Further, once a field is
661      * written it cannot be changed without halting all threads.
662      *
663      * The write order is:
664      *    1) codeAddr
665      *    2) dPC
666      *    3) chain [if necessary]
667      *
668      * This mutex also guards both read and write of curJitTableEntries.
669      */
670     pthread_mutex_t tableLock;
671 
672     /* The JIT hash table.  Note that for access speed, copies of this pointer
673      * are stored in each thread. */
674     struct JitEntry *pJitEntryTable;
675 
676     /* Array of profile threshold counters */
677     unsigned char *pProfTable;
678     unsigned char *pProfTableCopy;
679 
680     /* Size of JIT hash table in entries.  Must be a power of 2 */
681     unsigned int jitTableSize;
682 
683     /* Mask used in hash function for JitTable.  Should be jitTableSize-1 */
684     unsigned int jitTableMask;
685 
686     /* How many entries in the JitEntryTable are in use */
687     unsigned int jitTableEntriesUsed;
688 
689     /* Trigger for trace selection */
690     unsigned short threshold;
691 
692     /* JIT Compiler Control */
693     bool               haltCompilerThread;
694     bool               blockingMode;
695     pthread_t          compilerHandle;
696     pthread_mutex_t    compilerLock;
697     pthread_cond_t     compilerQueueActivity;
698     pthread_cond_t     compilerQueueEmpty;
699     int                compilerQueueLength;
700     int                compilerHighWater;
701     int                compilerWorkEnqueueIndex;
702     int                compilerWorkDequeueIndex;
703     CompilerWorkOrder  compilerWorkQueue[COMPILER_WORK_QUEUE_SIZE];
704 
705     /* JIT internal stats */
706     int                compilerMaxQueued;
707     int                addrLookupsFound;
708     int                addrLookupsNotFound;
709     int                noChainExit;
710     int                normalExit;
711     int                puntExit;
712     int                translationChains;
713     int                invokeChain;
714     int                invokePredictedChain;
715     int                invokeNative;
716     int                returnOp;
717 
718     /* Compiled code cache */
719     void* codeCache;
720 
721     /* Bytes used by the code templates */
722     unsigned int templateSize;
723 
724     /* Bytes already used in the code cache */
725     unsigned int codeCacheByteUsed;
726 
727     /* Number of installed compilations in the cache */
728     unsigned int numCompilations;
729 
730     /* Flag to indicate that the code cache is full */
731     bool codeCacheFull;
732 
733     /* true/false: compile/reject opcodes specified in the -Xjitop list */
734     bool includeSelectedOp;
735 
736     /* true/false: compile/reject methods specified in the -Xjitmethod list */
737     bool includeSelectedMethod;
738 
739     /* Disable JIT for selected opcodes - one bit for each opcode */
740     char opList[32];
741 
742     /* Disable JIT for selected methods */
743     HashTable *methodTable;
744 
745     /* Flag to dump all compiled code */
746     bool printMe;
747 
748     /* Flag to count trace execution */
749     bool profile;
750 
751     /* Table to track the overall and trace statistics of hot methods */
752     HashTable*  methodStatsTable;
753 };
754 
755 extern struct DvmJitGlobals gDvmJit;
756 
757 #endif
758 
759 #endif /*_DALVIK_GLOBALS*/
760