mirror of
https://github.com/oven-sh/bun
synced 2026-02-14 12:51:54 +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:
@@ -27,7 +27,7 @@ export fn Bun__queueJSCDeferredWorkTaskConcurrently(jsc_vm: *VirtualMachine, tas
|
||||
var loop = jsc_vm.eventLoop();
|
||||
const concurrent_task = ConcurrentTask.new(.{
|
||||
.task = Task.init(task),
|
||||
.next = .{},
|
||||
.next = .zero,
|
||||
});
|
||||
concurrent_task.next.setAutoDelete(true);
|
||||
loop.enqueueTaskConcurrent(concurrent_task);
|
||||
|
||||
Reference in New Issue
Block a user