mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
Use low alignment bits instead of truncating high pointer bits
Changed PackedNext implementation to preserve ARM TBI/PAC/MTE pointer metadata:
- Store full usize pointer with auto_delete flag in LOW alignment bit (not high bit)
- ConcurrentTask is 8-byte aligned (contains u64 Task), so low bit is guaranteed zero
- Use enum(usize) { zero = 0, _ } for type safety and clean initialization syntax
- All atomic operations use usize (instead of u64) with @intFromEnum/@enumFromInt
- Masks: AUTO_DELETE_MASK=0x1, POINTER_MASK=~0x1
Benefits:
- Preserves all high pointer metadata (ARM pointer authentication, tagging, etc.)
- Uses guaranteed-zero low alignment bits instead of truncating address space
- Type-safe enum wrapper prevents accidental misuse
- Clean .zero initialization syntax
This commit is contained in:
@@ -132,7 +132,7 @@ pub fn watcherReleaseAndSubmitEvent(self: *Self, ev: *HotReloadEvent) void {
|
||||
self.dbg_server_event = ev;
|
||||
}
|
||||
ev.concurrent_task = .{
|
||||
.next = .{},
|
||||
.next = .zero,
|
||||
.task = jsc.Task.init(ev),
|
||||
};
|
||||
ev.concurrent_task.next.setAutoDelete(false);
|
||||
|
||||
Reference in New Issue
Block a user