| 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. |
| 4 | |
| 5 | #ifndef _GCENV_EE_H_ |
| 6 | #define _GCENV_EE_H_ |
| 7 | |
| 8 | #include "gcinterface.h" |
| 9 | |
| 10 | #ifdef FEATURE_STANDALONE_GC |
| 11 | |
| 12 | namespace standalone |
| 13 | { |
| 14 | |
| 15 | class GCToEEInterface : public IGCToCLR { |
| 16 | public: |
| 17 | GCToEEInterface() = default; |
| 18 | ~GCToEEInterface() = default; |
| 19 | |
| 20 | void SuspendEE(SUSPEND_REASON reason); |
| 21 | void RestartEE(bool bFinishedGC); |
| 22 | void GcScanRoots(promote_func* fn, int condemned, int max_gen, ScanContext* sc); |
| 23 | void GcStartWork(int condemned, int max_gen); |
| 24 | void AfterGcScanRoots(int condemned, int max_gen, ScanContext* sc); |
| 25 | void GcBeforeBGCSweepWork(); |
| 26 | void GcDone(int condemned); |
| 27 | bool RefCountedHandleCallbacks(Object * pObject); |
| 28 | void SyncBlockCacheWeakPtrScan(HANDLESCANPROC scanProc, uintptr_t lp1, uintptr_t lp2); |
| 29 | void SyncBlockCacheDemote(int max_gen); |
| 30 | void SyncBlockCachePromotionsGranted(int max_gen); |
| 31 | uint32_t GetActiveSyncBlockCount(); |
| 32 | bool IsPreemptiveGCDisabled(); |
| 33 | bool EnablePreemptiveGC(); |
| 34 | void DisablePreemptiveGC(); |
| 35 | Thread* GetThread(); |
| 36 | gc_alloc_context * GetAllocContext(); |
| 37 | void GcEnumAllocContexts(enum_alloc_context_func* fn, void* param); |
| 38 | uint8_t* GetLoaderAllocatorObjectForGC(Object* pObject); |
| 39 | |
| 40 | // Diagnostics methods. |
| 41 | void DiagGCStart(int gen, bool isInduced); |
| 42 | void DiagUpdateGenerationBounds(); |
| 43 | void DiagGCEnd(size_t index, int gen, int reason, bool fConcurrent); |
| 44 | void DiagWalkFReachableObjects(void* gcContext); |
| 45 | void DiagWalkSurvivors(void* gcContext); |
| 46 | void DiagWalkLOHSurvivors(void* gcContext); |
| 47 | void DiagWalkBGCSurvivors(void* gcContext); |
| 48 | void StompWriteBarrier(WriteBarrierParameters* args); |
| 49 | |
| 50 | void EnableFinalization(bool foundFinalizers); |
| 51 | void HandleFatalError(unsigned int exitCode); |
| 52 | bool ShouldFinalizeObjectForUnload(void* pDomain, Object* obj); |
| 53 | bool EagerFinalized(Object* obj); |
| 54 | MethodTable* GetFreeObjectMethodTable(); |
| 55 | bool GetBooleanConfigValue(const char* key, bool* value); |
| 56 | bool GetIntConfigValue(const char* key, int64_t* value); |
| 57 | bool GetStringConfigValue(const char* key, const char** value); |
| 58 | void FreeStringConfigValue(const char* value); |
| 59 | bool IsGCThread(); |
| 60 | bool WasCurrentThreadCreatedByGC(); |
| 61 | bool CreateThread(void (*threadStart)(void*), void* arg, bool is_suspendable, const char* name); |
| 62 | void WalkAsyncPinnedForPromotion(Object* object, ScanContext* sc, promote_func* callback); |
| 63 | void WalkAsyncPinned(Object* object, void* context, void(*callback)(Object*, Object*, void*)); |
| 64 | IGCToCLREventSink* EventSink(); |
| 65 | |
| 66 | uint32_t GetDefaultDomainIndex(); |
| 67 | void *GetAppDomainAtIndex(uint32_t appDomainIndex); |
| 68 | bool AppDomainCanAccessHandleTable(uint32_t appDomainID); |
| 69 | uint32_t GetIndexOfAppDomainBeingUnloaded(); |
| 70 | uint32_t GetTotalNumSizedRefHandles(); |
| 71 | bool AppDomainIsRudeUnload(void *appDomain); |
| 72 | |
| 73 | bool AnalyzeSurvivorsRequested(int condemnedGeneration); |
| 74 | void AnalyzeSurvivorsFinished(int condemnedGeneration); |
| 75 | |
| 76 | void VerifySyncTableEntry(); |
| 77 | }; |
| 78 | |
| 79 | } // namespace standalone |
| 80 | |
| 81 | #endif // FEATURE_STANDALONE_GC |
| 82 | |
| 83 | #endif // _GCENV_EE_H_ |
| 84 | |