Skip to content

refactor(allocator): ChunkRawIter yield NonNull pointers#21738

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/04-24-refactor_allocator_chunkrawiter_yield_nonnull_pointers
Apr 25, 2026
Merged

refactor(allocator): ChunkRawIter yield NonNull pointers#21738
graphite-app[bot] merged 1 commit intomainfrom
om/04-24-refactor_allocator_chunkrawiter_yield_nonnull_pointers

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Apr 25, 2026

ChunkRawIter is an iterator over pointer & length pairs for an Arena's chunks. Alter it to return NonNull<u8> pointers instead of *mut u8 pointers.

This is not a breaking change, as we do not expose the Arena type externally.

Copy link
Copy Markdown
Member Author

overlookmotel commented Apr 25, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 25, 2026

Merging this PR will not alter performance

✅ 48 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing om/04-24-refactor_allocator_chunkrawiter_yield_nonnull_pointers (8fd3746) with main (1b97124)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 (8fd3746) during the generation of this report, so 1b97124 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@overlookmotel overlookmotel self-assigned this Apr 25, 2026
@overlookmotel overlookmotel added C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior A-allocator Area - Allocator labels Apr 25, 2026
@overlookmotel overlookmotel marked this pull request as ready for review April 25, 2026 09:30
Copilot AI review requested due to automatic review settings April 25, 2026 09:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Arena::iter_allocated_chunks_raw() / ChunkRawIter to yield non-null chunk base pointers (NonNull<u8>) instead of potentially-null raw pointers, and adjusts iterator consumers/tests accordingly.

Changes:

  • Refactor ChunkRawIter to return (NonNull<u8>, usize) and update ChunkIter to build slices from NonNull.
  • Update arena quickcheck tests to use NonNull APIs (addr(), as_ptr()) when comparing ranges/pointers.
  • Remove the now-unneeded clippy::ptr_as_ptr expectation from the arena test harness.

Reviewed changes

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

File Description
crates/oxc_allocator/src/arena/chunks.rs Changes ChunkRawIter to yield NonNull<u8> and updates ChunkIter slice construction accordingly.
crates/oxc_allocator/tests/arena/quickchecks.rs Updates tests to collect raw chunks as (NonNull<u8>, usize) and compare addresses/pointers via NonNull APIs.
crates/oxc_allocator/tests/arena/main.rs Drops clippy::ptr_as_ptr from the crate-level expected lint list.

@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app Bot commented Apr 25, 2026

Merge activity

`ChunkRawIter` is an iterator over pointer & length pairs for an `Arena`'s chunks. Alter it to return `NonNull<u8>` pointers instead of `*mut u8` pointers.

This is not a breaking change, as we do not expose the `Arena` type externally.
@graphite-app graphite-app Bot force-pushed the om/04-24-refactor_allocator_remove_conversions_to_from_nonnull_pointers branch from 98805a7 to 3aadfcd Compare April 25, 2026 11:22
@graphite-app graphite-app Bot force-pushed the om/04-24-refactor_allocator_chunkrawiter_yield_nonnull_pointers branch from 4288517 to 8fd3746 Compare April 25, 2026 11:23
Base automatically changed from om/04-24-refactor_allocator_remove_conversions_to_from_nonnull_pointers to main April 25, 2026 11:27
@graphite-app graphite-app Bot merged commit 8fd3746 into main Apr 25, 2026
37 checks passed
@graphite-app graphite-app Bot deleted the om/04-24-refactor_allocator_chunkrawiter_yield_nonnull_pointers branch April 25, 2026 11:28
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