Add GetLoaderAllocatorObjectForGC to IGCToCLR (#17443)
[platform/upstream/coreclr.git] / src / gc / env / gcenv.ee.h
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 // Interface between the GC and EE
5 //
6
7 #ifndef __GCENV_EE_H__
8 #define __GCENV_EE_H__
9
10 #include "gcinterface.h"
11
12 class GCToEEInterface
13 {
14 public:
15     static void SuspendEE(SUSPEND_REASON reason);
16     static void RestartEE(bool bFinishedGC); //resume threads.
17
18     // 
19     // The GC roots enumeration callback
20     //
21     static void GcScanRoots(promote_func* fn, int condemned, int max_gen, ScanContext* sc);
22
23     // 
24     // Callbacks issues during GC that the execution engine can do its own bookeeping
25     //
26
27     // start of GC call back - single threaded
28     static void GcStartWork(int condemned, int max_gen); 
29
30     //EE can perform post stack scanning action, while the 
31     // user threads are still suspended 
32     static void AfterGcScanRoots(int condemned, int max_gen, ScanContext* sc);
33
34     // Called before BGC starts sweeping, the heap is walkable
35     static void GcBeforeBGCSweepWork();
36
37     // post-gc callback.
38     static void GcDone(int condemned);
39
40     // Promote refcounted handle callback
41     static bool RefCountedHandleCallbacks(Object * pObject);
42
43     // Sync block cache management
44     static void SyncBlockCacheWeakPtrScan(HANDLESCANPROC scanProc, uintptr_t lp1, uintptr_t lp2);
45     static void SyncBlockCacheDemote(int max_gen);
46     static void SyncBlockCachePromotionsGranted(int max_gen);
47     static uint32_t GetActiveSyncBlockCount();
48
49     // Thread functions
50     static bool IsPreemptiveGCDisabled();
51     static bool EnablePreemptiveGC();
52     static void DisablePreemptiveGC();
53     static Thread* GetThread();
54
55     static gc_alloc_context * GetAllocContext();
56
57     static void GcEnumAllocContexts(enum_alloc_context_func* fn, void* param);
58
59     static uint8_t* GetLoaderAllocatorObjectForGC(Object* pObject);
60
61     // Diagnostics methods.
62     static void DiagGCStart(int gen, bool isInduced);
63     static void DiagUpdateGenerationBounds();
64     static void DiagGCEnd(size_t index, int gen, int reason, bool fConcurrent);
65     static void DiagWalkFReachableObjects(void* gcContext);
66     static void DiagWalkSurvivors(void* gcContext);
67     static void DiagWalkLOHSurvivors(void* gcContext);
68     static void DiagWalkBGCSurvivors(void* gcContext);
69     static void StompWriteBarrier(WriteBarrierParameters* args);
70
71     static void EnableFinalization(bool foundFinalizers);
72
73     static void HandleFatalError(unsigned int exitCode);
74     static bool ShouldFinalizeObjectForUnload(AppDomain* pDomain, Object* obj);
75     static bool ForceFullGCToBeBlocking();
76     static bool EagerFinalized(Object* obj);
77     static MethodTable* GetFreeObjectMethodTable();
78     static bool GetBooleanConfigValue(const char* key, bool* value);
79     static bool GetIntConfigValue(const char* key, int64_t* value);
80     static bool GetStringConfigValue(const char* key, const char** value);
81     static void FreeStringConfigValue(const char* key);
82     static bool IsGCThread();
83     static bool WasCurrentThreadCreatedByGC();
84     static bool CreateThread(void (*threadStart)(void*), void* arg, bool is_suspendable, const char* name);
85     static void WalkAsyncPinnedForPromotion(Object* object, ScanContext* sc, promote_func* callback);
86     static void WalkAsyncPinned(Object* object, void* context, void(*callback)(Object*, Object*, void*));
87     static IGCToCLREventSink* EventSink();
88 };
89
90 #endif // __GCENV_EE_H__