Skip to content

refactor(linter/plugins, napi/plugins): use constant for arena alignment from Allocator#21797

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/04-26-refactor_linter_plugins_napi_plugins_use_constant_for_arena_alignment_from_allocator_
Apr 26, 2026
Merged

refactor(linter/plugins, napi/plugins): use constant for arena alignment from Allocator#21797
graphite-app[bot] merged 1 commit intomainfrom
om/04-26-refactor_linter_plugins_napi_plugins_use_constant_for_arena_alignment_from_allocator_

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Apr 26, 2026

Refactor.

Don't hard-code the minimum alignment of Arena chunks in apps/oxlint and napi/parser. Get the value from a property on Allocator. This will avoid this code getting out of sync if the value changes in future.

Also rename the vars BUMP_ALIGN to ARENA_ALIGN, as the arena type is now called Arena not Bump, and update some comments which were out of date.

Copy link
Copy Markdown
Member Author

overlookmotel commented Apr 26, 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.

@overlookmotel overlookmotel self-assigned this Apr 26, 2026
@overlookmotel overlookmotel marked this pull request as ready for review April 26, 2026 20:55
@overlookmotel overlookmotel requested a review from camc314 as a code owner April 26, 2026 20:55
Copilot AI review requested due to automatic review settings April 26, 2026 20:55
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

Refactors the raw-transfer parsing paths in oxlint and the N-API parser to stop hard-coding arena/chunk alignment and instead derive it from Allocator, reducing the risk of alignment drift if allocator internals change.

Changes:

  • Replaces hard-coded 16 alignment constants with Allocator::RAW_MIN_ALIGN.
  • Renames BUMP_ALIGN to ARENA_ALIGN to match the Arena naming.
  • Updates alignment-based offset calculations/asserts to use the new constant.

Reviewed changes

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

File Description
napi/parser/src/raw_transfer.rs Uses Allocator::RAW_MIN_ALIGN for raw-transfer allocator alignment and updates related asserts/offset rounding.
apps/oxlint/src/js_plugins/parse.rs Uses Allocator::RAW_MIN_ALIGN for raw-transfer parsing alignment and updates the cursor alignment logic accordingly.

Comment thread napi/parser/src/raw_transfer.rs Outdated
Comment thread napi/parser/src/raw_transfer.rs
Comment thread napi/parser/src/raw_transfer.rs Outdated
Comment thread napi/parser/src/raw_transfer.rs Outdated
Comment thread apps/oxlint/src/js_plugins/parse.rs Outdated
@overlookmotel overlookmotel force-pushed the om/04-26-refactor_linter_plugins_napi_plugins_use_constant_for_arena_alignment_from_allocator_ branch from 75ba45c to d1e4c50 Compare April 26, 2026 21:15
@overlookmotel overlookmotel force-pushed the om/04-26-refactor_allocator_clarify_max_calculations_in_arena_ branch from 87e8340 to 8fb23df Compare April 26, 2026 21:15
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app Bot commented Apr 26, 2026

Merge activity

…ent from `Allocator` (#21797)

Refactor.

Don't hard-code the minimum alignment of `Arena` chunks in `apps/oxlint` and `napi/parser`. Get the value from a property on `Allocator`. This will avoid this code getting out of sync if the value changes in future.

Also rename the vars `BUMP_ALIGN` to `ARENA_ALIGN`, as the arena type is now called `Arena` not `Bump`, and update some comments which were out of date.
@graphite-app graphite-app Bot force-pushed the om/04-26-refactor_allocator_clarify_max_calculations_in_arena_ branch from 8fb23df to 94a41eb Compare April 26, 2026 21:54
@graphite-app graphite-app Bot force-pushed the om/04-26-refactor_linter_plugins_napi_plugins_use_constant_for_arena_alignment_from_allocator_ branch from d1e4c50 to a7521cb Compare April 26, 2026 21:54
Base automatically changed from om/04-26-refactor_allocator_clarify_max_calculations_in_arena_ to main April 26, 2026 22:14
@graphite-app graphite-app Bot merged commit a7521cb into main Apr 26, 2026
26 checks passed
@graphite-app graphite-app Bot deleted the om/04-26-refactor_linter_plugins_napi_plugins_use_constant_for_arena_alignment_from_allocator_ branch April 26, 2026 22:15
@overlookmotel overlookmotel added A-parser Area - Parser A-linter-plugins Area - Linter JS plugins A-allocator Area - Allocator labels Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-allocator Area - Allocator A-linter-plugins Area - Linter JS plugins A-parser Area - Parser

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants