Repository navigation
refactor(pipeline): port lsp_resolve from C to Zig, drop dead vmem - #170
Merged
Merged
Conversation
lsp_resolve.h held the LSP-override join as static inline C functions. The Zig pipeline reached them through translate-c, except cbm_pipeline_lsp_target_node: its C11 atomic counters cannot be translated, so lsp_resolve_shim.c compiled that one function for the Zig side, and the counters were defined in pass_parallel.zig. The logic now lives in src/pipeline/lsp_resolve.zig: - cbm_pipeline_find_lsp_resolution, cbm_pipeline_lsp_allow_tail_match and cbm_pipeline_lsp_target_node are exported, because tests/test_parallel.c calls them; lsp_resolve.h now only declares them and keeps CBM_LSP_CONFIDENCE_FLOOR. - The CALL_REFERENCE join (RefIndex, joinLspReference, referenceProps, referenceFallbackAllowed), the row counts and nodeIsCallableTarget are Zig-only and imported by pass_parallel.zig and pipeline_incremental.zig. - The tail-match cost counters move here as std.atomic.Value(u64). The matching rules, confidence comparisons, sort order and edge property format are unchanged. lsp_resolve_shim.c is removed. src/foundation/vmem.c, vmem.h and tests/test_vmem.c are removed: no build list compiles them and nothing includes vmem.h (mem.h replaced it). Signed-off-by: ata-sesli <atasesli@protonmail.com>
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.
What does this PR do?
Finishes the pipeline port:
lsp_resolve.hwas the last pipeline module whose logic was still C. Also removes the unusedvmemallocator.Before:
src/pipeline/lsp_resolve.hheld the LSP-override join (the code that decides which LSP-resolved calls and callable references becomeCALLS/CALL_REFERENCEedges) asstatic inlineC functions. The Zig pipeline used them through translate-c. One function,cbm_pipeline_lsp_target_node, uses C11 atomics, which translate-c cannot express. Solsp_resolve_shim.ccompiled that function separately, andpass_parallel.zigdefined its two counters.After: the logic lives in
src/pipeline/lsp_resolve.zig.tests/test_parallel.ccalls them:cbm_pipeline_find_lsp_resolution,cbm_pipeline_lsp_allow_tail_matchandcbm_pipeline_lsp_target_node.lsp_resolve.hnow only declares those three and keepsCBM_LSP_CONFIDENCE_FLOOR.cbm_zig.zigchecks their signatures against the header.CALL_REFERENCEjoin, the row counts andnodeIsCallableTargetare Zig-only.pass_parallel.zigandpipeline_incremental.zigimport them directly.std.atomic.Value(u64). They still use relaxed ordering and are still logged asparallel.resolve.scan_cost.lsp_resolve_shim.cis deleted.Behavior is unchanged:
qsortorder of reference rows, including the pointer tie-break.<project>.<qn>and#macro.snprintfedge-property format (%.2f).Dead code removed:
src/foundation/vmem.c,vmem.handtests/test_vmem.c. No build list compiles them and nothing includesvmem.h.mem.hreplaced it.Verification (local)
libcbm_zigbuilt (ReleaseFast) for native macOS arm64,x86_64-linux-gnuandx86_64-windows-gnu(the last two with Zova). The native library exports the three functions.tests/test_parallel.candlsp_resolve.hpassclang -fsyntax-onlyagainst the new header.zig fmt --check src build.zigandscripts/check-build-sources.shpass.Checklist
git commit -s) — required, CI rejectsunsigned commits (DCO, see CONTRIBUTING.md)
make -f Makefile.cbm test) — not run locally, left to CImake -f Makefile.cbm lint-ci) — not run locally, left to CItest_parallel.cLSP-resolution tests cover the exported functions