refactor(allocator): fixed size allocators store backing allocation pointer in ChunkFooter#21868
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR refactors raw-transfer / fixed-size allocator plumbing so the pointer to the backing allocation is sourced from ChunkFooter (rather than being stored in FixedSizeAllocatorMetadata), aligning with the ChunkFooter::backing_alloc_ptr work introduced in #21865.
Changes:
- Extend
Allocator::from_raw_parts/Arena::from_raw_partsto accept(backing_alloc_ptr, layout)and persist them in the chunk footer for deallocation. - Remove
alloc_ptrfromFixedSizeAllocatorMetadata; update fixed-size allocator deallocation to read backing allocation info from theChunkFooter. - Update raw-transfer call sites (NAPI parser + oxlint JS plugins) to pass a
Layoutdescribing the JS-owned buffer.
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| napi/parser/src/raw_transfer.rs | Updates raw-transfer allocator construction to pass backing allocation info + buffer layout. |
| apps/oxlint/src/js_plugins/parse.rs | Same as above for oxlint’s JS-plugin raw parsing path. |
| crates/oxc_allocator/src/pool/fixed_size.rs | Removes metadata alloc_ptr, stores backing allocation info in the footer, and deallocates via footer info. |
| crates/oxc_allocator/src/from_raw_parts.rs | Expands Allocator::from_raw_parts API and updates safety docs accordingly. |
| crates/oxc_allocator/src/arena/mod.rs | Exposes ChunkFooter within the crate and adds an accessor for backing alloc info (fixed_size feature). |
| crates/oxc_allocator/src/arena/from_raw_parts.rs | Expands Arena::from_raw_parts to accept/store backing allocation info in the footer. |
| crates/oxc_allocator/src/generated/assert_layouts.rs | Updates asserted layout for the smaller FixedSizeAllocatorMetadata. |
| crates/oxc_ast_macros/src/generated/structs.rs | Updates generated struct field ordering metadata for FixedSizeAllocatorMetadata. |
Merge activity
|
40a8241 to
cc4860c
Compare
c2925db to
b86197d
Compare

Previously, fixed size allocators stored the pointer to the start of
Allocator's backing memory inFixedSizeAllocatorMetadata. Instead, store this pointer inChunkFooter, in the field introduced in #21865.