authorgravatar for lukas@lalinsky.comLukas Lalinsky <lukas@lalinsky.com> 2025-10-09 08:52:52+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-10-09 00:45:49-07:00
log2b5306a94b0c2bf83f10e4634cec77a19dd2e08d
tree348f490da048b1fc322c3e29416d2587e3b0ae0d
parent88693a56fc6a7129d4967957f387b2e404e32f4d

Add missing clobbers to context switching

This only shows in release mode, the compiler tries to preserve some value in rdi, but that gets replaced inside the fiber. This would not happen in the C calling convention, but in these normal Zig functions, it can happen.

1 files changed, 2 insertions(+), 0 deletions(-)

lib/std/Io/EventLoop.zig+2
......@@ -644,6 +644,7 @@ inline fn contextSwitch(message: *const SwitchMessage) *const SwitchMessage {
644644 : [received_message] "={x1}" (-> *const @FieldType(SwitchMessage, "contexts")),
645645 : [message_to_send] "{x1}" (&message.contexts),
646646 : .{
647 .x0 = true,
647648 .x1 = true,
648649 .x2 = true,
649650 .x3 = true,
......@@ -745,6 +746,7 @@ inline fn contextSwitch(message: *const SwitchMessage) *const SwitchMessage {
745746 .rdx = true,
746747 .rbx = true,
747748 .rsi = true,
749 .rdi = true,
748750 .r8 = true,
749751 .r9 = true,
750752 .r10 = true,