Commit aca2fd6
committed
hash-page-table: allocator restructure + 15-round convention sweep
Allocator restructure
- Each allocator owns its own OS pages; PageAllocator dependency dropped
from Heap / Arena / Slab.
- Heap: hash-indexed pages[] + per-class warm list; xl-page descriptor
table on its own mmap, page-rounded for grow/unmap symmetry.
- Typed-self everywhere: dispatch enters typed, vtable cast happens once
at *Init compound literal, no `_dyn` thunks below the boundary.
- Extracted `_Os.{h,c}` shim (os_page_map / unmap / round_up) shared by
every backend.
- Dirty-bit deep-validate gating on Page + Heap (LSB of `__magic`).
- New public accessors: HeapAllocator{PageCount,XlCount},
PageAllocator{FootprintBytes,EntryCount}, BudgetAllocatorSlotCount.
- Arena.c: `zeroed` flag now honoured on in-chunk reuse (was returning
stale tenant bytes after `ArenaAllocatorReset`).
- AllocatorStats accounting documented as typed-direct-skip (only the
`Allocator *` dyn arm updates counters).
Bench / perf infrastructure
- Per-op + perf-record harnesses for HeapAllocator vs libc (Bench-Perf/).
- Cross-allocator comparison driver (Benchmark/) with libc / misra /
misra-arena / misra-page split; Page footprint sampling via the new
accessor.
Sys / parsers
- Sys/*: direct syscalls (Linux x86_64/aarch64 + Darwin BSD class) via
Source/Misra/_Syscall.h; FEATURE_DIRECT_SYSCALL gates the wrapper
path. ErrnoOf(ret) unifies `<0`-means-`-errno` (direct) and `-1`+errno
(libc fallback).
- Proc.c: child exit path on execve failure (was returning into parent
code as a second process); wait4 sentinel switched to `< 0`;
GetCurrentExecutablePath readlink sentinel switched to `< 0`;
stdin/stdout/stderr pipe initialisers fixed (was leaving fd 0).
- Socket.c / Dns.c / Dir.c / Proc.c: alias wrappers purged; canonical
`LOG_SYS_ERROR(ErrnoOf(ret), ...)` everywhere.
- Mutex.h+c: gating unified on FEATURE_DIRECT_SYSCALL; dead pthread
fallback removed; NULL guards added to Lock/Unlock.
- Backtrace / SymbolResolver / PdbCache / MachoCache stay outside the
Sys umbrella (parser-name collision risk); umbrella comment lists the
full carve-out.
- Parsers: ElfFindSection / PeFindSection / MachoFindSection now take
Str / Zstr / char* via _Generic; dns_resolve_4_one same.
- Elf.c: `class` field renamed to `elf_class` (C++ keyword).
- Dns.c: VecPushBackR failure path no longer leaks the Str name.
Containers
- Validator-before-field-access in Map.c / List.c / Graph.c
validate_*; closes NULL-deref on a magic-OK handle with NULL
allocator pointer.
- Float / Int observers const-cascaded across Memory / Convert / Compare
/ Math / Private headers (and their callers).
- Alias wrappers removed: MapTryGetPtr, MapGetOrInsertPtr,
BitVecInitWithCapacityMacro. Callers migrated.
- Iter / StrIter: direction-aware peek (PeekNext / PeekPrev) wired
through the `dir` field; macro args parenthesised.
Std / freestanding
- Io.c read-text-int family (_read_u8..u64 / i8..i64) consolidated via
`_MAKE_READ_TXT_INT` stamping macro (net -460 LOC).
- _Freestanding.c: `_setjmp` deduplicated as `__attribute__((alias(
"setjmp")))`; jmp_buf size docs corrected (x86_64 64 B, aarch64 104 B).
- Zstr.c parseInt: removed `s[-1]` UB when no digits consumed.
- Types.h: NULL is `((void *)0)`; FORMAT_STRING uses `__attribute__`
(was `__attribute`); INVERT_ENDIANNESS{4,8} body and arg paren-fixed
(was silently corrupting the high half for any direct caller).
Tests
- TestRunner: `expect_failure=false` now installs OnAbort and routes
through one setjmp before the test body (previously skipped the
setjmp install AND the OnAbort reset).
- Tests/Std: `&alloc.base` replaced with `ALLOCATOR_OF(&alloc)`;
white-box private-field reads/writes carry `// intentional bypass:`
comments per the new CONVENTIONS phrase.
- Tests/meson.build: PdbCache + MachoCache gated on `opt_file
and opt_sys_dir` so minimal builds link.
- Fuzz/Harness/Str.{c,h}: deleted (stub: referenced non-existent APIs).
Docs / build
- CODING-CONVENTIONS.md: new sections for `intentional bypass:`
canonical phrase, AllocatorStats typed-direct-skip, .c-local
macro-stamping pattern as approved alternative to alias wrappers;
rule reaffirmed: NO MISRA_ prefix on public macros (only include
guards + MISRA_SYS_* constants); NO alias wrappers (neither
`#define foo bar` nor `static inline T foo(...){return bar(...);}`);
_Generic inlined at each call site, Zstr arms paired with char*.
- README.md: minimal-build example with full disable-flag list and
cascade explanation (alloc_debug auto-enables map + sys_backtrace +
parser_elf + parser_dwarf); file / iter / alloc_arena flagged as
not-currently-disable-able with rationale.
- Misra.h / Std.h / Sys.h umbrellas: FEATURE_* gates and carve-outs
brought in line with the actual feature matrix; Container.h umbrella
now exposes Buf.h.
- meson.build: dead libm dep removed.
- File-path header comments normalised to lowercase
`/// file: relative/path.ext` across every header and source.
Build / test status: Linux 104/104 + Mac 99/99 green at this tip.1 parent 979b34c commit aca2fd6
230 files changed
Lines changed: 5066 additions & 4736 deletions
File tree
- Bench-Perf
- Benchmark
- Source
- Bin
- Fuzz
- Harness
- Include
- Misra
- Parsers
- Std
- Allocator
- Container
- BitVec
- Float
- Graph
- Int
- List
- Map
- Str
- Vec
- Utility
- Iter
- Sys
- Scripts
- Source/Misra
- Parsers
- Std
- Allocator
- Container
- Utility
- Sys
- Tests
- Json
- Std
- Util
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| |||
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
121 | 113 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
107 | 105 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
| |||
165 | 164 | | |
166 | 165 | | |
167 | 166 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
185 | 172 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 84 | + | |
89 | 85 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
20 | | - | |
21 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
0 commit comments