diff options
author | Pat Gavlin <pagavlin@microsoft.com> | 2016-04-08 15:39:55 -0700 |
---|---|---|
committer | Pat Gavlin <pagavlin@microsoft.com> | 2016-04-12 12:44:05 -0700 |
commit | d241f9d5bcdaf9e99e4c4e54508d2cec2ed35d04 (patch) | |
tree | 0801f191c89d839afdbaabba485df2d87fe9d2b6 /src/utilcode/arraylist.cpp | |
parent | 32b2d2c0a5900ff85b941b29a08b05ff08d7f44b (diff) | |
download | coreclr-d241f9d5bcdaf9e99e4c4e54508d2cec2ed35d04.tar.gz coreclr-d241f9d5bcdaf9e99e4c4e54508d2cec2ed35d04.tar.bz2 coreclr-d241f9d5bcdaf9e99e4c4e54508d2cec2ed35d04.zip |
Clean up StructArrayList for GC info.
- Move the code into the GC info encoder, as that is its
only consumer.
- Remove contracts
- Delete dead code
- Reformat and refactor to current coding standards
Diffstat (limited to 'src/utilcode/arraylist.cpp')
-rw-r--r-- | src/utilcode/arraylist.cpp | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/src/utilcode/arraylist.cpp b/src/utilcode/arraylist.cpp index 1b962c06ae..30793c4559 100644 --- a/src/utilcode/arraylist.cpp +++ b/src/utilcode/arraylist.cpp @@ -224,87 +224,3 @@ ArrayListBase::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) } #endif // #ifdef DACCESS_COMPILE - - -void StructArrayListBase::Destruct (FreeProc *pfnFree) -{ - WRAPPER_NO_CONTRACT; - - StructArrayListEntryBase *pList = m_pChunkListHead; - while (pList) - { - StructArrayListEntryBase *pTrash = pList; - pList = pList->pNext; - pfnFree(this, pTrash); - } -} - -// Copied from jit.h -inline -size_t roundUp(size_t size, size_t mult = sizeof(size_t)) -{ - assert(mult && ((mult & (mult-1)) == 0)); // power of two test - - return (size + (mult - 1)) & ~(mult - 1); -} - -void StructArrayListBase::CreateNewChunk (SIZE_T InitialChunkLength, SIZE_T ChunkLengthGrowthFactor, SIZE_T cbElement, AllocProc *pfnAlloc, SIZE_T alignment) -{ - CONTRACTL { - THROWS; - PRECONDITION(!m_pChunkListHead || m_nItemsInLastChunk == m_nLastChunkCapacity); - } CONTRACTL_END; - - SIZE_T nChunkCapacity; - if (!m_pChunkListHead) - nChunkCapacity = InitialChunkLength; - else - nChunkCapacity = m_nLastChunkCapacity * ChunkLengthGrowthFactor; - - S_SIZE_T cbBaseSize = S_SIZE_T(roundUp(sizeof(StructArrayListEntryBase), alignment)); - S_SIZE_T cbChunk = cbBaseSize + - S_SIZE_T(cbElement) * S_SIZE_T(nChunkCapacity); - _ASSERTE(!cbChunk.IsOverflow()); - if(cbChunk.IsOverflow()) - { - ThrowWin32(ERROR_ARITHMETIC_OVERFLOW); - } - - StructArrayListEntryBase *pNewChunk = (StructArrayListEntryBase*)pfnAlloc(this, cbChunk.Value()); - - if (m_pChunkListTail) - { - _ASSERTE(m_pChunkListHead); - m_pChunkListTail->pNext = pNewChunk; - } - else - { - _ASSERTE(!m_pChunkListHead); - m_pChunkListHead = pNewChunk; - } - - pNewChunk->pNext = NULL; - m_pChunkListTail = pNewChunk; - - m_nItemsInLastChunk = 0; - m_nLastChunkCapacity = nChunkCapacity; -} - - -void StructArrayListBase::ArrayIteratorBase::SetCurrentChunk (StructArrayListEntryBase *pChunk, SIZE_T nChunkCapacity) -{ - LIMITED_METHOD_CONTRACT; - - m_pCurrentChunk = pChunk; - - if (pChunk) - { - if (pChunk == m_pArrayList->m_pChunkListTail) - m_nItemsInCurrentChunk = m_pArrayList->m_nItemsInLastChunk; - else - m_nItemsInCurrentChunk = nChunkCapacity; - - m_nCurrentChunkCapacity = nChunkCapacity; - } -} - |