refactor(allocator): reduce scope of unsafe blocks in Arena::new_chunk#21863
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Pull request overview
Refactors Arena::new_chunk in oxc_allocator to reduce the scope of unsafe by splitting one large unsafe { ... } block into smaller, statement-level unsafe blocks with accompanying safety documentation.
Changes:
- Split allocation, pointer arithmetic, and footer initialization into separate
unsafeblocks. - Added/updated safety comments documenting preconditions for each
unsafeoperation. - Added an additional debug assertion related to allocation size.
Merge activity
|
…hunk` (#21863) Refactor `Arena::new_chunk`. Previously there was a single large `unsafe { ... }` block. Split it into smaller blocks wrapping only statements that require an `unsafe` block, and document the safety conditions.
a480bcb to
2de093c
Compare

Refactor
Arena::new_chunk. Previously there was a single largeunsafe { ... }block. Split it into smaller blocks wrapping only statements that require anunsafeblock, and document the safety conditions.