Repository navigation
Conversation
The x86-64 Huffman decoding loops used %rbp to hold bits[0], so while they ran %rbp didn't point to a valid frame. Profilers that unwind with frame pointers, such as `perf record --call-graph=fp`, couldn't unwind past these functions, so every sample inside them lost its callers. Set up a standard frame (push %rbp; mov %rsp, %rbp) and keep %rbp intact for the whole function: * bits[0] moves from %rbp to %r8. * ip[0], which used to live in %r8, now lives on the stack. It is loaded into %r15 only around RELOAD_BITS(0). %r15 holds olimit and var[0] elsewhere, and neither is live during RELOAD_BITS(0). * In the 4X2 loop, DECODE stages the 2-byte symbol through %r15 instead of %r8, so %r8 no longer needs to be spilled around the decode step. The CFI is updated to match. The CFA is defined relative to %rbp once the frame is set up, so the per-push .cfi_def_cfa_offset directives are dropped. On exit, the CFA switches back to %rsp after %rbp is popped. Tested on x86-64 with BMI2, using gcc and clang, with and without -fcf-protection: * tests/fuzzer and tests/zstreamtest pass. * The CLI round-trips a range of inputs, levels and block sizes. * gdb backtraces reach main from the prologue, loop body, and epilogue of both loops. * With `perf record --call-graph=fp`, every sample inside the asm loops now unwinds to main. Before this change, none unwound past the leaf. * Decompression speed is unchanged.
pps83
pushed a commit
to pps83/zstd
that referenced
this pull request
Oct 6, 2026
The windows-11-arm runner label now resolves to the windows-11-vs2026-arm64 image (20260924), which ships Visual Studio 2026 and CMake 4.4, but no longer Visual Studio 2022. CMake fails at configure time with "could not find any instance of Visual Studio", so the job fails on every PR opened since 2026-10-01 (e.g. meta#4806, meta#4811, meta#4813). Switch that matrix entry to the "Visual Studio 18 2026" generator. The x64 and Win32 entries run on windows-2022 and are unaffected. Drop "VS2022" from the job name template, which would now be wrong for the ARM64 entry: jobs become "CMake Windows (<entry>)". No branch protection rule requires these checks by name.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The x86-64 Huffman decoding loops used %rbp to hold bits[0], so while they ran %rbp didn't point to a valid frame. Profilers that unwind with frame pointers, such as
perf record --call-graph=fp, couldn't unwind past these functions, so every sample inside them lost its callers.Set up a standard frame (push %rbp; mov %rsp, %rbp) and keep %rbp intact for the whole function:
The CFI is updated to match. The CFA is defined relative to %rbp once the frame is set up, so the per-push .cfi_def_cfa_offset directives are dropped. On exit, the CFA switches back to %rsp after %rbp is popped.
Tested on x86-64 with BMI2, using gcc and clang, with and without -fcf-protection:
perf record --call-graph=fp, every sample inside the asm loops now unwinds to main. Before this change, none unwound past the leaf.zstd -b1e1r silesia/.