LLVM 22.0.0git
|
This class is a simple list of T structures. More...
#include "DWARFLinker/Parallel/ArrayList.h"
Classes | |
struct | ItemsGroup |
Public Types | |
using | ItemHandlerTy = function_ref<void(T &)> |
Public Member Functions | |
ArrayList (llvm::parallel::PerThreadBumpPtrAllocator *Allocator) | |
T & | add (const T &Item) |
Add specified Item to the list. | |
void | forEach (ItemHandlerTy Handler) |
Enumerate all items and apply specified Handler to each. | |
bool | empty () |
Check whether list is empty. | |
void | erase () |
Erase list. | |
void | sort (function_ref< bool(const T &LHS, const T &RHS)> Comparator) |
size_t | size () |
Protected Member Functions | |
bool | allocateNewGroup (std::atomic< ItemsGroup * > &AtomicGroup) |
Protected Attributes | |
std::atomic< ItemsGroup * > | GroupsHead = nullptr |
std::atomic< ItemsGroup * > | LastGroup = nullptr |
llvm::parallel::PerThreadBumpPtrAllocator * | Allocator = nullptr |
This class is a simple list of T structures.
It keeps elements as pre-allocated groups to save memory for each element's next pointer. It allocates internal data using specified per-thread BumpPtrAllocator. Method add() can be called asynchronously.
Definition at line 23 of file ArrayList.h.
using llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::ItemHandlerTy = function_ref<void(T &)> |
Definition at line 60 of file ArrayList.h.
|
inline |
Definition at line 25 of file ArrayList.h.
References Allocator.
|
inline |
Add specified Item
to the list.
Definition at line 29 of file ArrayList.h.
References allocateNewGroup(), Allocator, assert(), GroupsHead, llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::ItemsGroup::Items, llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::ItemsGroup::ItemsCount, LastGroup, llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::ItemsGroup::Next, and T.
|
inlineprotected |
Definition at line 131 of file ArrayList.h.
References Allocator, llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::ItemsGroup::ItemsCount, and llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::ItemsGroup::Next.
Referenced by add().
|
inline |
|
inline |
|
inline |
Enumerate all items and apply specified Handler
to each.
Definition at line 63 of file ArrayList.h.
References GroupsHead, and T.
Referenced by sort().
|
inline |
Definition at line 93 of file ArrayList.h.
References GroupsHead.
|
inline |
Definition at line 80 of file ArrayList.h.
References assert(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), forEach(), LHS, llvm::SmallVectorTemplateBase< T, bool >::push_back(), RHS, llvm::SmallVectorTemplateCommon< T, typename >::size(), and T.
|
protected |
Definition at line 160 of file ArrayList.h.
Referenced by add(), allocateNewGroup(), and ArrayList().
|
protected |
|
protected |
Definition at line 159 of file ArrayList.h.