diff options
author | Tomáš Rylek <trylek@microsoft.com> | 2020-12-08 05:19:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-08 05:19:44 +0300 |
commit | 69e114c1abf91241a0eeecf1ecceab4711b8aa62 (patch) | |
tree | b81a0b35748f5e598412bcc504335cdbd322cd43 /src/coreclr/vm/objectlist.h | |
parent | 0ec07945a9759a72a689edbb01e69b232e26e05a (diff) |
December infra rollout - remove duplicated 'src' from coreclr subrepo (src/coreclr/src becomes src/coreclr) (#44973)
* Move src/coreclr/src/Directory.Build.targets to src/coreclr
Merge src/coreclr/src/CMakeLists.txt into src/coreclr/CMakeLists.txt
* Mechanical move of src/coreclr/src to src/coreclr
* Scripts adjustments to reflect the changed paths
Diffstat (limited to 'src/coreclr/vm/objectlist.h')
-rw-r--r-- | src/coreclr/vm/objectlist.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/src/coreclr/vm/objectlist.h b/src/coreclr/vm/objectlist.h new file mode 100644 index 00000000000..4542c890f80 --- /dev/null +++ b/src/coreclr/vm/objectlist.h @@ -0,0 +1,99 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + + + +#ifndef __objectlist_h__ +#define __objectlist_h__ + + +#include "arraylist.h" +#include "holder.h" + +#define INVALID_COMPRESSEDSTACK_INDEX ((DWORD)-1) +#ifdef _DEBUG +#define FREE_LIST_SIZE 128 +#else +#define FREE_LIST_SIZE 1024 +#endif + + + +class ObjectList +{ +public: + class Iterator + { + friend class ObjectList; + + protected: + ArrayList::Iterator _iter; + + public: + + PTR_VOID GetElement() + { + LIMITED_METHOD_CONTRACT; + PTR_VOID ptr = _iter.GetElement(); + if (((DWORD)(size_t)(dac_cast<TADDR>(ptr)) & 0x1) == 0) + { + return ptr; + } + else + { + return NULL; + } + } + + DWORD GetIndex() + { + LIMITED_METHOD_CONTRACT; + return _iter.GetIndex(); + } + + BOOL Next() + { + LIMITED_METHOD_CONTRACT; + return _iter.Next(); + } + }; + + ObjectList() DAC_EMPTY(); + + DWORD AddToList( PVOID ptr ); + void RemoveFromList( PVOID ptr ); + void RemoveFromList( DWORD index, PVOID ptr ); + PVOID Get( DWORD index ); + + ObjectList::Iterator Iterate() + { + LIMITED_METHOD_CONTRACT; + ObjectList::Iterator i; + i._iter = this->allEntries_.Iterate(); + return i; + } + +private: + ArrayList allEntries_; + DWORD freeIndexHead_; + Crst listLock_; +}; + +class UnsynchronizedBlockAllocator +{ +public: + UnsynchronizedBlockAllocator( size_t blockSize ); + ~UnsynchronizedBlockAllocator( void ); + + PVOID Allocate( size_t size ); + +private: + ArrayList blockList_; + + size_t blockSize_; + size_t offset_; + DWORD index_; + +}; + +#endif // __objectlist_h__ |