From 01bf2b9f523d3bcddf74cac6af4ac5c36ce75550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 29 Apr 2026 10:54:43 +0200 Subject: [PATCH] sd-varlink: drop pointless bitfield As is often the case, in this case because of alignment, we are actually not saving any space. With the bitfield we are using one bit of the 8 bytes allocated, and without the bitfield we are using 8 bits of that. But we're paying a price in generated code, at every access site to the field: $ diff <(objdump -S build/libsystemd.so.old) <(objdump -S build/libsystemd.so.new) ... v->protocol_upgrade = false; - fa2d2: 48 8b 45 a8 mov -0x58(%rbp),%rax - fa2d6: 0f b6 90 90 01 00 00 movzbl 0x190(%rax),%edx - fa2dd: 83 e2 fe and $0xfffffffe,%edx - fa2e0: 88 90 90 01 00 00 mov %dl,0x190(%rax) + fa2a9: 48 8b 45 a8 mov -0x58(%rbp),%rax + fa2ad: c6 80 90 01 00 00 00 movb $0x0,0x190(%rax) --- src/libsystemd/sd-varlink/varlink-internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsystemd/sd-varlink/varlink-internal.h b/src/libsystemd/sd-varlink/varlink-internal.h index 8087c2c432..ff359852f4 100644 --- a/src/libsystemd/sd-varlink/varlink-internal.h +++ b/src/libsystemd/sd-varlink/varlink-internal.h @@ -107,7 +107,7 @@ typedef struct sd_varlink { * ensure the caller's contract is honored. The transport-layer "stop reading at the * next message boundary" behavior is governed independently by the JsonStream's * bounded_reads flag. */ - bool protocol_upgrade:1; + bool protocol_upgrade; void *userdata;