Skip to content

refactor(allocator): fixed size allocators store backing allocation pointer in ChunkFooter#21868

Merged
graphite-app[bot] merged 1 commit into
mainfrom
om/04-27-refactor_allocator_fixed_size_allocators_store_backing_allocation_pointer_in_chunkfooter_
Apr 27, 2026
Merged

refactor(allocator): fixed size allocators store backing allocation pointer in ChunkFooter#21868
graphite-app[bot] merged 1 commit into
mainfrom
om/04-27-refactor_allocator_fixed_size_allocators_store_backing_allocation_pointer_in_chunkfooter_

Conversation

@overlookmotel

@overlookmotel overlookmotel commented Apr 27, 2026

Copy link
Copy Markdown
Member

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

overlookmotel commented Apr 27, 2026

Copy link
Copy Markdown
Member Author

@codspeed-hq

codspeed-hq Bot commented Apr 27, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 48 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing om/04-27-refactor_allocator_fixed_size_allocators_store_backing_allocation_pointer_in_chunkfooter_ (b86197d) with main (e7f8d55)2

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on om/04-27-docs_ast_tools_correct_doc_comment_in_raw_transfer_generator (cc4860c) during the generation of this report, so main (e7f8d55) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@overlookmotel overlookmotel added C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior A-allocator Area - Allocator labels Apr 27, 2026
@overlookmotel overlookmotel marked this pull request as ready for review April 27, 2026 22:59
@overlookmotel overlookmotel requested a review from camc314 as a code owner April 27, 2026 22:59
Copilot AI review requested due to automatic review settings April 27, 2026 22:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_parts to accept (backing_alloc_ptr, layout) and persist them in the chunk footer for deallocation.
  • Remove alloc_ptr from FixedSizeAllocatorMetadata; update fixed-size allocator deallocation to read backing allocation info from the ChunkFooter.
  • Update raw-transfer call sites (NAPI parser + oxlint JS plugins) to pass a Layout describing 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.

Comment thread crates/oxc_allocator/src/arena/from_raw_parts.rs
@graphite-app

graphite-app Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Merge activity

…ointer in `ChunkFooter` (#21868)

Previously, fixed size allocators stored the pointer to the start of `Allocator`'s backing memory in `FixedSizeAllocatorMetadata`. Instead, store this pointer in `ChunkFooter`, in the field introduced in #21865.
@graphite-app graphite-app Bot force-pushed the om/04-27-docs_ast_tools_correct_doc_comment_in_raw_transfer_generator branch from 40a8241 to cc4860c Compare April 27, 2026 23:33
@graphite-app graphite-app Bot force-pushed the om/04-27-refactor_allocator_fixed_size_allocators_store_backing_allocation_pointer_in_chunkfooter_ branch from c2925db to b86197d Compare April 27, 2026 23:34
Base automatically changed from om/04-27-docs_ast_tools_correct_doc_comment_in_raw_transfer_generator to main April 27, 2026 23:41
@graphite-app graphite-app Bot merged commit b86197d into main Apr 27, 2026
38 checks passed
@graphite-app graphite-app Bot deleted the om/04-27-refactor_allocator_fixed_size_allocators_store_backing_allocation_pointer_in_chunkfooter_ branch April 27, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-allocator Area - Allocator C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants