Skip to content

refactor(allocator): Arena::new_chunk return start pointer#21864

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

refactor(allocator): Arena::new_chunk return start pointer#21864
graphite-app[bot] merged 1 commit into
mainfrom
om/04-26-refactor_allocator_arena_new_chunk_return_start_pointer

Conversation

@overlookmotel

@overlookmotel overlookmotel commented Apr 27, 2026

Copy link
Copy Markdown
Member

Refactor to Arena.

Arena::new_chunk return the chunk's start pointer directly, rather than the caller having to obtain it from the ChunkFooter.

This is a step towards separating the 2 pointers which live in Arena and ChunkFooter, continued 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-26-refactor_allocator_arena_new_chunk_return_start_pointer (215e7ae) 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 main (215e7ae) during the generation of this report, so e7f8d55 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

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

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 the allocator’s chunk-creation API so Arena::new_chunk returns the chunk’s start pointer directly (alongside the initialized ChunkFooter pointer), reducing reliance on reading start_ptr back from the footer and moving toward separating pointer responsibilities (a step toward #21865).

Changes:

  • Update Arena::new_chunk to return (start_ptr, footer_ptr) instead of just footer_ptr.
  • Adjust initial arena creation to use the returned start_ptr directly.
  • Adjust the slow allocation path to use new_start_ptr directly for alignment checks and Arena::start_ptr updates.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
crates/oxc_allocator/src/arena/create.rs Changes new_chunk return type and updates initial arena construction to consume (start_ptr, footer_ptr).
crates/oxc_allocator/src/arena/alloc_impl.rs Updates the slow-path chunk allocation loop to destructure (new_start_ptr, new_footer_ptr) and use new_start_ptr directly.

@graphite-app

graphite-app Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Merge activity

Refactor to `Arena`.

`Arena::new_chunk` return the chunk's start pointer directly, rather than the caller having to obtain it from the `ChunkFooter`.

This is a step towards separating the 2 pointers which live in `Arena` and `ChunkFooter`, continued in #21865.
@graphite-app graphite-app Bot force-pushed the om/04-26-refactor_allocator_reduce_scope_of_unsafe_blocks_in_arena_new_chunk_ branch from a480bcb to 2de093c Compare April 27, 2026 23:31
@graphite-app graphite-app Bot force-pushed the om/04-26-refactor_allocator_arena_new_chunk_return_start_pointer branch from bc5bfbe to 215e7ae Compare April 27, 2026 23:32
Base automatically changed from om/04-26-refactor_allocator_reduce_scope_of_unsafe_blocks_in_arena_new_chunk_ to main April 27, 2026 23:37
@graphite-app graphite-app Bot merged commit 215e7ae into main Apr 27, 2026
37 checks passed
@graphite-app graphite-app Bot deleted the om/04-26-refactor_allocator_arena_new_chunk_return_start_pointer branch April 27, 2026 23:38
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