Skip to content

Bind C# member calls by receiver type and add new X() calls - #111

Merged
cdobbyn merged 1 commit into
mainfrom
csharp-parity-k7q2
Oct 21, 2026
Merged

cdobbyn merged 1 commit into
mainfrom
csharp-parity-k7q2

Conversation

@cdobbyn

@cdobbyn cdobbyn commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

C# member calls now bind only through the receiver's declared type (params, locals, fields, foreach vars, casts, this/base, one-field chains, inherits walk), and new X() makes a calls edge to the type, as upstream 0.9.92 does (vi5.57, vi5.58, vi5.59). On AutoMapper (513 .cs files) calls edges matching upstream go from 344 to 1403, and on curl and redis graph.json is byte-identical to main, with one confidence_score change on graphify's C# fixture. I ran go test ./..., 7 rounds of upstream fixture comparison and review, and n=9 ABAB benchmarks; tables are in a comment.

@cdobbyn

cdobbyn commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

Benchmark, main e989b75 (mainb) vs this branch 83ad2c5 (csprd). n=9 strict ABAB per tool, binaries with names of equal length, run1.py watchdog, one heavy job at a time. This is the skeptic rerun with the first binary swapped against the earlier session. Median (IQR), exact two-sided Mann-Whitney p.

corpus phase metric main branch delta p
curl cold wall s 0.134 (0.002) 0.135 (0.003) +0.7% 0.543
curl cold peak RSS MB 100.2 101.0 +0.8% 0.778
curl nochange wall s 0.096 0.095 -1.0% 0.470
curl nochange peak RSS MB 71.0 70.8 -0.3% 0.073
redis cold wall s 0.154 0.156 +1.3% 0.350
redis cold peak RSS MB 126.5 126.3 -0.2% 0.880
redis nochange wall s 0.105 0.105 +0.0% 0.678
redis nochange peak RSS MB 87.4 85.8 -1.8% 0.780
graphify cold wall s 0.135 0.134 -0.7% 0.920
graphify cold peak RSS MB 140.2 140.6 +0.3% 0.796
graphify nochange wall s 0.095 0.096 +1.1% 0.696
graphify nochange peak RSS MB 73.9 74.4 +0.7% 0.450
opencv cold wall s 0.719 0.715 -0.6% 0.779
opencv cold peak RSS MB 284.5 284.5 +0.0% 0.985
opencv nochange wall s 0.441 0.438 -0.7% 0.715
opencv nochange peak RSS MB 247.2 247.6 +0.2% 0.073
AutoMapper cold wall s 0.067 (0.001) 0.077 (0.003) +14.9% <0.001
AutoMapper cold peak RSS MB 76.7 83.5 +8.9% <0.001
AutoMapper nochange wall s 0.055 0.061 +10.9% <0.001
AutoMapper nochange peak RSS MB 48.2 51.6 +7.1% <0.001

graph.json size is unchanged on curl (16.4 MB), redis (20.8), graphify (18.0) and opencv (83.4). AutoMapper goes from 6.6 to 7.3 MB: 6603 to 6674 nodes, 11476 to 13360 edges. The AutoMapper cost is the new binding work: calls edges go from 408 to 1788.

Output vs main: curl and redis are byte-identical. graphify changes one edge: calls tests/fixtures/sample.cs DataProcessor.process -> validate, confidence_score 0.5 to 0.85 (C# INFERRED calls now carry 0.85 like upstream). On AutoMapper only calls and references change: calls +1412 / -32, references +504 / -0 (call-site type arguments such as Map<Src, Dst>(...); 396 of the 475 distinct pairs match upstream, and most of the rest are names that upstream sends to a sourceless stub because they are not unique), plus 71 stub nodes for those type arguments.

Parity on AutoMapper vs upstream 0.9.92 calls edges, keyed by (source_file, normalised label): upstream 2592, branch 1427, matching 1403 (main matched 344), upstream-only 1189, branch-only 24. Restricted to edges whose two endpoints exist in both graphs: upstream 1867, branch 1788, matching 1764, upstream-only 103, branch-only 24. The upstream-only rows come from causes outside this PR: nested types (vi5.61), constructor bodies as callers (vi5.127), bare-call resolution (vi5.128), files under #if (vi5.129), and var x = M() return types (byx.46).

Known divergences kept on purpose: upstream classifies test dirs by absolute path (we use the relative path); upstream's Python member-call pass also binds C# calls when the corpus has a .py file (it reads a property as a class); upstream's file-node id can collide with a stub and drop that file's usings; methods whose names differ only in non-word runes (upstream keeps the last one, we bind neither).

Covers vi5.57, vi5.58 and vi5.59: typed receivers (params, locals, fields, foreach, casts, this/base, one-field chains, inherits walk), untyped receivers bind nothing, and new X() calls the type, as upstream 0.9.92 does.
@cdobbyn
cdobbyn force-pushed the csharp-parity-k7q2 branch from 83ad2c5 to 87e0504 Compare October 21, 2026 05:38
@cdobbyn

cdobbyn commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main after #107 to #110 as one squashed commit (87e0504). Conflicts were only the new Result/builder fields and JSON encoders next to #110's JavaRets; both kept. Cache schema is now 24 because #113 uses 23. After the rebase, curl, redis and opencv build byte-identical to main (Java calls from #110 included), graphify differs by the one C# confidence_score, AutoMapper parity with upstream is unchanged (1403 matching calls edges), and go test ./... passes.

@cdobbyn
cdobbyn merged commit daafb9d into main Oct 21, 2026
2 checks passed
@cdobbyn
cdobbyn deleted the csharp-parity-k7q2 branch October 21, 2026 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants