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-29 06:20:49-07:00
logfcac8617b4e3c8fcb3a8c888fe77fa8bff1c2057
tree615c69bafcb4a3137fb7c34f4afcfc93965e732f
parent7d478114ec5ae74f977bf22050088a470f471721

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,