Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Add GetLoaderAllocatorObjectForGC to IGCToCLR (#17443)
Browse files Browse the repository at this point in the history
  • Loading branch information
davmason committed Apr 6, 2018
1 parent e7c7551 commit db55a1d
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/gc/env/gcenv.ee.h
Expand Up @@ -55,6 +55,9 @@ class GCToEEInterface
static gc_alloc_context * GetAllocContext();

static void GcEnumAllocContexts(enum_alloc_context_func* fn, void* param);

static uint8_t* GetLoaderAllocatorObjectForGC(Object* pObject);

// Diagnostics methods.
static void DiagGCStart(int gen, bool isInduced);
static void DiagUpdateGenerationBounds();
Expand Down
6 changes: 0 additions & 6 deletions src/gc/env/gcenv.object.h
Expand Up @@ -122,12 +122,6 @@ class MethodTable
{
return true;
}

uint8_t* GetLoaderAllocatorObjectForGC()
{
// [LOCALGC TODO] this is not correct
return nullptr;
}
};

class Object
Expand Down
6 changes: 6 additions & 0 deletions src/gc/gcenv.ee.standalone.inl
Expand Up @@ -125,6 +125,12 @@ inline void GCToEEInterface::GcEnumAllocContexts(enum_alloc_context_func* fn, vo
g_theGCToCLR->GcEnumAllocContexts(fn, param);
}

inline uint8_t *GCToEEInterface::GetLoaderAllocatorObjectForGC(Object* pObject)
{
assert(g_theGCToCLR != nullptr);
return g_theGCToCLR->GetLoaderAllocatorObjectForGC(pObject);
}

inline void GCToEEInterface::DiagGCStart(int gen, bool isInduced)
{
assert(g_theGCToCLR != nullptr);
Expand Down
4 changes: 4 additions & 0 deletions src/gc/gcinterface.ee.h
Expand Up @@ -251,6 +251,10 @@ class IGCToCLR {
virtual
void GcEnumAllocContexts(enum_alloc_context_func* fn, void* param) = 0;

// Get the Allocator for objects from collectible assemblies
virtual
uint8_t* GetLoaderAllocatorObjectForGC(Object* pObject) = 0;

// Creates and returns a new thread.
// Parameters:
// threadStart - The function that will serve as the thread stub for the
Expand Down
5 changes: 5 additions & 0 deletions src/gc/sample/gcenv.ee.cpp
Expand Up @@ -218,6 +218,11 @@ void GCToEEInterface::GcEnumAllocContexts (enum_alloc_context_func* fn, void* pa
}
}

uint8_t* GCToEEInterface::GetLoaderAllocatorObjectForGC(Object* pObject)
{
return NULL;
}

void GCToEEInterface::SyncBlockCacheWeakPtrScan(HANDLESCANPROC /*scanProc*/, uintptr_t /*lp1*/, uintptr_t /*lp2*/)
{
}
Expand Down
13 changes: 13 additions & 0 deletions src/vm/gcenv.ee.cpp
Expand Up @@ -347,6 +347,19 @@ void GCToEEInterface::GcEnumAllocContexts(enum_alloc_context_func* fn, void* par
}
}


uint8_t* GCToEEInterface::GetLoaderAllocatorObjectForGC(Object* pObject)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;

return pObject->GetMethodTable()->GetLoaderAllocatorObjectForGC();
}

bool GCToEEInterface::IsPreemptiveGCDisabled()
{
WRAPPER_NO_CONTRACT;
Expand Down
1 change: 1 addition & 0 deletions src/vm/gcenv.ee.h
Expand Up @@ -35,6 +35,7 @@ class GCToEEInterface : public IGCToCLR {
Thread* GetThread();
gc_alloc_context * GetAllocContext();
void GcEnumAllocContexts(enum_alloc_context_func* fn, void* param);
uint8_t* GetLoaderAllocatorObjectForGC(Object* pObject);

// Diagnostics methods.
void DiagGCStart(int gen, bool isInduced);
Expand Down

0 comments on commit db55a1d

Please sign in to comment.