1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
14 // This will need ifdefs for non-x86 processors (ia64 is pointer to 128bit instructions)!
16 typedef DPTR(SLOT) PTR_SLOT;
18 typedef LPVOID DictionaryEntry;
20 /* Define the implementation dependent size types */
22 #ifndef _INTPTR_T_DEFINED
24 typedef __int64 intptr_t;
28 #define _INTPTR_T_DEFINED
31 #ifndef _UINTPTR_T_DEFINED
33 typedef unsigned __int64 uintptr_t;
35 typedef unsigned int uintptr_t;
37 #define _UINTPTR_T_DEFINED
40 #ifndef _PTRDIFF_T_DEFINED
42 typedef __int64 ptrdiff_t;
44 typedef int ptrdiff_t;
46 #define _PTRDIFF_T_DEFINED
50 #ifndef _SIZE_T_DEFINED
52 typedef unsigned __int64 size_t;
54 typedef unsigned int size_t;
56 #define _SIZE_T_DEFINED
60 #ifndef _WCHAR_T_DEFINED
61 typedef unsigned short wchar_t;
62 #define _WCHAR_T_DEFINED
67 #include <cordbpriv.h>
70 #include "eeprofinterfaces.h"
73 #include "profilepriv.h"
75 #include "gcinterface.h"
82 class TransparentProxyObject;
89 class IPCWriterInterface;
90 namespace ETW { class CEtwTracer; };
92 class DebugInfoManager;
93 class EEDbgInterfaceImpl;
96 #ifdef FEATURE_COMINTEROP
98 #endif // FEATURE_COMINTEROP
102 // loader handles are opaque types that track object pointers that have a lifetime
103 // that matches that of a loader allocator
105 struct LOADERHANDLE__
109 typedef TADDR LOADERHANDLE;
112 #ifdef DACCESS_COMPILE
113 void OBJECTHANDLE_EnumMemoryRegions(OBJECTHANDLE handle);
114 void OBJECTREF_EnumMemoryRegions(OBJECTREF ref);
118 #ifdef USE_CHECKED_OBJECTREFS
121 //=========================================================================
122 // In the retail build, OBJECTREF is typedef'd to "Object*".
123 // In the debug build, we use operator overloading to detect
124 // common programming mistakes that create GC holes. The critical
127 // 1. Your thread must have disabled preemptive GC before
128 // reading or writing any OBJECTREF. When preemptive GC is enabled,
129 // another other thread can suspend you at any time and
130 // move or discard objects.
131 // 2. You must guard your OBJECTREF's using a root pointer across
132 // any code that might trigger a GC.
134 // Each of the overloads validate that:
136 // 1. Preemptive GC is currently disabled
137 // 2. The object looks consistent (checked by comparing the
138 // object's methodtable pointer with that of the class.)
147 // if (or != NULL) {}
150 //=========================================================================
153 // Holds the real object pointer.
154 // The union gives us better debugger pretty printing
157 class StringObject* m_asString;
158 class ArrayBase* m_asArray;
159 class PtrArray* m_asPtrArray;
160 class DelegateObject* m_asDelegate;
161 class TransparentProxyObject* m_asTP;
163 class ReflectClassBaseObject* m_asReflectClass;
164 class ExecutionContextObject* m_asExecutionContext;
165 class AppDomainBaseObject* m_asAppDomainBase;
166 class PermissionSetObject* m_asPermissionSetObject;
170 //-------------------------------------------------------------
171 // Default constructor, for non-initializing declarations:
174 //-------------------------------------------------------------
177 //-------------------------------------------------------------
178 // Copy constructor, for passing OBJECTREF's as function arguments.
179 //-------------------------------------------------------------
180 OBJECTREF(const OBJECTREF & objref);
182 //-------------------------------------------------------------
183 // To allow NULL to be used as an OBJECTREF.
184 //-------------------------------------------------------------
185 OBJECTREF(TADDR nul);
187 //-------------------------------------------------------------
188 // Test against NULL.
189 //-------------------------------------------------------------
190 int operator!() const;
192 //-------------------------------------------------------------
193 // Compare two OBJECTREF's.
194 //-------------------------------------------------------------
195 int operator==(const OBJECTREF &objref) const;
197 //-------------------------------------------------------------
198 // Compare two OBJECTREF's.
199 //-------------------------------------------------------------
200 int operator!=(const OBJECTREF &objref) const;
202 //-------------------------------------------------------------
203 // Forward method calls.
204 //-------------------------------------------------------------
205 Object* operator->();
206 const Object* operator->() const;
208 //-------------------------------------------------------------
209 // Assignment. We don't validate the destination so as not
210 // to break the sequence:
214 //-------------------------------------------------------------
215 OBJECTREF& operator=(const OBJECTREF &objref);
216 OBJECTREF& operator=(TADDR nul);
218 // allow explict casts
219 explicit OBJECTREF(Object *pObject);
221 void Validate(BOOL bDeep = TRUE, BOOL bVerifyNextHeader = TRUE, BOOL bVerifySyncBlock = TRUE);
225 //-------------------------------------------------------------
226 // template class REF for different types of REF class to be used
228 // Template type should be a class that extends Object
229 //-------------------------------------------------------------
234 class REF : public OBJECTREF
238 //-------------------------------------------------------------
239 // Default constructor, for non-initializing declarations:
242 //-------------------------------------------------------------
245 LIMITED_METHOD_CONTRACT;
249 //-------------------------------------------------------------
250 // Copy constructor, for passing OBJECTREF's as function arguments.
251 //-------------------------------------------------------------
252 explicit REF(const OBJECTREF& objref) : OBJECTREF(objref)
254 LIMITED_METHOD_CONTRACT;
259 //-------------------------------------------------------------
260 // To allow NULL to be used as an OBJECTREF.
261 //-------------------------------------------------------------
262 REF(TADDR nul) : OBJECTREF (nul)
264 LIMITED_METHOD_CONTRACT;
268 explicit REF(T* pObject) : OBJECTREF(pObject)
270 LIMITED_METHOD_CONTRACT;
274 //-------------------------------------------------------------
275 // Forward method calls.
276 //-------------------------------------------------------------
279 // What kind of statement can we make about member methods on Object
280 // except that we need to be in COOPERATIVE when touching them?
281 STATIC_CONTRACT_MODE_COOPERATIVE;
282 return (T *)OBJECTREF::operator->();
285 const T* operator->() const
287 // What kind of statement can we make about member methods on Object
288 // except that we need to be in COOPERATIVE when touching them?
289 STATIC_CONTRACT_MODE_COOPERATIVE;
290 return (const T *)OBJECTREF::operator->();
293 //-------------------------------------------------------------
294 // Assignment. We don't validate the destination so as not
295 // to break the sequence:
299 //-------------------------------------------------------------
300 REF<T> &operator=(OBJECTREF &objref)
302 STATIC_CONTRACT_NOTHROW;
303 STATIC_CONTRACT_GC_NOTRIGGER;
304 STATIC_CONTRACT_CANNOT_TAKE_LOCK;
305 STATIC_CONTRACT_MODE_COOPERATIVE;
306 return (REF<T>&)OBJECTREF::operator=(objref);
311 // the while (0) syntax below is to force a trailing semicolon on users of the macro
312 #define VALIDATEOBJECTREF(objref) do {if ((objref) != NULL) (objref).Validate();} while (0)
313 #define VALIDATEOBJECT(obj) do {if ((obj) != NULL) (obj)->Validate();} while (0)
315 #define ObjectToOBJECTREF(obj) (OBJECTREF(obj))
316 #define OBJECTREFToObject(objref) ((objref).operator-> ())
317 #define ObjectToSTRINGREF(obj) (STRINGREF(obj))
318 #define STRINGREFToObject(objref) (*( (StringObject**) &(objref) ))
319 #define ObjectToSTRINGBUFFERREF(obj) (STRINGBUFFERREF(obj))
320 #define STRINGBUFFERREFToObject(objref) (*( (StringBufferObject**) &(objref) ))
324 #define VALIDATEOBJECTREF(objref)
325 #define VALIDATEOBJECT(obj)
327 #define ObjectToOBJECTREF(obj) ((PTR_Object) (obj))
328 #define OBJECTREFToObject(objref) ((PTR_Object) (objref))
329 #define ObjectToSTRINGREF(obj) ((PTR_StringObject) (obj))
330 #define STRINGREFToObject(objref) ((PTR_StringObject) (objref))
331 #define ObjectToSTRINGBUFFERREF(obj) ((Ptr_StringBufferObject) (obj))
332 #define STRINGBUFFERREFToObject(objref) ((Ptr_StringBufferObject) (objref))
334 #endif // _DEBUG_IMPL
337 // <TODO> Get rid of these! Don't use them any more!</TODO>
338 #define MAX_CLASSNAME_LENGTH 1024
339 #define MAX_NAMESPACE_LENGTH 1024
342 class ClassLoaderList;
346 #define EXTERN extern
348 // For [<I1, etc. up to and including [Object
349 GARY_DECL(PTR_ArrayTypeDesc, g_pPredefinedArrayTypes, ELEMENT_TYPE_MAX);
351 extern "C" Volatile<LONG> g_TrapReturningThreads;
353 EXTERN HINSTANCE g_pMSCorEE;
354 EXTERN BBSweep g_BBSweep;
355 EXTERN IBCLogger g_IBCLogger;
358 // next two variables are used to enforce an ASSERT in Thread::DbgFindThread
359 // that does not allow g_TrapReturningThreads to creep up unchecked.
360 EXTERN Volatile<LONG> g_trtChgStamp;
361 EXTERN Volatile<LONG> g_trtChgInFlight;
362 EXTERN char * g_ExceptionFile;
363 EXTERN DWORD g_ExceptionLine;
364 EXTERN void * g_ExceptionEIP;
366 EXTERN void * g_LastAccessViolationEIP;
368 GPTR_DECL(EEConfig, g_pConfig); // configuration data (from the registry)
369 GPTR_DECL(MethodTable, g_pObjectClass);
370 GPTR_DECL(MethodTable, g_pRuntimeTypeClass);
371 GPTR_DECL(MethodTable, g_pCanonMethodTableClass); // System.__Canon
372 GPTR_DECL(MethodTable, g_pStringClass);
373 GPTR_DECL(MethodTable, g_pArrayClass);
374 GPTR_DECL(MethodTable, g_pSZArrayHelperClass);
375 GPTR_DECL(MethodTable, g_pNullableClass);
376 GPTR_DECL(MethodTable, g_pByReferenceClass);
377 GPTR_DECL(MethodTable, g_pExceptionClass);
378 GPTR_DECL(MethodTable, g_pThreadAbortExceptionClass);
379 GPTR_DECL(MethodTable, g_pOutOfMemoryExceptionClass);
380 GPTR_DECL(MethodTable, g_pStackOverflowExceptionClass);
381 GPTR_DECL(MethodTable, g_pExecutionEngineExceptionClass);
382 GPTR_DECL(MethodTable, g_pThreadAbortExceptionClass);
383 GPTR_DECL(MethodTable, g_pDelegateClass);
384 GPTR_DECL(MethodTable, g_pMulticastDelegateClass);
385 GPTR_DECL(MethodTable, g_pFreeObjectMethodTable);
386 GPTR_DECL(MethodTable, g_pValueTypeClass);
387 GPTR_DECL(MethodTable, g_pEnumClass);
388 GPTR_DECL(MethodTable, g_pThreadClass);
389 GPTR_DECL(MethodTable, g_pOverlappedDataClass);
391 GPTR_DECL(MethodTable, g_TypedReferenceMT);
393 GPTR_DECL(MethodTable, g_pByteArrayMT);
395 #ifdef FEATURE_COMINTEROP
396 GPTR_DECL(MethodTable, g_pBaseCOMObject);
397 GPTR_DECL(MethodTable, g_pBaseRuntimeClass);
400 #ifdef FEATURE_ICASTABLE
401 GPTR_DECL(MethodTable, g_pICastableInterface);
402 #endif // FEATURE_ICASTABLE
404 GPTR_DECL(MethodDesc, g_pExecuteBackoutCodeHelperMethod);
406 GPTR_DECL(MethodDesc, g_pObjectFinalizerMD);
408 GVAL_DECL(DWORD, g_TlsIndex);
410 // Global System Information
411 extern SYSTEM_INFO g_SystemInfo;
413 // <TODO>@TODO - PROMOTE.</TODO>
414 // <TODO>@TODO - I'd like to make these private members of CLRException some day.</TODO>
415 EXTERN OBJECTHANDLE g_pPreallocatedOutOfMemoryException;
416 EXTERN OBJECTHANDLE g_pPreallocatedStackOverflowException;
417 EXTERN OBJECTHANDLE g_pPreallocatedExecutionEngineException;
418 EXTERN OBJECTHANDLE g_pPreallocatedRudeThreadAbortException;
420 // We may not be able to create a normal thread abort exception if OOM or StackOverFlow.
421 // When this happens, we will use our pre-allocated thread abort exception.
422 EXTERN OBJECTHANDLE g_pPreallocatedThreadAbortException;
424 // we use this as a dummy object to indicate free space in the handle tables -- this object is never visible to the world
425 EXTERN OBJECTHANDLE g_pPreallocatedSentinelObject;
427 // We use this object to return a preallocated System.Exception instance when we have nothing
429 EXTERN OBJECTHANDLE g_pPreallocatedBaseException;
431 GPTR_DECL(Thread,g_pFinalizerThread);
432 GPTR_DECL(Thread,g_pSuspensionThread);
434 // Global SyncBlock cache
435 typedef DPTR(SyncTableEntry) PTR_SyncTableEntry;
436 GPTR_DECL(SyncTableEntry, g_pSyncTable);
438 #if defined(ENABLE_PERF_COUNTERS) || defined(FEATURE_EVENT_TRACE)
439 // Note this is not updated in a thread safe way so the value may not be accurate. We get
440 // it accurately in full GCs if the handle count is requested.
441 extern DWORD g_dwHandles;
442 #endif // ENABLE_PERF_COUNTERS || FEATURE_EVENT_TRACE
444 #ifdef FEATURE_COMINTEROP
445 // Global RCW cleanup list
446 typedef DPTR(RCWCleanupList) PTR_RCWCleanupList;
447 GPTR_DECL(RCWCleanupList,g_pRCWCleanupList);
448 #endif // FEATURE_COMINTEROP
450 #ifdef FEATURE_IPCMAN
451 // support for IPCManager
452 typedef DPTR(IPCWriterInterface) PTR_IPCWriterInterface;
453 GPTR_DECL(IPCWriterInterface, g_pIPCManagerInterface);
454 #endif // FEATURE_IPCMAN
456 // support for Event Tracing for Windows (ETW)
457 EXTERN ETW::CEtwTracer* g_pEtwTracer;
461 typedef DPTR(StressLog) PTR_StressLog;
462 GPTR_DECL(StressLog, g_pStressLog);
467 // Support for the COM+ Debugger.
469 GPTR_DECL(DebugInterface, g_pDebugInterface);
470 GVAL_DECL(DWORD, g_CORDebuggerControlFlags);
471 #ifdef DEBUGGING_SUPPORTED
472 GPTR_DECL(EEDbgInterfaceImpl, g_pEEDbgInterfaceImpl);
473 #endif // DEBUGGING_SUPPORTED
475 #ifdef PROFILING_SUPPORTED
476 EXTERN HINSTANCE g_pDebuggerDll;
479 // Global default for Concurrent GC. The default is on (value 1)
480 EXTERN int g_IGCconcurrent;
481 extern int g_IGCHoardVM;
484 extern int g_IGCTrimCommit;
487 extern BOOL g_fEnableETW;
488 extern BOOL g_fEnableARM;
490 // Returns a BOOL to indicate if the runtime is active or not
491 BOOL IsRuntimeActive();
494 // Can we run managed code?
496 struct LoaderLockCheck
505 BOOL CanRunManagedCode(LoaderLockCheck::kind checkKind, HINSTANCE hInst = 0);
506 inline BOOL CanRunManagedCode(HINSTANCE hInst = 0)
508 return CanRunManagedCode(LoaderLockCheck::ForMDA, hInst);
512 // Global state variable indicating if the EE is in its init phase.
514 EXTERN bool g_fEEInit;
517 // Global state variable indicating if the EE has been started up.
519 EXTERN Volatile<BOOL> g_fEEStarted;
521 #ifdef FEATURE_COMINTEROP
523 // Global state variable indicating if COM has been started up.
525 EXTERN BOOL g_fComStarted;
530 // Global state variables indicating which stage of shutdown we are in
532 GVAL_DECL(DWORD, g_fEEShutDown);
533 EXTERN DWORD g_fFastExitProcess;
534 #ifndef DACCESS_COMPILE
535 EXTERN BOOL g_fSuspendOnShutdown;
536 EXTERN BOOL g_fSuspendFinalizerOnShutdown;
537 #endif // DACCESS_COMPILE
538 EXTERN Volatile<LONG> g_fForbidEnterEE;
539 GVAL_DECL(bool, g_fProcessDetach);
540 EXTERN bool g_fManagedAttach;
541 EXTERN bool g_fNoExceptions;
542 #ifdef FEATURE_COMINTEROP
543 EXTERN bool g_fShutDownCOM;
544 #endif // FEATURE_COMINTEROP
546 // Indicates whether we're executing shut down as a result of DllMain
547 // (DLL_PROCESS_DETACH). See comments at code:EEShutDown for details.
548 inline BOOL IsAtProcessExit()
551 return g_fProcessDetach;
556 FWS_WaitInterrupt = 0x00000001,
559 EXTERN DWORD g_FinalizerWaiterStatus;
560 extern ULONGLONG g_ObjFinalizeStartTime;
561 extern Volatile<BOOL> g_FinalizerIsRunning;
562 extern Volatile<ULONG> g_FinalizerLoopCount;
564 #if defined(FEATURE_PAL) && defined(FEATURE_EVENT_TRACE)
565 extern Volatile<BOOL> g_TriggerHeapDump;
566 #endif // FEATURE_PAL
568 extern LONG GetProcessedExitProcessEventCount();
570 #ifndef DACCESS_COMPILE
572 // Allow use of native images?
574 extern bool g_fAllowNativeImages;
577 // Default install library
579 EXTERN const WCHAR g_pwBaseLibrary[];
580 EXTERN const WCHAR g_pwBaseLibraryName[];
581 EXTERN const char g_psBaseLibrary[];
582 EXTERN const char g_psBaseLibraryName[];
583 EXTERN const char g_psBaseLibrarySatelliteAssemblyName[];
585 #ifdef FEATURE_COMINTEROP
586 EXTERN const WCHAR g_pwBaseLibraryTLB[];
587 EXTERN const char g_psBaseLibraryTLB[];
588 #endif // FEATURE_COMINTEROP
589 #endif // DACCESS_COMPILE
592 // Do we own the lifetime of the process, ie. is it an EXE?
594 EXTERN bool g_fWeControlLifetime;
597 // The following should only be used for assertions. (Famous last words).
598 EXTERN bool dbg_fDrasticShutdown;
600 EXTERN bool g_fInControlC;
602 // There is a global table of prime numbers that's available for e.g. hashing
603 extern const DWORD g_rgPrimes[71];
606 // Cached command line file provided by the host.
608 extern LPWSTR g_pCachedCommandLine;
609 extern LPWSTR g_pCachedModuleFileName;
612 // Macros to check debugger and profiler settings.
614 inline bool CORDebuggerPendingAttach()
616 LIMITED_METHOD_CONTRACT;
618 // If we're in rude shutdown, then pretend the debugger is detached.
619 // We want shutdown to be as simple as possible, so this avoids
620 // us trying to do elaborate operations while exiting.
621 return (g_CORDebuggerControlFlags & DBCF_PENDING_ATTACH) && !IsAtProcessExit();
624 inline bool CORDebuggerAttached()
626 LIMITED_METHOD_CONTRACT;
628 // If we're in rude shutdown, then pretend the debugger is detached.
629 // We want shutdown to be as simple as possible, so this avoids
630 // us trying to do elaborate operations while exiting.
631 return (g_CORDebuggerControlFlags & DBCF_ATTACHED) && !IsAtProcessExit();
634 #define CORDebuggerAllowJITOpts(dwDebuggerBits) \
635 (((dwDebuggerBits) & DACF_ALLOW_JIT_OPTS) \
637 ((g_CORDebuggerControlFlags & DBCF_ALLOW_JIT_OPT) && \
638 !((dwDebuggerBits) & DACF_USER_OVERRIDE)))
640 #define CORDebuggerEnCMode(dwDebuggerBits) \
641 ((dwDebuggerBits) & DACF_ENC_ENABLED)
643 #define CORDebuggerTraceCall() \
644 (CORDebuggerAttached() && GetThread()->IsTraceCall())
649 // Define stuff for precedence between profiling and debugging
650 // flags that can both be set.
653 #if defined(PROFILING_SUPPORTED) || defined(PROFILING_SUPPORTED_DATA)
655 #ifdef DEBUGGING_SUPPORTED
657 #define CORDisableJITOptimizations(dwDebuggerBits) \
658 (CORProfilerDisableOptimizations() || \
659 !CORDebuggerAllowJITOpts(dwDebuggerBits))
661 #else // !DEBUGGING_SUPPORTED
663 #define CORDisableJITOptimizations(dwDebuggerBits) \
664 CORProfilerDisableOptimizations()
666 #endif// DEBUGGING_SUPPORTED
668 #else // !defined(PROFILING_SUPPORTED) && !defined(PROFILING_SUPPORTED_DATA)
670 #ifdef DEBUGGING_SUPPORTED
672 #define CORDisableJITOptimizations(dwDebuggerBits) \
673 !CORDebuggerAllowJITOpts(dwDebuggerBits)
675 #else // DEBUGGING_SUPPORTED
677 #define CORDisableJITOptimizations(dwDebuggerBits) FALSE
679 #endif// DEBUGGING_SUPPORTED
681 #endif// defined(PROFILING_SUPPORTED) || defined(PROFILING_SUPPORTED_DATA)
687 // IJW needs the shim HINSTANCE
689 EXTERN HINSTANCE g_hInstShim;
692 GVAL_DECL(SIZE_T, g_runtimeLoadedBaseAddress);
693 GVAL_DECL(SIZE_T, g_runtimeVirtualSize);
694 #endif // !FEATURE_PAL
698 #define MAXULONG 0xffffffff
702 #define MAXULONGLONG UI64(0xffffffffffffffff)
706 // code:ADID is an ID for an appdomain that is sparse and remains unique within the process for the lifetime of the process.
707 // Remoting and (I believe) the thread pool use the former as a way of referring to appdomains outside of their normal lifetime safely.
708 // Interop also uses ADID to handle issues involving unloaded domains.
710 // code:ADIndex is an ID for an appdomain that's dense and may be reused once the appdomain is unloaded.
711 // This is useful for fast array based lookup from a number to an appdomain property.
718 explicit ADIndex (DWORD id)
723 BOOL operator==(const ADIndex& ad) const
725 return m_dwIndex == ad.m_dwIndex;
727 BOOL operator!=(const ADIndex& ad) const
729 return m_dwIndex != ad.m_dwIndex;
733 // An ADID is a number that represents an appdomain. They are allcoated with code:SystemDomain::GetNewAppDomainId
734 // ADIDs are NOT reused today, so they are unique even after the appdomain dies.
736 // see also code:BaseDomain::m_dwId
737 // see also code:ADIndex
738 // see also code:ADIndex#ADID_vs_ADIndex
744 {LIMITED_METHOD_CONTRACT;}
745 explicit ADID (DWORD id)
747 {LIMITED_METHOD_CONTRACT;}
748 BOOL operator==(const ADID& ad) const
750 LIMITED_METHOD_DAC_CONTRACT;
751 return m_dwId == ad.m_dwId;
753 BOOL operator!=(const ADID& ad) const
755 LIMITED_METHOD_CONTRACT;
756 return m_dwId != ad.m_dwId;
766 explicit TPIndex (DWORD id)
769 BOOL operator==(const TPIndex& tpindex) const
771 return m_dwIndex == tpindex.m_dwIndex;
773 BOOL operator!=(const TPIndex& tpindex) const
775 return m_dwIndex != tpindex.m_dwIndex;
779 // Every Module is assigned a ModuleIndex, regardless of whether the Module is domain
780 // neutral or domain specific. When a domain specific Module is unloaded, its ModuleIndex
783 // ModuleIndexes are not the same as ModuleIDs. The main purpose of a ModuleIndex is
784 // to have a compact way to refer to any Module (domain neutral or domain specific).
785 // The main purpose of a ModuleID is to facilitate looking up the DomainLocalModule
786 // that corresponds to a given Module in a given AppDomain.
794 explicit ModuleIndex (SIZE_T id)
796 { LIMITED_METHOD_DAC_CONTRACT; }
797 BOOL operator==(const ModuleIndex& ad) const
799 return m_dwIndex == ad.m_dwIndex;
801 BOOL operator!=(const ModuleIndex& ad) const
803 return m_dwIndex != ad.m_dwIndex;
807 //-----------------------------------------------------------------------------
808 // GSCookies (guard-stack cookies) for detecting buffer overruns
809 //-----------------------------------------------------------------------------
811 typedef DPTR(GSCookie) PTR_GSCookie;
813 #ifndef DACCESS_COMPILE
814 // const is so that it gets placed in the .text section (which is read-only)
815 // volatile is so that accesses to it do not get optimized away because of the const
818 extern "C" RAW_KEYWORD(volatile) const GSCookie s_gsCookie;
821 GSCookie * GetProcessGSCookiePtr() { return const_cast<GSCookie *>(&s_gsCookie); }
825 extern __GlobalVal< GSCookie > s_gsCookie;
828 PTR_GSCookie GetProcessGSCookiePtr() { return PTR_GSCookie(&s_gsCookie); }
830 #endif //!DACCESS_COMPILE
833 GSCookie GetProcessGSCookie() { return *(RAW_KEYWORD(volatile) GSCookie *)(&s_gsCookie); }
835 class CEECompileInfo;
836 extern CEECompileInfo *g_pCEECompileInfo;
838 #ifdef FEATURE_READYTORUN_COMPILER
839 extern bool g_fReadyToRunCompilation;
842 // Returns true if this is NGen compilation process.
843 // This is a superset of CompilationDomain::IsCompilationDomain() as there is more
844 // than one AppDomain in ngen (the DefaultDomain)
845 inline BOOL IsCompilationProcess()
847 #ifdef CROSSGEN_COMPILE
854 // Flag for cross-platform ngen: Removes all execution of managed or third-party code in the ngen compilation process.
855 inline BOOL NingenEnabled()
857 #ifdef CROSSGEN_COMPILE
864 // Passed to JitManager APIs to determine whether to avoid calling into the host.
865 // The profiling API stackwalking uses this to ensure to avoid re-entering the host
866 // (particularly SQL) from a hijacked thread.
867 enum HostCallPreference
873 #endif /* _VARS_HPP */