Skip to content

docs(allocator): reformat comments in Arena#21448

Merged
graphite-app[bot] merged 1 commit into
mainfrom
om/04-14-docs_allocator_reformat_comments_in_arena_
Apr 15, 2026
Merged

docs(allocator): reformat comments in Arena#21448
graphite-app[bot] merged 1 commit into
mainfrom
om/04-14-docs_allocator_reformat_comments_in_arena_

Conversation

@overlookmotel

@overlookmotel overlookmotel commented Apr 15, 2026

Copy link
Copy Markdown
Member

Comments-only change. Reformat comments in Arena code, and correct a few small mistakes.

Copy link
Copy Markdown
Member Author

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.

@github-actions github-actions Bot added A-allocator Area - Allocator C-docs Category - Documentation. Related to user-facing or internal documentation labels Apr 15, 2026
@overlookmotel overlookmotel self-assigned this Apr 15, 2026
@overlookmotel
overlookmotel marked this pull request as ready for review April 15, 2026 00:50
Copilot AI review requested due to automatic review settings April 15, 2026 00:50
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Apr 15, 2026

overlookmotel commented Apr 15, 2026

Copy link
Copy Markdown
Member Author

Merge activity

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 reformats and clarifies Rust doc/comments across the oxc_allocator::arena implementation, aiming to improve readability and correct small documentation issues without changing runtime behavior.

Changes:

  • Reflow and standardize doc/comment formatting across Arena modules (single-line wrapping, punctuation, wording).
  • Improve/adjust rustdoc link usage and section text in Arena documentation.
  • Convert some internal comments into rustdoc comments (e.g., constants/fields) to better surface intent in generated docs.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
crates/oxc_allocator/src/arena/tests.rs Minor comment wording/formatting updates in unit tests.
crates/oxc_allocator/src/arena/mod.rs Reflow/clarify top-level Arena rustdoc and some internal comments.
crates/oxc_allocator/src/arena/from_raw_parts.rs Rewrapped SAFETY/docs comments for readability.
crates/oxc_allocator/src/arena/drop.rs Reflowed reset docs and improved link reference to top-level docs.
crates/oxc_allocator/src/arena/create.rs Converted several explanatory comments into rustdoc; reflowed constructor docs.
crates/oxc_allocator/src/arena/chunks.rs Reflowed iterator/docs text and updated intra-doc links.
crates/oxc_allocator/src/arena/bumpalo_alloc.rs Reflowed upstream-derived docs/comments for consistency.
crates/oxc_allocator/src/arena/alloc_impl.rs Reflowed inline comments in allocation logic.
crates/oxc_allocator/src/arena/alloc.rs Reflowed allocation method docs and tweaked wording.

// own function instead of inlining it into the surrounding code.
// Ideally we want LLVM to always realize that doing a stack allocation is unnecessary and optimize
// the code so it writes directly into the heap instead. It seems we get it to realize this most
// consistently if we put this critical line into it's own function instead of inlining it into the

Copilot AI Apr 15, 2026

Copy link

Choose a reason for hiding this comment

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

Spelling/grammar: “into it's own function” should be “into its own function”.

Suggested change
// consistently if we put this critical line into it's own function instead of inlining it into the
// consistently if we put this critical line into its own function instead of inlining it into the

Copilot uses AI. Check for mistakes.
Comment on lines 277 to +287
@@ -300,26 +283,23 @@ impl<const MIN_ALIGN: usize> Arena<MIN_ALIGN> {
// | a | b | c | . | . |
// +-----+-----+-----+-----+-----+
//
// But we MUST NOT have overlapping ranges because we use
// `copy_nonoverlapping` below! Therefore, we round the division
// up to avoid this issue.
// But we MUST NOT have overlapping ranges because we use `copy_nonoverlapping` below.
// Therefore, we round the division up to avoid this issue.

Copilot AI Apr 15, 2026

Copy link

Choose a reason for hiding this comment

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

Comment typos make this explanation harder to follow: “And the the check…” and “we are have overlapping ranges” should be corrected (e.g. “And the check…” / “we have overlapping ranges”).

Copilot uses AI. Check for mistakes.
Comment on lines +56 to +59
/// Default chunk size for a new `Arena`, minus the size of the footer.
///
/// The actual size of the first allocation is going to be a bit smaller than the goal.
/// We need to make room for the footer, and we also need take the alignment into account.

Copilot AI Apr 15, 2026

Copy link

Choose a reason for hiding this comment

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

The doc comment for DEFAULT_CHUNK_SIZE_WITHOUT_FOOTER says it’s “minus the size of the footer”, but the value is FIRST_ALLOCATION_GOAL - OVERHEAD where OVERHEAD also includes malloc overhead and alignment rounding. Please adjust the wording to match what’s actually subtracted (overhead, not just the footer).

Suggested change
/// Default chunk size for a new `Arena`, minus the size of the footer.
///
/// The actual size of the first allocation is going to be a bit smaller than the goal.
/// We need to make room for the footer, and we also need take the alignment into account.
/// Default chunk size for a new `Arena`, minus allocation overhead.
///
/// The actual size of the first allocation is going to be a bit smaller than the goal.
/// We need to make room for overhead such as the footer, allocator overhead, and alignment.

Copilot uses AI. Check for mistakes.

/// Allocates a new slice of size `len` slice into this `Arena` and return an
/// exclusive reference to the copy.
/// Allocate a new slice of size `len` into this `Arena`. Return an exclusive reference to the clone.

Copilot AI Apr 15, 2026

Copy link

Choose a reason for hiding this comment

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

Minor doc wording issue: this function returns a slice (&mut [T]), so “Return an exclusive reference to the clone” is misleading. Consider rephrasing to “Returns an exclusive reference to the slice” (filled with value.clone()) and fix the “Return” -> “Returns” grammar.

Suggested change
/// Allocate a new slice of size `len` into this `Arena`. Return an exclusive reference to the clone.
/// Allocate a new slice of size `len` into this `Arena`. Returns an exclusive reference to the slice.

Copilot uses AI. Check for mistakes.
// own function instead of inlining it into the surrounding code.
// Ideally we want LLVM to always realize that doing a stack allocation is unnecessary and optimize
// the code so it writes directly into the heap instead. It seems we get it to realize this most
// consistently if we put this critical line into it's own function instead of inlining it into the

Copilot AI Apr 15, 2026

Copy link

Choose a reason for hiding this comment

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

Spelling/grammar: “into it's own function” should be “into its own function”.

Suggested change
// consistently if we put this critical line into it's own function instead of inlining it into the
// consistently if we put this critical line into its own function instead of inlining it into the

Copilot uses AI. Check for mistakes.
Comments-only change. Reformat comments in `Arena` code, and correct a few small mistakes.
@graphite-app
graphite-app Bot force-pushed the om/04-14-docs_allocator_reformat_comments_in_arena_ branch from 41849d8 to c5b19bb Compare April 15, 2026 00:54
@codspeed-hq

codspeed-hq Bot commented Apr 15, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 44 untouched benchmarks
⏩ 7 skipped benchmarks1


Comparing om/04-14-docs_allocator_reformat_comments_in_arena_ (41849d8) with main (7f60234)

Open in CodSpeed

Footnotes

  1. 7 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.

@graphite-app
graphite-app Bot merged commit c5b19bb into main Apr 15, 2026
27 checks passed
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Apr 15, 2026
@graphite-app
graphite-app Bot deleted the om/04-14-docs_allocator_reformat_comments_in_arena_ branch April 15, 2026 00:59
Dunqing added a commit that referenced this pull request Apr 16, 2026
### 💥 BREAKING CHANGES

- 24fb7eb allocator: [**BREAKING**] Rename `Box` and `Vec` methods
(#21395) (overlookmotel)

### 🚀 Features

- ce5072d parser: Support `turbopack` magic comments (#20803) (Kane
Wang)
- f5deb55 napi/transform: Expose `optimizeConstEnums` and
`optimizeEnums` options (#21388) (Dunqing)
- 24b03de data_structures: Introduce `NonNullConst` and `NonNullMut`
pointer types (#21425) (overlookmotel)

### 🐛 Bug Fixes

- d7a359a ecmascript: Treat update expressions as unconditionally
side-effectful (#21456) (Dunqing)
- 56af2f4 transformer/async-to-generator: Correct scope of inferred
named FE in async-to-generator (#21458) (Dunqing)
- b3ed467 minifier: Avoid illegal `var;` when folding unused arguments
copy loop (#21421) (fazba)
- b0e8f13 minifier: Preserve `var` inside `catch` with same-named
parameter (#21366) (Dunqing)
- 4fb73a7 transformer/typescript: Preserve execution order for accessor
with `useDefineForClassFields: false` (#21369) (Dunqing)

### ⚡ Performance

- da3cc16 parser: Refactor out `LexerContext` (#21275) (Ulrich Stark)

### 📚 Documentation

- c5b19bb allocator: Reformat comments in `Arena` (#21448)
(overlookmotel)
- 091e88e lexer: Update doc comment about perf benefit of reading
through references (#21423) (overlookmotel)
- 922cbee allocator: Remove references to "bump" from comments (#21397)
(overlookmotel)

Co-authored-by: Dunqing <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-allocator Area - Allocator C-docs Category - Documentation. Related to user-facing or internal documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants