Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Aug 9, 2025

Follow-on after #12555.

Avoid making bump field of Allocator public when track_allocations feature is enabled, by moving the field offset calculations to next to Allocator's definition.

@github-actions github-actions bot added the C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior label Aug 9, 2025
Copy link
Member Author

overlookmotel commented Aug 9, 2025


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 hot fixes, skip the queue and merge this PR next

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 marked this pull request as ready for review August 9, 2025 13:25
Copilot AI review requested due to automatic review settings August 9, 2025 13:25
Copy link
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

This PR refactors the Allocator struct to avoid exposing the bump field publicly when the track_allocations feature is enabled. The field offset calculations for allocation tracking are moved from the Alloc trait implementation to constants defined next to the Allocator struct.

Key changes:

  • Remove conditional public visibility of the bump field in Allocator
  • Add pre-calculated offset constants NUM_ALLOC_FIELD_OFFSET and NUM_REALLOC_FIELD_OFFSET
  • Simplify allocation tracking code by using these constants instead of inline calculations

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_allocator/src/allocator.rs Removes public visibility of bump field and adds offset constants for allocation tracking
crates/oxc_allocator/src/alloc.rs Updates allocation tracking code to use pre-calculated offset constants

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 9, 2025

CodSpeed Instrumentation Performance Report

Merging #12936 will not alter performance

Comparing 08-09-refactor_allocator_do_not_make_allocator_bump_field_public (ff1d93b) with main (2c303f5)1

Summary

✅ 34 untouched benchmarks

Footnotes

  1. No successful run was found on main (ff1d93b) during the generation of this report, so 2c303f5 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@overlookmotel overlookmotel requested a review from camchenry August 9, 2025 13:32
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Aug 9, 2025
Copy link
Member Author

overlookmotel commented Aug 9, 2025

Merge activity

Follow-on after #12555.

Avoid making `bump` field of `Allocator` public when `track_allocations` feature is enabled, by moving the field offset calculations to next to `Allocator`'s definition.
@graphite-app graphite-app bot force-pushed the 08-09-refactor_allocator_do_not_make_allocator_bump_field_public branch from 71ab71e to ff1d93b Compare August 9, 2025 14:24
@graphite-app graphite-app bot merged commit ff1d93b into main Aug 9, 2025
30 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 9, 2025
@graphite-app graphite-app bot deleted the 08-09-refactor_allocator_do_not_make_allocator_bump_field_public branch August 9, 2025 14:29
taearls pushed a commit to taearls/oxc that referenced this pull request Aug 12, 2025
…project#12936)

Follow-on after oxc-project#12555.

Avoid making `bump` field of `Allocator` public when `track_allocations` feature is enabled, by moving the field offset calculations to next to `Allocator`'s definition.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

4 participants