globals.h
来自「This is a resource based on j2me embedde」· C头文件 代码 · 共 676 行 · 第 1/2 页
H
676 行
/* * Copyright 1990-2008 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 only, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is * included at /legal/license.txt). * * You should have received a copy of the GNU General Public License * version 2 along with this work; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 or visit www.sun.com if you need additional * information or have any questions. * */#ifndef _INCLUDED_GLOBALS_H#define _INCLUDED_GLOBALS_H#include "javavm/include/defs.h"#include "javavm/include/objects.h"#include "javavm/include/classes.h"#include "javavm/include/interpreter.h"#include "javavm/include/stacks.h"#include "javavm/include/porting/globals.h"#include "javavm/include/sync.h"#include "javavm/include/cstates.h"#include "javavm/include/jni_impl.h"#include "javavm/include/packages.h"#include "javavm/include/utils.h"#include "javavm/include/jvmtiExport.h"#include "javavm/include/jvmpi_impl.h"#ifdef CVM_XRUN#include "javavm/include/xrun.h"#endif#ifdef CVM_AGENTLIB#include "javavm/include/agentlib.h"#endif#ifdef CVM_INSPECTOR#include "javavm/include/inspector.h"#endif#ifdef CVM_JIT#include "javavm/include/jit_common.h"#ifdef CVM_CCM_COLLECT_STATS#include "javavm/include/ccm_runtime.h"#endif /* CVM_CCM_COLLECT_STATS */#endif /* CVM_JIT *//* * This file is generated from the GC choice given at build time. */#include "generated/javavm/include/gc_config.h"typedef void (*pProc)(void);typedef struct exit_proc { pProc proc; struct exit_proc *next;} * exit_procPtr;typedef void (*loopProcPtr)(CVMExecEnv*, CVMMethodBlock *, CVMBool, CVMBool);struct CVMOptions { void *vfprintfHook; void *exitHook; void *abortHook; void *safeExitHook;#ifdef CVM_TIMESTAMPING CVMBool timeStampEnabled;#endif const char *startHeapSizeStr; const char *minHeapSizeStr; const char *maxHeapSizeStr; const char *nativeStackSizeStr; const char *gcAttributesStr; const char *optAttributesStr;#ifdef CVM_JIT const char *jitAttributesStr;#endif#ifdef CVM_TRACE_ENABLED const char *traceFlagsStr;#endif#ifdef CVM_JVMTI CVMBool debugging;#endif#ifdef CVM_CLASSLOADING CVMUint16 classVerificationLevel; const char *bootclasspathStr; const char *appclasspathStr;#endif#ifdef CVM_HAVE_PROCESS_MODEL CVMBool fullShutdownFlag;#endif#ifndef CDC_10 CVMBool javaAssertionsUserDefault; /* User class default (-ea/-da). */ CVMBool javaAssertionsSysDefault; /* System class default (-esa/-dsa). */ /* classes with assertions enabled or disabled */ CVMJavaAssertionsOptionList* javaAssertionsClasses; /* packages with assertions enabled or disabled */ CVMJavaAssertionsOptionList* javaAssertionsPackages;#endif#ifdef CVM_MTASK CVMBool isServer;#endif};struct CVMGlobalState { /* * Global variables go here. */ /* * The allocation pointer and limit. These are used for fast heap * allocation from assembler code. */ CVMUint32** allocPtrPtr; CVMUint32** allocTopPtr;#ifdef CVM_ADV_ATOMIC_SWAP /* This is the heap lock if atomic swap is supported */ /* * fastHeapLock is used in * CVMatomicSwap(&fastHeapLock, 1) == 0 * which requires a CVMAddr * */ volatile CVMAddr fastHeapLock;#else CVMAddr unused1; /* keep offsets consistent */#endif#ifdef CVM_TRACE_ENABLED CVMUint32 debugFlags;#else CVMUint32 unused2; /* keep offsets consistent */#endif#ifdef CVM_TRACE_JIT CVMUint32 debugJITFlags;#else CVMUint32 unused3; /* keep offsets consistent */#endif CVMUint32 unused4; /* make sure cstate has 8-byte alignment */ /* shared data for consistent states */ CVMCState cstate[CVM_NUM_CONSISTENT_STATES]; CVMMicroLock objGlobalMicroLock; CVMSysMutex globalRootsLock; /* protect globalRoots */ CVMStack globalRoots; /* stack for allocating global roots, used for JNI global refs and CVM global roots. */ CVMSysMutex weakGlobalRootsLock; /* protect weakGlobalRoots */ CVMStack weakGlobalRoots; /* stack for allocating JNI weak global refs */ /* * Class and ClassLoader global roots: * * The CVMcbJavaInstance and CVMcbClassLoader fields can't be * regular global roots, or gc would have to make special checks * on each global root in order to make class unloading work. It * would need to check if the global root is a Class or ClassLoader * instance, and skip them on full gc's (which do class unloading). * * The classGlobalRoots are for CVMcbJavaInstance fields and the * classLoaderGlobalRoots are for CVMcbClassLoader fields. The latter * only has one allocated per ClassLoader, which will be shared among * all classes loaded by the ClassLoader. Access to both types of roots * is protected using the classTable lock. */ CVMStack classGlobalRoots; /* for allocating Class global roots */ CVMStack classLoaderGlobalRoots; /* for allocating ClassLoader global */ /* * The CVMcbProtectionDomain field can't be a regular global root. * Since a ProtectionDomain (now) points to a ClassLoader, the ClassLoader * points to the Class, and the class points to the ProtectionDomain * via this global root, it would make class unloading impossible. * So we set up a different set of global roots which are marked * when their referencing classes are scanned. */ CVMStack protectionDomainGlobalRoots; /* * Table of all dynamically loaded classes. Protected by the * classTable lock. */ CVMStack classTable; /* * Lists of classes to and ClassLoader globa roots to free. These lists * are setup by CVMclassDoClassUnloadingPass1() and processed by * CVMclassDoClassUnloadingPass2(). */ CVMClassBlock* freeClassList; CVMClassLoaderICell* freeClassLoaderList; /* * ClassTable lock - It not only protects the classTable, but also * the classGlobalRoots and classLoaderGlobalRoots. */ CVMSysMutex classTableLock; #define CVM_CLASSTABLE_LOCK(ee) \ CVMsysMutexLock(ee, &CVMglobals.classTableLock)#define CVM_CLASSTABLE_UNLOCK(ee) \ CVMsysMutexUnlock(ee, &CVMglobals.classTableLock)#define CVM_CLASSTABLE_ASSERT_LOCKED(ee) \ CVMassert(CVMsysMutexIAmOwner(ee, &CVMglobals.classTableLock)); /* * Cache of all <Class,ClassLoader> pairs that we have loaded. Protected * by the loaderCache lock. */ CVMLoaderCacheEntry** loaderCache; /* * Database of loader constraints. See loaderconstraints.c for details. * Protected by the loaderCache lock. */#ifdef CVM_CLASSLOADING CVMLoaderConstraint** loaderConstraints;#endif /* * loaderCache lock - It protects the loaderCache and loaderConstraints */ CVMSysMutex loaderCacheLock; #define CVM_LOADERCACHE_LOCK(ee) \ CVMsysMutexLock(ee, &CVMglobals.loaderCacheLock)#define CVM_LOADERCACHE_UNLOCK(ee) \ CVMsysMutexUnlock(ee, &CVMglobals.loaderCacheLock)#define CVM_LOADERCACHE_ASSERT_LOCKED(ee) \ CVMassert(CVMsysMutexIAmOwner(ee, &CVMglobals.loaderCacheLock));#define CVM_LOADERCACHE_ASSERT_UNLOCKED(ee) \ CVMassert(!CVMsysMutexIAmOwner(ee, &CVMglobals.loaderCacheLock)); CVMSysMutex heapLock; /* The memory-related lock */#ifdef CVM_CLASSLOADING CVMSysMutex nullClassLoaderLock; /* The NULL classloader lock */#endif #ifdef CVM_JVMTI CVMSysMutex jvmtiLock; CVMSysMutex jvmtiLockInfoLock;#endif /* * Target global variables */ CVMTargetGlobalState target; /* * Maximum heap size for CVM - used at Runtime.maxMemory() */ CVMUint32 maxHeapSize;#ifdef CVM_INSPECTOR /* See gc_common.h the GC locker mechanism: */ CVMGCLocker inspectorGCLocker; CVMCondVar gcLockerCV; /* Used in conjuction with the gcLockerLock. */#endif#if defined(CVM_INSPECTOR) || defined(CVM_JVMPI) || defined(CVM_JVMTI) CVMSysMutex gcLockerLock;#endif /* * GC specific global state */ CVMGCCommonGlobalState gcCommon; CVMGCGlobalState gc;#ifdef CVM_JIT#ifdef CVM_SEGMENTED_HEAP /* * Bounds of youngest generation * used while generating write barriers in JIT */ CVMUint32* youngGenLowerBound; CVMUint32* youngGenUpperBound;#endif /* * JIT specific global state */ CVMJITGlobalState jit; CVMSysMutex jitLock;#ifdef CVM_CCM_COLLECT_STATS CVMCCMGlobalStats ccmStats;#endif /* CVM_CCM_COLLECT_STATS */#endif /* CVM_JIT */ /* * JNI JavaVM state */ CVMJNIJavaVM javaVM; /* * The execution environment for the main thread. * Although the mainEE is embedded in CVMGlobalState structure * for convenience of initialization, its life cycle is independent * from CVMglobals. mainEE gets destroyed when the main thread * (that created the JVM) terminates, which can occur prior to * the destruction of CVMglobals (which happens at the termination * of the JVM. */ CVMExecEnv mainEE; /* * Thread list */ CVMSysMutex threadLock; /* protect threadList */ CVMExecEnv *threadList; /* linked-list of threads */ CVMUint32 userThreadCount; CVMUint32 threadCount; CVMCondVar threadCountCV; CVMUint32 threadIDCount; CVMSysMutex syncLock; /* Object monitor "inflation" */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?