1#ifndef VEG_STACK_ALLOC_HPP_UTBYR4Y5S
2#define VEG_STACK_ALLOC_HPP_UTBYR4Y5S
15template<usize MaxAlign>
25 usize const actual_max_align =
27 MaxAlign > 8 ? MaxAlign : 8
33 usize const mask = (actual_max_align - 1);
34 return (byte_size + mask) & ~mask;
55 if (
_is_last(ptr, layout.byte_size)) {
68 auto given_bytes =
_align(layout.byte_size);
71 (layout.align <= MaxAlign),
72 (given_bytes < rem_bytes));
83 auto given_bytes =
_align(new_byte_size);
87 return { ptr, given_bytes };
109 if (
_is_last(ptr, old_layout.byte_size)) {
114 reloc(blk.
data, ptr, old_layout.byte_size);
123template<usize MaxAlign>
127 static_assert(MaxAlign >= 8,
".");
134 s.ptr_mut() + s.len(),
139 ((std::uintptr_t(s.ptr()) % MaxAlign) == std::uintptr_t(0)),
143template<usize MaxAlign>
148template<usize MaxAlign>
154template<usize MaxAlign>
181template<usize MaxAlign>
208template<usize MaxAlign>
#define VEG_DEBUG_ASSERT(...)
#define VEG_ASSERT_ALL_OF(...)
decltype(sizeof(0)) usize
auto _grow_last(void *ptr, mem::Layout old_layout, usize new_byte_size, mem::RelocFn) noexcept -> mem::AllocBlock
static auto _align(usize byte_size) noexcept -> usize
void _assert_last(void *ptr, usize byte_size) noexcept
void _dealloc_last(void *ptr, mem::Layout layout)
auto _grow_last_unchecked(void *ptr, usize new_byte_size) noexcept -> mem::AllocBlock
auto _alloc(mem::Layout layout) noexcept -> mem::AllocBlock
auto _grow_any(void *ptr, mem::Layout old_layout, usize new_byte_size, mem::RelocFn reloc) noexcept -> mem::AllocBlock
void _dealloc_last_unchecked(void *ptr, mem::Layout layout)
void _dealloc_any(void *ptr, mem::Layout layout) noexcept
auto _is_last(void *ptr, usize byte_size) noexcept -> bool
static VEG_INLINE auto alloc(RefMut ref, mem::Layout layout) noexcept -> AllocBlock
static VEG_INLINE auto grow(RefMut ref, void *ptr, mem::Layout old_layout, usize new_byte_size, RelocFn reloc) noexcept -> mem::AllocBlock
static VEG_INLINE void dealloc(RefMut ref, void *ptr, mem::Layout layout) noexcept
static VEG_INLINE auto alloc(RefMut ref, mem::Layout layout) noexcept -> AllocBlock
static VEG_INLINE auto grow(RefMut ref, void *ptr, mem::Layout old_layout, usize new_byte_size, RelocFn reloc) noexcept -> mem::AllocBlock
static VEG_INLINE void dealloc(RefMut, void *, mem::Layout) noexcept
static VEG_INLINE auto alloc(RefMut ref, mem::Layout layout) noexcept -> AllocBlock
static VEG_INLINE auto grow(RefMut ref, void *ptr, mem::Layout old_layout, usize new_byte_size, RelocFn reloc) noexcept -> mem::AllocBlock
static VEG_INLINE void dealloc(RefMut ref, void *ptr, mem::Layout layout) noexcept
BumpAlloc(FromSliceMut, SliceMut< byte > s) noexcept