]> git.ipfire.org Git - thirdparty/systemd.git/commit
sd-varlink: drop pointless bitfield
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Wed, 29 Apr 2026 08:54:43 +0000 (10:54 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Wed, 29 Apr 2026 09:23:01 +0000 (11:23 +0200)
commit01bf2b9f523d3bcddf74cac6af4ac5c36ce75550
treecc5f6867bd7c93b153301096d895113ab190bb0b
parent2e591bb1e7f76f31085da154a2dc35718ea70a83
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