refactor(allocator): Arena::new_chunk return start pointer#21864
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
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_chunkto return(start_ptr, footer_ptr)instead of justfooter_ptr. - Adjust initial arena creation to use the returned
start_ptrdirectly. - Adjust the slow allocation path to use
new_start_ptrdirectly for alignment checks andArena::start_ptrupdates.
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. |
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.
a480bcb to
2de093c
Compare
bc5bfbe to
215e7ae
Compare

Refactor to
Arena.Arena::new_chunkreturn the chunk's start pointer directly, rather than the caller having to obtain it from theChunkFooter.This is a step towards separating the 2 pointers which live in
ArenaandChunkFooter, continued in #21865.