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