Skip to content

refactor(allocator/pool): share AllocatorGuard between pool impls#13621

Merged
graphite-app[bot] merged 1 commit intomainfrom
09-09-refactor_allocator_pool_share_allocatorguard_between_pool_impls
Sep 10, 2025
Merged

refactor(allocator/pool): share AllocatorGuard between pool impls#13621
graphite-app[bot] merged 1 commit intomainfrom
09-09-refactor_allocator_pool_share_allocatorguard_between_pool_impls

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Sep 9, 2025

Refactor.

We have 2 versions of AllocatorPool (standard and fixed-size). Aim is to combine them into one. This is a step along that way.

Previously both versions of AllocatorPool had very similar AllocatorGuard implementations. Replace them with a single AllocatorGuard implementation, which both versions share.

Copy link
Member Author

overlookmotel commented Sep 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.

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 9, 2025

CodSpeed Instrumentation Performance Report

Merging #13621 will not alter performance

Comparing 09-09-refactor_allocator_pool_share_allocatorguard_between_pool_impls (99dd1a7) with main (f9bff64)1

Summary

✅ 37 untouched benchmarks

Footnotes

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

@graphite-app graphite-app bot force-pushed the 09-09-refactor_allocator_pool_move_resetting_into_allocatorpool_add_ branch from 02481be to aed935a Compare September 10, 2025 02:46
@graphite-app graphite-app bot force-pushed the 09-09-refactor_allocator_pool_share_allocatorguard_between_pool_impls branch from 7a28218 to fbeb154 Compare September 10, 2025 02:46
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Sep 10, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Sep 10, 2025

Merge activity

…13621)

Refactor.

We have 2 versions of `AllocatorPool` (standard and fixed-size). Aim is to combine them into one. This is a step along that way.

Previously both versions of `AllocatorPool` had very similar `AllocatorGuard` implementations. Replace them with a single `AllocatorGuard` implementation, which both versions share.
@graphite-app graphite-app bot force-pushed the 09-09-refactor_allocator_pool_move_resetting_into_allocatorpool_add_ branch from aed935a to 0dde7f0 Compare September 10, 2025 04:03
@graphite-app graphite-app bot force-pushed the 09-09-refactor_allocator_pool_share_allocatorguard_between_pool_impls branch from fbeb154 to 99dd1a7 Compare September 10, 2025 04:04
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Sep 10, 2025
Base automatically changed from 09-09-refactor_allocator_pool_move_resetting_into_allocatorpool_add_ to main September 10, 2025 04:10
@graphite-app graphite-app bot merged commit 99dd1a7 into main Sep 10, 2025
30 checks passed
@graphite-app graphite-app bot deleted the 09-09-refactor_allocator_pool_share_allocatorguard_between_pool_impls branch September 10, 2025 04:11
Copy link
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

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

// SAFETY: FixedSizeAllocator is just a wrapper around ManuallyDrop<Allocator>,

are there any const assertions we can add to prevent this breaking

@overlookmotel
Copy link
Member Author

// SAFETY: FixedSizeAllocator is just a wrapper around ManuallyDrop<Allocator>,

are there any const assertions we can add to prevent this breaking

mem::transmute will raise a compilation error if the types being transmuted to/from (FixedSizeAllocator and ManuallyDrop<Allocator>) are different sizes. That's not a complete guarantee, but it is some kind of guardrail. I'm not aware of a way to make this tighter.

There is a ton of hackery around allocators at the moment, and this isn't even the worst of it. Ultimately, I think we need to replace bumpalo with an allocator that supports what we need natively. Then all of this mess can disappear.

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.

2 participants