Repository navigation
fix(parquet/metadata): stop bloom filter asm clobbering the frame pointer - #1379
Merged
Merged
Conversation
…nter
go vet reported two classes of issues in the c2goasm-generated bloom
filter block kernels:
- framepointer: every kernel loaded its constant table into BP without
saving it, so frame-pointer unwinders (execution tracer, profilers,
perf/eBPF) observed a garbage frame chain while the kernel ran. The
constants are now addressed through R11, which no kernel otherwise
uses. The _check_block kernels never read the table, so their dead
LEAQ is dropped. The raw-encoded [rbp] instructions are replaced with
the equivalent Go mnemonics (VPMULLD/VPBROADCASTD/VMOVDQA, MOVO/PMULLD).
- asmdecl: _check_block_{avx2,sse4} declared a 32-byte argument frame and
stored the bool result with MOVQ. They now declare $0-25 and use MOVB.
The files are marked as hand-edited so the changes are re-applied if
they are ever regenerated.
lidavidm
approved these changes
Oct 20, 2026
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.
Rationale for this change
go vet ./parquet/metadata/reports 12 findings in the c2goasm-generated bloom filter block kernels (bloom_filter_block_{avx2,sse4}_amd64.s):LEAQ LCDATAx<>(SB), BPin a frameless function, using BP as the constant-table pointer without saving it. While the kernel runs, any frame-pointer unwinder (Go's execution tracer, profilers, perf/eBPF) walks a garbage frame chain._check_block_{avx2,sse4}return aboolbut declared a$0-32arg frame and stored the result withMOVQ. This is harmless in practice (the extra bytes land in padding) but incorrect.What changes are included in this PR?
Hand edits to the two
.sfiles. c2goasm is unmaintained, so the header now says the files are hand-edited:_insert_block_*/_insert_bulk_*: load the constant table into R11 (no kernel uses it otherwise) instead of BP. The raw-encoded[rbp]instructions become the equivalent Go mnemonics (VPMULLD,VPBROADCASTD,VMOVDQA;MOVO,PMULLD).go tool objdumpshows the same opcodes as before; only the base register changed._check_block_*: these never read the table, so the deadLEAQ … BPis removed. The frame is now$0-25and the result is stored withMOVB.Are these changes tested?
go vet ./parquet/metadata/is now clean (previously 12 findings).go test ./parquet/metadata/ ./parquet/file/passes on the AVX2 path and withGODEBUG=cpu.avx2=off. Under that settingBenchmarkFilterInsertBulkgoes from ~14 to ~22 ns, which confirms the SSE4 kernels are the ones running.Are there any user-facing changes?
No.