You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stats accounting moved out of the Allocator.c _dyn dispatch wrappers
and into each typed backend body (Heap, Page, Arena, Slab, Budget,
Debug). The dyn wrappers no longer carry parallel updates -- duplicate
writes would double-count. Reads use new direct accessor macros in
<Misra/Std/Allocator.h>:
AllocatorBytesInUse(a), AllocatorBytesRequested(a),
AllocatorPeakBytesInUse(a), AllocatorAllocations(a),
AllocatorReallocations(a), AllocatorDeallocations(a),
AllocatorFailedAllocations(a)
Same `((void)0, ptr->field)` shape as BufLength / VecCapacity. No
AllocatorGetStats(...) function call, no _Generic-dispatched reader.
ALLOCATOR_OF(a) does the typed -> base cast at the macro level so each
read compiles down to a single field load. AllocatorResetStats stays
a function (it mutates).
Heap remap gains an mremap fast path on the XL (mmap-per-alloc) class.
On Linux direct-syscall builds, os_page_remap calls mremap with
MREMAP_MAYMOVE and the xl[] descriptor gets re-inserted at the new
sorted position. Darwin / Windows have no equivalent; those fall back
to alloc-new + memcpy. Drops BM_ReallocGrow on heap-based misra
columns from 247 us to 16 us (15x speedup), matching mimalloc and
tcmalloc.
Bench harness corrections:
- Allocator_misra_correct.c picks PageAllocator above 4 KiB instead
of falling back to HeapAllocator -- the latter was the "wrong tool"
path that misra-correct is supposed to avoid. AllocFreePair at
16/64 KiB drops 2400 ns -> 17 ns (matches misra-page).
- BM_ArenaBumpReset now SkipWithMessage("backend has no bulk reset")
for non-arena backends instead of duplicating BM_BatchAllocFree
numbers in the row. Honest n/a.
- Benchmark/meson.build documents the LTO requirement: cross-TU
inlining of the trivial bench_alloc / bench_free / bench_realloc
wrappers into Bench.cpp's hot loop relies on -Db_lto=true. README
reproduce block already shows both setup invocations.
- Benchmark/README.md regenerated with stats inline + LTO; misra
columns now report bytes_in_use in the fragmentation table for the
first time (lowest values in the table, exact live MB).
CODING-CONVENTIONS.md: replaced the "typed-direct skips stats" rule
(now wrong) with three general patterns -- shared per-instance state
on the base, one writer layer only, read-only fields exposed through
the ((void)0, ptr->field) accessor macro shape.
Windows test runner: SetJmp / LongJmp asm pair gated on __clang__ so
plain MSVC cl.exe falls back to libc setjmp/longjmp -- cl doesn't
understand __attribute__((naked)) or GNU-style __asm__. clang-cl path
unchanged.
0 commit comments