Repository navigation
Conversation
…Data#2061) Overloads that share a base QN (Java/C#/C++/Kotlin/Swift/Scala/ObjC) merge into one graph node today, and that node collects the CALLS of every overload. The agreed cure is one signature-qualified callable identity for all overloading languages: callable_qn := base_qn [<tparams>] (params) [cvref] This change lands the plumbing with every language still at CBM_CALLABLE_ID_NONE, so the graph is byte-identical; each language is switched on later in its own change (with its index-format bump). - internal/cbm/callable_sig.{c,h}: the per-language mode side table (NONE|TYPED|LABELED_TYPED|LABELED|ARITY; kept out of CBMLangSpec like cbm_string_dispatch_suffixes, since ~160 positional rows would otherwise all need the member under -Wmissing-field-initializers), the shared builder cbm_callable_sig[_mode] for the def and the call-scope QN, and the inverse cbm_qn_callable_base_len[_named]. Suffix contract: no '.', '::' or '->'; whitespace-normalized; comments/annotations/attributes dropped; qualified types keep their last segment; '->' spelled '=>'; variadic '[]' (Java) / '~'; C++ top-level cv dropped, arrays decay, cvref kept; <= 200 bytes, longer ones keep whole leading entries and end in '#<fnv1a64 of the full suffix>)'. The builder is iterative (cursor walk, bounded declarator loop) and self-checks against the inverse. - The inverse is anchored to the node's bare name wherever the name is known: real QNs already end in ')' without being callables (a Java field whose name is its declarator `X = f()`, make `$(VAR)` targets), and only the anchor makes the inverse exact on them. - Leaf splitters strip a suffix first (no-op today): registry by-name key (indexed by the bare name for a suffixed callable), cbm_lsp_bare_segment, cbm_pipeline_qn_class_method_tail, pxc_last_component, pxc_qn_leaf, go_index_visit_node, collect_prod_defs, sg_qn_prefix_len. - New unused fields: CBMDefinition.qn_sig_off, CBMResolvedCall.callee_sig (relocated by result compaction), CBMRegisteredFunc.sig, CBMLSPDef.sig. The lsp_surface codec is unchanged (no format bump in this change). - get_code_snippet and trace_path gain base-QN tiers (cbm_store_find_nodes_by_qn_base) that find nothing until suffixes exist. - store: cbm_store_find_nodes_by_qn_suffix built its LIKE pattern in a 512-byte buffer (a long suffix was truncated into a pattern that matched nothing) and did not escape '_'/'%' (`my_func` also matched `myXfunc`). The pattern is now heap-built, escaped, and matched with ESCAPE '\'. Proof: full sorted node+edge+lsp_surface dumps are byte-identical before and after on 7 corpora (this repo, elasticsearch libs, Exposed, dotnet System.Linq, System.Collections, coreclr/gc, a C corpus). Refs DeusData#2061 Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Enable typed, labeled Swift callable identities on the shared DeusData#2061 plumbing. Resolve calls by compatible labels, defaulted parameters, and trailing closures; retain all compatible overload edges with candidate counts. Cover registry, pipeline, and signature behavior. Refs DeusData#2061 Signed-off-by: DavidHLP <lysf15520112973@163.com>
Signed-off-by: DavidHLP <lysf15520112973@163.com>
Force the parallel call pass on a Swift fixture and assert both label-compatible type overloads retain CALLS edges with the ambiguity count. Refs DeusData#2061 Signed-off-by: DavidHLP <lysf15520112973@163.com>
Signed-off-by: DavidHLP <lysf15520112973@163.com>
Signed-off-by: Andrew Studnicky <a.j.studnicky@gmail.com>
A Swift call that shares its bare name with project symbols but matches none of their overloads was handled differently by the two resolvers: the parallel path cleared the bare-name match and fell through as unresolved (keeping each resolver's empty-resolution service fallbacks), while the sequential path dropped the call outright. Skip the bare-name registry bind on the sequential path too — it would bind a wrong overload — and continue as unresolved, so count < 0 behaves exactly like any other unresolved call on each resolver. Pipeline regressions pin the global-fetch fallback (DeusData#856) on both paths: the incompatible local overload gets no wrong CALLS edge, and the URL call keeps its HTTP_CALLS edge. The route-registration fallback differs between the paths on main (sequential additionally requires a '/'-leading first argument); that pre-existing divergence is out of scope here. Refs DeusData#2061 Signed-off-by: DavidHLP <lysf15520112973@163.com>
Signed-off-by: DavidHLP <lysf15520112973@163.com>
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
Signed-off-by: DavidHLP <lysf15520112973@163.com>
Signed-off-by: DavidHLP <lysf15520112973@163.com>
3441da4 to
5538355
Compare
Signed-off-by: DavidHLP <lysf15520112973@163.com>
|
Thank you for the detailed status update and for clearly distinguishing the actual PR head from unpublished work and unverified results. The changed-file scope includes callable identity, resolution and persisted metadata, so we need more time for a complete review together with the parent change. This remains queued for deeper review; this comment is not an approval or a request for another routine rebase. The queue is full, and we appreciate your patience and the care taken to document the remaining work. |
Swift-scope checkpoint for DeusData#2061: capture bounded trailing-closure labels, match Swift overload candidates conservatively, and cover extraction, registry, compact/spill, serial, parallel, and incremental behavior. Validation: ASan passed on the combined WIP source only; this A-only checkpoint has not been independently verified. GCC TSan, smoke, and memory gates remain failed/open. This commit is a scope checkpoint, not acceptance. Signed-off-by: David HLP <lysf15520112973@163.com>
Signed-off-by: David HLP <lysf15520112973@163.com>
Signed-off-by: David HLP <lysf15520112973@163.com>
Signed-off-by: David HLP <lysf15520112973@163.com>
Signed-off-by: David HLP <lysf15520112973@163.com>
Signed-off-by: David HLP <lysf15520112973@163.com>
Signed-off-by: David HLP <lysf15520112973@163.com>
4dbfd27 to
eea3143
Compare
Signed-off-by: DavidHLP <lysf15520112973@163.com>
Signed-off-by: DavidHLP <lysf15520112973@163.com>
Signed-off-by: DavidHLP <lysf15520112973@163.com>
Signed-off-by: DavidHLP <lysf15520112973@163.com>
Signed-off-by: DavidHLP <lysf15520112973@163.com>
Signed-off-by: DavidHLP <lysf15520112973@163.com>
Signed-off-by: DavidHLP <lysf15520112973@163.com>
Signed-off-by: DavidHLP <lysf15520112973@163.com>
1a94454 to
caa4d0c
Compare
Signed-off-by: DavidHLP <lysf15520112973@163.com>
Signed-off-by: DavidHLP <lysf15520112973@163.com>
…eat/issue-2061-swift-identity
Signed-off-by: DavidHLP <lysf15520112973@163.com>
Signed-off-by: DavidHLP <lysf15520112973@163.com>
Signed-off-by: DavidHLP <lysf15520112973@163.com>
Preserve Swift identity and upstream image migration coverage. Advance the combined index format to 6 so pre-merge format-5 indexes also rebuild invented image hosts. Refs DeusData#2061. Signed-off-by: DavidHLP <lysf15520112973@163.com>
|
Thanks for the Swift identity update and for distinguishing current-head checks from earlier implementation validation. I have read your request for feedback on identity spelling and the migration boundary; those decisions remain on the maintainer side. Please hold off on further routine rebases while that review is pending. |
Brings the branch up to date with main (a222715) so the Swift initializer fix is reviewed and tested against the current tree. No conflicts. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Follow-up to the review of DeusData#2395 (issue DeusData#2379). Making init/deinit Method nodes gives every type an `init` target, and the short-name registry strategies then bound initializer calls to whichever `init` was nearest. On Alamofire (bda9ed57) all 8 new CALLS edges into an initializer were false, and so were the 40 new USAGE edges. - Name init/deinit in one Swift-gated place, cbm_resolve_func_name; resolve_method_name delegates there. The language-agnostic func_name_node no longer special-cases the node kinds (the Slang grammar has an init_declaration too). - super.init(...) is emitted as <Superclass>.init, from the first entry of the enclosing class's inheritance clause. The class node is carried by the unified walk (enclosing_class_node, saved and restored with the other frame state) instead of found by climbing parents. Without a clause, or with an entry that does not read as a type name, there is no call. - self.init(...) forms no call. Initializer overloads share one node, so the only possible edge is a self-loop, and that is false whenever the overload it delegates to lives outside the project. - T.init(...) calls are flagged is_method, and Swift joins the weak-member guard in pass_calls.c and pass_parallel.c (in lockstep), so only qualified, same-module or import placements survive. No other Swift call carries the flag. - init and deinit are Swift keywords for cbm_is_keyword, so references such as .init(...) and Foo.init are not usages resolved by name. Tests: the exact CALLS set for the DeusData#2379 reproduction plus initializer delegation in a SwiftPM package, through the sequential and the parallel resolver; extraction tests for the superclass rewrite, the no-superclass and lower-case cases, the scope of the call flag and init references. Review nits: renamed the overload test, removed the stacked helper comment. Alamofire, main / PR head / this commit: CALLS 5472 / 5487 / 5485; CALLS into an initializer 0 / 8 (all false) / 6 (all superclass initializers); USAGE into an initializer 0 / 40 / 0. Co-authored-by: Andrew Studnicky <a.j.studnicky@gmail.com> Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thank you for the Swift identity measurements and the migration questions. Those decisions remain on our side; please continue to hold off on routine rebases while that review is pending. Sorry for the delay—I’ll follow up soon. |
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
DeusData
left a comment
There was a problem hiding this comment.
Thank you, @DavidHLP, for carrying the Swift identity on top of #2342 exactly as we proposed on #2061, for your patience while we held the spelling and migration questions on our side, and for the care in this branch. Keeping the selector uncapped and separate from the bounded identity, carrying it through serial, parallel and incremental indexing, and filtering candidates before the output limit are all the right calls. Here are our decisions on the questions you asked, and what we need before this can land. The hold on updates is lifted: please bring the branch up to current main (merging main in is fine).
We built your current head (4885230) and indexed Alamofire (bda9ed57) with it. The core fix works: on the #2061 repro, work(flag:Bool) and work(name:String) are separate nodes, onlyCallsOverloadB reaches only work(name:String), and the fake path to target() is gone. On Alamofire, 74 overload sets that were one node each are split into 404 nodes, including all 13 Session.upload overloads, and repeated runs give an identical graph.
-
Identity spelling. Please keep the static/class and async markers and the explicit =>Return. They separate real Swift overloads: Alamofire's three encode(_:any Encodable) differ only in their return type. For qualified types, please use the last segment, as in the #2342 contract, instead of / paths. Two declarations that differ only in the scope of a same-named parameter type then stay one node, as they are on main today. That case is rare, and it keeps Swift QNs consistent with the other languages. One detail we will confirm separately: associated types of a generic parameter in a where-requirement (for example where T.Element == Int). Please keep your current spelling for that one case until we follow up on it.
-
Keep the receiver's type in charge. The label block in resolve_single_call (and its twin in pass_parallel.c) runs before the registry's receiver-typed strategies and returns early, so the label shape can override the receiver's declared type. On Alamofire, swift_labels resolves 3,650 CALLS while field_type_hint resolutions fell from 884 to 1 compared with main at the time. In Tests/CachedResponseHandlerTests.swift:41, session is a Session, but session.request(.default) resolves to DataResponsePublisher.Inner.request(_:Subscribers/Demand) with candidates:1. That one pattern adds 175 edges from tests to the Combine Inner.request methods, the same kind of fake caller #2061 is about. Calls on standard-library values get bound too: output.sorted() on a [String] in URLEncodedFormEncoder.swift:1076 points at HTTPHeaders.sorted(). Please apply the label and arity filter inside the receiver-typed candidates rather than in front of them, and leave a call unresolved when the receiver is a known non-project type. A regression test with a typed receiver whose method shares its label shape with an unrelated class would pin this.
-
Chained calls with trailing closures. Some calls that main resolves are dropped, for example session.request(.default).responseDecodable(of:) { ... } (Tests/SessionTests.swift:1632) and session.streamRequest(...).responseStream { ... } (Tests/DataStreamTests.swift:582). These are common Swift idioms, so a test for each would be very welcome.
-
Language-neutral names for the new fields. CBMDefinition and CBMCall are shared by every language, and Kotlin, Scala and C# will need default-argument and trailing-lambda matching when their identity changes land. Please give the new struct fields and the persisted property keys neutral names (for example param_default_mask, param_count, call_selector and trailing_closure_*), so those changes can reuse them.
-
Index format 5. main is at index format 4 (#1913, receiver-qualified Go methods), so this change becomes format 5 with a single history entry. The format-6 step and the format-5 image migration test cover a state that only existed on this branch (main already stopped inventing image hosts in format 3), so please drop both. When you update the branch you will see conflicts in pass_calls.c (main now resolves through cbm_registry_resolve_call_scoped), pass_definitions.c and pass_parallel.c (main reworked the def-properties sizing into per-field helpers, so the selector becomes one more term there, and registration now goes through cbm_registry_add_lang_in_module), pipeline_incremental.c, pipeline.h and store.h.
-
Initializers. #2395 is about to land and makes Swift init and deinit callable definitions (Box.init becomes a Method node). Because the identity applies to every callable, your branch will give them signature QNs too, for example Box.init(name:String), and Box.deinit() under the zero-argument rule, which is what we want. Please update the #2395 tests that look up the unsuffixed Box.init and Deinitable.deinit definitions, and add tests where two init overloads stay separate nodes, a super.init call reaches the matching Base.init overload, and an external UIViewController.init(nibName:bundle:) with a label-compatible project init forms no edge. #2395 makes self.init form no edge because overloads used to share one node; we will revisit that separately once your change is in, so please leave it as it is.
-
Three smaller points from reading the code:
a. When the signature cannot be built, extract_func_def, push_method_def and compute_func_qn now return without a definition or QN. Please fall back to the plain base QN instead, so a definition is never lost.
b. cbm_service_pattern_match now strips a callable suffix for every language with cbm_qn_callable_base_len. Other languages' QNs can end in ')' for other reasons, so please use the name-anchored form or limit it to Swift.
c. cbm_registry_swift_candidates scans the whole same-name bucket and allocates on every call. With initializers in the graph, init becomes by far the largest Swift bucket, so the cost grows with initializers times calls. Please look up the named type's overloads directly when the call has a type receiver, and drop a small Swift fixture into tests/fixtures/complexity/ so the complexity suite covers it (no test code change is needed there).
Before merging we will run a Swift call-graph census on the updated branch ourselves (Alamofire, one larger Swift project and a non-Swift control), so you do not need to produce those numbers.
To be clear about what is already good here: outside the session.request cluster, a random sample of call sites whose target changed came out better with your branch than with main (3 fixed, none broken, the rest wrong either way), and most of the 372 calls that only your branch resolves are correct, for example Interceptor(adapter:retrier:) and self.state.write. So the label matching itself is a real gain; it just must not override the receiver.
Thank you again for the very careful work on this, and sorry it took us a while to come back with the decisions.
Keep receiver types ahead of overload labels, preserve chained trailing closures, and index typed overload buckets directly. Use neutral call metadata, retain base identities on signature failure, and publish index format 5. Preserve current main registration and properties sizing. Signed-off-by: DavidHLP <lysf15520112973@163.com>
…ritance Signed-off-by: DavidHLP <lysf15520112973@163.com>
Signed-off-by: DavidHLP <lysf15520112973@163.com>
|
Following up on your review: I have addressed the requested contributor-side changes at
Validation on this PR head: 196 focused tests passed under ASan/UBSan with The local full clang-tidy sweep still reports pre-existing warnings reproduced on main; I have not changed its thresholds or suppressions. Other local full-test problems were reproduced against main's implementations and isolated in #2809, rather than added to this Swift PR. Those findings are now tracked in #2814 for a maintainer decision, with #2809 retained as a draft candidate. Its full-test results are not being presented as validation of this PR's head. I believe the requested code changes are complete and this is ready for your Swift call-graph census and final review. As you specified, the census of Alamofire, a larger Swift project, and a non-Swift control remains on the maintainer side. |
Summary
Refs #2061. Enable declaration signatures for Swift callable identities while keeping bare node names and an uncapped call selector.
where T.Elementcase retains its existing spelling pending the maintainer's follow-up.selector_param_countis separate from the existingparam_countcomplexity metric.Integration
Merged current main at
8530c8cd1c1ac8e1e3d2962bc213a8c9025fea0a, retaining scoped resolution, module-aware registration, and per-field property sizing.The branch also integrates the pending #2395 head (
b5b16e092c8676a8b1eb645d1ea7cf7846274efb) to exercise lifecycle compatibility. Its tests now use signature QNs. The graph tests distinguish initializer overloads, select the matchingBase.init(name:), and refuse an externalUIViewController.init(nibName:bundle:)despite a label-compatible project initializer.self.initretains #2395's no-edge policy.Validation
AI assistance: This update was prepared with an AI agent acting on behalf of DavidHLP.
debefaff, the canonical runner's focused selection passed 196 tests with ASan/UBSan andUBSAN_OPTIONS=halt_on_error=1. This runs all callable-signature, registry, index-format, and complexity tests plus the Swift extraction, pipeline, known-class, and MCP cases. The separate full registry run passed 112 tests; these counts overlap.git diff --checkpassed. The earlier 2.22 diagnostics were a tool-version mismatch. The default full clang-tidy sweep still reports existing warnings, reproduced on main; no suppression or threshold was changed.8e91d3fecompleted Linux, macOS, Windows, TSan, and lint successfully. Ondebefaff, Linux, Windows, TSan, and lint have passed; macOS is still queued. No failing check has been observed on the current head.Local full-test investigation
The remaining environment and empty-input fixes are isolated in #2809, based on main
8530c8cd:free(NULL)before mimalloc initialization, crashing the production binary beforemain. The follow-up backports the upstream mimalloc fix and adds an ELF pre-initialization regression. It also refreshes the three changed vendored-source checksums.The follow-up branch's final canonical entry reached
All tests passedwith strict UBSan, including all enabled production guards. Its unit phase reported 9,802 passed, 0 failed, and 10 platform skips; a transient TLS error skipped the incremental fixture setup. A separate rerun of that suite with the same final binary passed all 164 tests, bringing the final binary's total to 9,966. Final-code CI lint and the vendored integrity check also passed. These full results belong to #2809, rather than this Swift head.The maintainer's requested Swift call-graph census and final review remain pending.