未验证 提交 596ee7cc 编写于 作者: A Andrew Au 提交者: GitHub

Move statics to POH (#47651)

上级 b23ccde6
......@@ -124,7 +124,7 @@ inline void FATAL_GC_ERROR()
#define CARD_BUNDLE //enable card bundle feature.(requires WRITE_WATCH)
// #define ALLOW_REFERENCES_IN_POH //Allow POH objects to contain references.
#define ALLOW_REFERENCES_IN_POH //Allow POH objects to contain references.
#ifdef BACKGROUND_GC
#define BGC_SERVO_TUNING
......
......@@ -143,14 +143,14 @@ LargeHeapHandleBucket::LargeHeapHandleBucket(LargeHeapHandleBucket *pNext, DWORD
// Allocate the array in the large object heap.
OVERRIDE_TYPE_LOAD_LEVEL_LIMIT(CLASS_LOADED);
HandleArrayObj = (PTRARRAYREF)AllocateObjectArray(Size, g_pObjectClass, TRUE);
HandleArrayObj = (PTRARRAYREF)AllocateObjectArray(Size, g_pObjectClass, /* bAllocateInPinnedHeap = */TRUE);
// Retrieve the pointer to the data inside the array. This is legal since the array
// is located in the large object heap and is guaranteed not to move.
m_pArrayDataPtr = (OBJECTREF *)HandleArrayObj->GetDataPtr();
// Store the array in a strong handle to keep it alive.
m_hndHandleArray = pDomain->CreatePinningHandle((OBJECTREF)HandleArrayObj);
m_hndHandleArray = pDomain->CreateStrongHandle((OBJECTREF)HandleArrayObj);
}
......@@ -166,7 +166,7 @@ LargeHeapHandleBucket::~LargeHeapHandleBucket()
if (m_hndHandleArray)
{
DestroyPinningHandle(m_hndHandleArray);
DestroyStrongHandle(m_hndHandleArray);
m_hndHandleArray = NULL;
}
}
......@@ -517,7 +517,7 @@ ThreadStaticHandleBucket::ThreadStaticHandleBucket(ThreadStaticHandleBucket *pNe
// Allocate the array on the GC heap.
OVERRIDE_TYPE_LOAD_LEVEL_LIMIT(CLASS_LOADED);
HandleArrayObj = (PTRARRAYREF)AllocateObjectArray(Size, g_pObjectClass, FALSE);
HandleArrayObj = (PTRARRAYREF)AllocateObjectArray(Size, g_pObjectClass);
// Store the array in a strong handle to keep it alive.
m_hndHandleArray = pDomain->CreateStrongHandle((OBJECTREF)HandleArrayObj);
......
......@@ -803,7 +803,7 @@ OBJECTREF DupArrayForCloning(BASEARRAYREF pRef)
//
// Helper for parts of the EE which are allocating arrays
//
OBJECTREF AllocateObjectArray(DWORD cElements, TypeHandle elementType, BOOL bAllocateInLargeHeap)
OBJECTREF AllocateObjectArray(DWORD cElements, TypeHandle elementType, BOOL bAllocateInPinnedHeap)
{
CONTRACTL {
THROWS;
......@@ -823,7 +823,7 @@ OBJECTREF AllocateObjectArray(DWORD cElements, TypeHandle elementType, BOOL bAll
_ASSERTE(arrayType.GetInternalCorElementType() == ELEMENT_TYPE_SZARRAY);
#endif //_DEBUG
GC_ALLOC_FLAGS flags = bAllocateInLargeHeap ? GC_ALLOC_LARGE_OBJECT_HEAP : GC_ALLOC_NO_FLAGS;
GC_ALLOC_FLAGS flags = bAllocateInPinnedHeap ? GC_ALLOC_PINNED_OBJECT_HEAP : GC_ALLOC_NO_FLAGS;
return AllocateSzArray(arrayType, (INT32) cElements, flags);
}
......
......@@ -31,7 +31,7 @@ OBJECTREF AllocateArrayEx(TypeHandle arrayType, INT32 *pArgs, DWORD dwNumArgs,
OBJECTREF AllocatePrimitiveArray(CorElementType type, DWORD cElements);
// Allocate SD array of object types given an element type
OBJECTREF AllocateObjectArray(DWORD cElements, TypeHandle ElementType, BOOL bAllocateInLargeHeap = FALSE);
OBJECTREF AllocateObjectArray(DWORD cElements, TypeHandle ElementType, BOOL bAllocateInPinnedHeap = FALSE);
// Allocate a string
STRINGREF AllocateString( DWORD cchStringLength );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册