Auto merge of #137152 - saethlin:bss-const-allocs, r=wesleywiser

Add a .bss-like scheme for encoded const allocs

This check if all bytes are zero feel like it should be too slow, and instead we should have a flag that we track, but that seems hard. Let's see how this perfs first.

Also we can probably stash the "it's all zero actually" flag inside one of the other struct members that's already not using an entire byte. This optimization doesn't fire all that often, so it's possible that by sticking it in the varint length field, this PR actually makes rmeta size worse.
This commit is contained in:
bors
2025-03-13 16:41:22 +00:00
2 changed files with 117 additions and 4 deletions

View File

@@ -802,7 +802,7 @@ impl Align {
}
#[inline]
pub fn bytes(self) -> u64 {
pub const fn bytes(self) -> u64 {
1 << self.pow2
}
@@ -812,7 +812,7 @@ impl Align {
}
#[inline]
pub fn bits(self) -> u64 {
pub const fn bits(self) -> u64 {
self.bytes() * 8
}