Pigweed
 
Loading...
Searching...
No Matches
pw::allocator::DetailedBlockImpl< Parameters > Class Template Reference

#include <detailed_block.h>

Inheritance diagram for pw::allocator::DetailedBlockImpl< Parameters >:
pw::allocator::BasicBlock< DetailedBlockImpl< Parameters > > pw::allocator::IterableBlock< DetailedBlockImpl< Parameters > > pw::allocator::ContiguousBlock< DetailedBlockImpl< Parameters > > pw::allocator::AllocatableBlock< DetailedBlockImpl< Parameters > > pw::allocator::AlignableBlock< DetailedBlockImpl< Parameters > > pw::allocator::BlockWithLayout< DetailedBlockImpl< Parameters > > pw::allocator::PoisonableBlock< DetailedBlockImpl< Parameters > > pw::allocator::internal::BasicBase pw::allocator::internal::IterableBase pw::allocator::internal::ContiguousBase pw::allocator::internal::AllocatableBase pw::allocator::internal::AlignableBase pw::allocator::internal::BaseWithLayout pw::allocator::internal::PoisonableBase

Public Types

using OffsetType = typename Parameters::OffsetType
 
using Range = typename IterableBlock< BlockType >::Range
 
using Iterator = typename IterableBlock< BlockType >::Iterator
 

Additional Inherited Members

- Public Member Functions inherited from pw::allocator::BasicBlock< DetailedBlockImpl< Parameters > >
 BasicBlock (const BasicBlock &other)=delete
 
BasicBlockoperator= (const BasicBlock &other)=delete
 
constexpr std::byte * UsableSpace ()
 
constexpr const std::byte * UsableSpace () const
 
constexpr std::byte * UsableSpaceUnchecked ()
 
constexpr const std::byte * UsableSpaceUnchecked () const
 
constexpr size_t OuterSize () const
 
constexpr size_t InnerSize () const
 
constexpr size_t InnerSizeUnchecked () const
 
constexpr bool IsValid () const
 
constexpr bool CheckInvariants () const
 Like IsValid, but crashes if invalid.
 
- Public Member Functions inherited from pw::allocator::ContiguousBlock< DetailedBlockImpl< Parameters > >
constexpr DetailedBlockImpl< Parameters > * Prev () const
 
constexpr DetailedBlockImpl< Parameters > * Next () const
 
- Public Member Functions inherited from pw::allocator::AllocatableBlock< DetailedBlockImpl< Parameters > >
constexpr bool IsFree () const
 
constexpr bool Used () const
 
constexpr StatusWithSize CanAlloc (Layout layout) const
 
constexpr BlockResult< DetailedBlockImpl< Parameters > > Resize (size_t new_inner_size)
 
- Public Member Functions inherited from pw::allocator::BlockWithLayout< DetailedBlockImpl< Parameters > >
constexpr Layout RequestedLayout () const
 
- Public Member Functions inherited from pw::allocator::PoisonableBlock< DetailedBlockImpl< Parameters > >
constexpr uintptr_t GetPoisonWord () const
 Returns the value written to a block's usable space when poisoning.
 
constexpr bool IsPoisoned () const
 Returns whether this block has been poisoned.
 
constexpr void Poison ()
 
- Static Public Member Functions inherited from pw::allocator::BasicBlock< DetailedBlockImpl< Parameters > >
static constexpr Result< DetailedBlockImpl< Parameters > * > Init (ByteSpan region)
 Creates the first block for a given memory region.
 
static constexpr internal::copy_const_ptr_t< Ptr, DetailedBlockImpl< Parameters > * > FromUsableSpace (Ptr usable_space)
 
static constexpr size_t OuterSizeFromInnerSize (size_t inner_size)
 
static constexpr size_t InnerSizeFromOuterSize (size_t outer_size)
 
- Static Public Member Functions inherited from pw::allocator::AllocatableBlock< DetailedBlockImpl< Parameters > >
static constexpr BlockResult< DetailedBlockImpl< Parameters > > AllocFirst (DetailedBlockImpl< Parameters > *&&block, Layout layout)
 
static constexpr BlockResult< DetailedBlockImpl< Parameters > > AllocLast (DetailedBlockImpl< Parameters > *&&block, Layout layout)
 
static constexpr BlockResult< DetailedBlockImpl< Parameters > > Free (DetailedBlockImpl< Parameters > *&&block)
 
- Static Public Attributes inherited from pw::allocator::BasicBlock< DetailedBlockImpl< Parameters > >
static constexpr size_t kAlignment
 
static constexpr size_t kBlockOverhead
 
static constexpr size_t kMinOuterSize
 
- Static Public Attributes inherited from pw::allocator::PoisonableBlock< DetailedBlockImpl< Parameters > >
static constexpr size_t kPoisonOffset
 
- Protected Member Functions inherited from pw::allocator::BasicBlock< DetailedBlockImpl< Parameters > >
constexpr bool DoCheckInvariants (bool strict) const
 
- Protected Member Functions inherited from pw::allocator::ContiguousBlock< DetailedBlockImpl< Parameters > >
constexpr DetailedBlockImpl< Parameters > * DoSplitFirst (size_t new_inner_size)
 
constexpr DetailedBlockImpl< Parameters > * DoSplitLast (size_t new_inner_size)
 
constexpr void DoMergeNext ()
 
constexpr bool DoCheckInvariants (bool strict) const
 Performs the ContiguousBlock invariant checks.
 
- Protected Member Functions inherited from pw::allocator::AllocatableBlock< DetailedBlockImpl< Parameters > >
constexpr StatusWithSize DoCanAlloc (Layout layout) const
 
constexpr BlockResult< DetailedBlockImpl< Parameters > > DoResize (size_t new_inner_size, bool shifted=false)
 
- Protected Member Functions inherited from pw::allocator::AlignableBlock< DetailedBlockImpl< Parameters > >
constexpr StatusWithSize DoCanAlloc (Layout layout) const
 
- Protected Member Functions inherited from pw::allocator::BlockWithLayout< DetailedBlockImpl< Parameters > >
constexpr BlockResult< DetailedBlockImpl< Parameters > > DoResize (size_t new_inner_size, bool shifted=false)
 
- Protected Member Functions inherited from pw::allocator::PoisonableBlock< DetailedBlockImpl< Parameters > >
constexpr uintptr_t DoGetPoisonWord () const
 
constexpr DetailedBlockImpl< Parameters > * DoSplitFirst (size_t new_inner_size)
 
constexpr DetailedBlockImpl< Parameters > * DoSplitLast (size_t new_inner_size)
 
constexpr void DoMergeNext ()
 
constexpr bool DoCheckInvariants (bool strict) const
 Like IsValid, but crashes if invalid.
 
constexpr void SetFree (bool is_free)
 Clears the poisoned state if a block is not free.
 
- Static Protected Member Functions inherited from pw::allocator::AllocatableBlock< DetailedBlockImpl< Parameters > >
static constexpr BlockResult< DetailedBlockImpl< Parameters > > DoAllocFirst (DetailedBlockImpl< Parameters > *&&block, Layout layout)
 
static constexpr BlockResult< DetailedBlockImpl< Parameters > > DoAllocLast (DetailedBlockImpl< Parameters > *&&block, Layout layout)
 
static constexpr BlockResult< DetailedBlockImpl< Parameters > > DoFree (DetailedBlockImpl< Parameters > *&&block)
 
- Static Protected Member Functions inherited from pw::allocator::AlignableBlock< DetailedBlockImpl< Parameters > >
static constexpr BlockResult< DetailedBlockImpl< Parameters > > DoAllocFirst (DetailedBlockImpl< Parameters > *&&block, Layout layout)
 
static constexpr BlockResult< DetailedBlockImpl< Parameters > > DoAllocLast (DetailedBlockImpl< Parameters > *&&block, Layout layout)
 
- Static Protected Member Functions inherited from pw::allocator::BlockWithLayout< DetailedBlockImpl< Parameters > >
static constexpr BlockResult< DetailedBlockImpl< Parameters > > DoAllocFirst (DetailedBlockImpl< Parameters > *&&block, Layout layout)
 
static constexpr BlockResult< DetailedBlockImpl< Parameters > > DoAllocLast (DetailedBlockImpl< Parameters > *&&block, Layout layout)
 
static constexpr BlockResult< DetailedBlockImpl< Parameters > > DoFree (DetailedBlockImpl< Parameters > *&&block)
 

Detailed Description

template<typename Parameters>
class pw::allocator::DetailedBlockImpl< Parameters >

A block implementation that implements most optional block mix-ins.

This block dervies from various block mix-ins, allowing it to perform aligned allocations, iterate over blocks, poison and check free blocks, retrieve requested memory layouts, and more.

The amount of memory that can be addressed by a block of this type depends on it given OffsetType. This type is used to describe the size of both the current and previous block, so the maximum addressable range is given by std::numeric_limits<OffsetType> * alignof(OffsetType).

An additional 4 bytes are used to store details about an allocation, including whether it is in use or free, whether it is poisoned, and what the originally requested layout for a block was.

See also the DetailedBlock alias which provides the Parameters type automatically.

Template Parameters
ParametersBlock traits, such as DetailedBlockParameters, which encapsulate a set of template parameters.

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