From 9e4dccced24917bb8d155331095404d1a28c7887 Mon Sep 17 00:00:00 2001 From: Pat Gavlin Date: Fri, 15 Apr 2016 15:35:33 -0700 Subject: [PATCH] Stop including utilcode.h in the GC info encoder. This required two other minor changes: - A prototype for `ThrowOutOfMemory` is now defined in gcinfoencoder.h - `BitArray` now defines an overload of `operator new` that accepts an `IAllocator`. --- src/gcinfo/gcinfoencoder.cpp | 9 +++++++-- src/inc/dbggcinfoencoder.h | 1 - src/inc/gcinfoencoder.h | 5 +++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/gcinfo/gcinfoencoder.cpp b/src/gcinfo/gcinfoencoder.cpp index b76290b..0f34a3b 100644 --- a/src/gcinfo/gcinfoencoder.cpp +++ b/src/gcinfo/gcinfoencoder.cpp @@ -220,6 +220,11 @@ public: } #endif + static void* operator new(size_t size, IAllocator* allocator) + { + return allocator->Alloc(size); + } + private: size_t * m_pData; size_t * m_pEndData; @@ -1836,7 +1841,7 @@ void GcInfoEncoder::Build() UINT32 liveStateOffset = 0; if (!hashMap.Lookup(&liveState, &liveStateOffset)) { - BitArray * newLiveState = new (m_pAllocator->Alloc(sizeof(BitArray))) BitArray(m_pAllocator, size_tCount); + BitArray * newLiveState = new (m_pAllocator) BitArray(m_pAllocator, size_tCount); *newLiveState = liveState; hashMap.Set(newLiveState, (UINT32)(-1)); } @@ -1864,7 +1869,7 @@ void GcInfoEncoder::Build() UINT32 liveStateOffset = 0; if (!hashMap.Lookup(&liveState, &liveStateOffset)) { - BitArray * newLiveState = new (m_pAllocator->Alloc(sizeof(BitArray))) BitArray(m_pAllocator, size_tCount); + BitArray * newLiveState = new (m_pAllocator) BitArray(m_pAllocator, size_tCount); *newLiveState = liveState; hashMap.Set(newLiveState, (UINT32)(-1)); } diff --git a/src/inc/dbggcinfoencoder.h b/src/inc/dbggcinfoencoder.h index 573985b..85b56ad 100644 --- a/src/inc/dbggcinfoencoder.h +++ b/src/inc/dbggcinfoencoder.h @@ -21,7 +21,6 @@ #include #include -#include "utilcode.h" #include "corjit.h" #include "iallocator.h" #include "gcinfoarraylist.h" diff --git a/src/inc/gcinfoencoder.h b/src/inc/gcinfoencoder.h index 2740acb..ff03138 100644 --- a/src/inc/gcinfoencoder.h +++ b/src/inc/gcinfoencoder.h @@ -78,7 +78,6 @@ #include #include #include -#include "utilcode.h" #include "corjit.h" #include "iallocator.h" #include "gcinfoarraylist.h" @@ -318,6 +317,8 @@ enum GENERIC_CONTEXTPARAM_TYPE GENERIC_CONTEXTPARAM_THIS = 3, }; +extern void DECLSPEC_NORETURN ThrowOutOfMemory(); + class GcInfoEncoder { public: @@ -327,7 +328,7 @@ public: ICorJitInfo* pCorJitInfo, CORINFO_METHOD_INFO* pMethodInfo, IAllocator* pJitAllocator, - NoMemoryFunction pNoMem = ThrowOutOfMemory + NoMemoryFunction pNoMem = ::ThrowOutOfMemory ); struct LifetimeTransition -- 2.7.4