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