LLVM 22.0.0git
llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize > Class Template Reference

This class is a simple list of T structures. More...

#include "DWARFLinker/Parallel/ArrayList.h"

Inheritance diagram for llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >:
[legend]

Classes

struct  ItemsGroup

Public Types

using ItemHandlerTy = function_ref<void(T &)>

Public Member Functions

 ArrayList (llvm::parallel::PerThreadBumpPtrAllocator *Allocator)
Tadd (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::PerThreadBumpPtrAllocatorAllocator = nullptr

Detailed Description

template<typename T, size_t ItemsGroupSize = 512>
class llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >

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.

Member Typedef Documentation

◆ ItemHandlerTy

template<typename T, size_t ItemsGroupSize = 512>
using llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::ItemHandlerTy = function_ref<void(T &)>

Definition at line 60 of file ArrayList.h.

Constructor & Destructor Documentation

◆ ArrayList()

template<typename T, size_t ItemsGroupSize = 512>
llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::ArrayList ( llvm::parallel::PerThreadBumpPtrAllocator * Allocator)
inline

Definition at line 25 of file ArrayList.h.

References Allocator.

Member Function Documentation

◆ add()

◆ allocateNewGroup()

template<typename T, size_t ItemsGroupSize = 512>
bool llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::allocateNewGroup ( std::atomic< ItemsGroup * > & AtomicGroup)
inlineprotected

◆ empty()

template<typename T, size_t ItemsGroupSize = 512>
bool llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::empty ( )
inline

Check whether list is empty.

Definition at line 72 of file ArrayList.h.

References GroupsHead.

◆ erase()

template<typename T, size_t ItemsGroupSize = 512>
void llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::erase ( )
inline

Erase list.

Definition at line 75 of file ArrayList.h.

References GroupsHead, and LastGroup.

◆ forEach()

template<typename T, size_t ItemsGroupSize = 512>
void llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::forEach ( ItemHandlerTy Handler)
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().

◆ size()

template<typename T, size_t ItemsGroupSize = 512>
size_t llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::size ( )
inline

Definition at line 93 of file ArrayList.h.

References GroupsHead.

◆ sort()

Member Data Documentation

◆ Allocator

template<typename T, size_t ItemsGroupSize = 512>
llvm::parallel::PerThreadBumpPtrAllocator* llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::Allocator = nullptr
protected

Definition at line 160 of file ArrayList.h.

Referenced by add(), allocateNewGroup(), and ArrayList().

◆ GroupsHead

template<typename T, size_t ItemsGroupSize = 512>
std::atomic<ItemsGroup *> llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::GroupsHead = nullptr
protected

Definition at line 158 of file ArrayList.h.

Referenced by add(), empty(), erase(), forEach(), and size().

◆ LastGroup

template<typename T, size_t ItemsGroupSize = 512>
std::atomic<ItemsGroup *> llvm::dwarf_linker::parallel::ArrayList< T, ItemsGroupSize >::LastGroup = nullptr
protected

Definition at line 159 of file ArrayList.h.

Referenced by add(), and erase().


The documentation for this class was generated from the following file: