Skip to content

support Go1.27 generic concrete method - #2395

Open
visualfc wants to merge 1 commit into
xgo-dev:mainfrom
visualfc:concrete_method
Open

support Go1.27 generic concrete method#2395
visualfc wants to merge 1 commit into
xgo-dev:mainfrom
visualfc:concrete_method

Conversation

@visualfc

Copy link
Copy Markdown
Collaborator

No description provided.

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: skip generic methods in method-set processing

This is a small, focused change adding guards to skip uninstantiated generic methods when iterating method sets (compiling methods, building itab/ABI interface method tables, collecting runtime-caller targets) and appending a type-arg suffix for instantiated generic method symbols in funcName.

Correctness: Sound. TypeParams() != nil is the correct idiom here — for *types.Signature/*types.Func it is non-nil only for uninstantiated generics, and this matches the codebase convention documented in ssa/decl.go:239 and the existing precedent guard at cl/compile.go:2456. (The tp != nil && tp.Len() > 0 form in ssa/di.go is for *types.Named, a different case — no need to align.)

Safety/Performance: The .Type().(*types.Signature) assertions operate on values guaranteed to be signatures (method-set selections and *types.Func), so they cannot panic. Guards run before the expensive MethodValue resolution, so they are net-positive at compile time. No issues found.

Only findings — low-priority consistency: The new skip guards are silent, while the analogous precedent in the same file (cl/compile.go:2456) carries an explanatory comment. Adding a one-line rationale at each new guard would match local style and prevent a future reader from mistaking the continue for an accidental early-out. See inline comments.

Comment thread cl/compile.go Outdated
Comment thread cl/instr.go Outdated
Comment thread cl/import.go Outdated
Comment thread cl/instr.go Outdated
Comment thread ssa/abitype.go Outdated
@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown

LLGo baseline benchmarks

b94798b28236 | workflow run | long-term charts

Program measurements

Platform Workload File size vs base Build vs base Run vs base
Linux cprintf 19288 B 0 B / +0.0% 259.110 ms -23.25 ms / -8.2% (better) 1.039 ms -29.16 us / -2.7% (better)
Linux cprintf-lto 19120 B 0 B / +0.0% 274.122 ms +1.153 ms / +0.4% (worse) 1.064 ms -1.753 us / -0.2% (better)
Linux fmtprintf 1866208 B -8 B / -0.0004287% (better) 2.197 s -11.31 ms / -0.5% (better) 2.781 ms +3.176 us / +0.1% (worse)
Linux fmtprintf-lto 1779144 B 0 B / +0.0% 11.005 s -90.51 ms / -0.8% (better) 2.682 ms -61.95 us / -2.3% (better)
Linux println 68776 B 0 B / +0.0% 275.773 ms +11.65 ms / +4.4% (worse) 1.342 ms -1.782 us / -0.1% (better)
Linux println-lto 62464 B 0 B / +0.0% 457.187 ms +33.62 ms / +7.9% (worse) 1.335 ms -26.54 us / -1.9% (better)
macOS cprintf 84672 B 0 B / +0.0% 365.449 ms -405.2 ms / -52.6% (better) 2.692 ms -1.381 ms / -33.9% (better)
macOS cprintf-lto 100912 B 0 B / +0.0% 366.396 ms -369.9 ms / -50.2% (better) 2.377 ms -1.356 ms / -36.3% (better)
macOS fmtprintf 1909296 B 0 B / +0.0% 2.568 s -633.9 ms / -19.8% (better) 12.249 ms -1.104 ms / -8.3% (better)
macOS fmtprintf-lto 1626224 B 0 B / +0.0% 14.854 s -1.347 s / -8.3% (better) 6.396 ms +564.8 us / +9.7% (worse)
macOS println 121360 B 0 B / +0.0% 423.440 ms -213.1 ms / -33.5% (better) 3.548 ms -855 us / -19.4% (better)
macOS println-lto 128528 B 0 B / +0.0% 505.312 ms -166.5 ms / -24.8% (better) 3.946 ms -322.8 us / -7.6% (better)
Core language and compiler benchmarks
Platform Benchmark ns/op vs base
Linux BenchmarkLookupPCRandom 9.503 ns/op -0.054 ns/op / -0.6% (better)
Linux BenchmarkMergeCompilerFlags 111.200 ns/op -1.7 ns/op / -1.5% (better)
Linux BenchmarkMergeLinkerFlags 72.830 ns/op -1.24 ns/op / -1.7% (better)
Linux BenchmarkChannelBuffered 28.160 ns/op +0.03 ns/op / +0.1% (worse)
Linux BenchmarkChannelHandoff 18418 ns/op -421 ns/op / -2.2% (better)
Linux BenchmarkDefer 35.700 ns/op +0.54 ns/op / +1.5% (worse)
Linux BenchmarkDirectCall 1.363 ns/op 0 ns/op / +0.0%
Linux BenchmarkGlobalRead 1.364 ns/op 0 ns/op / +0.0%
Linux BenchmarkGlobalWrite 2.179 ns/op 0 ns/op / +0.0%
Linux BenchmarkGoroutine 23935 ns/op -272 ns/op / -1.1% (better)
Linux BenchmarkInterfaceCall 6.820 ns/op +0.001 ns/op / +0.01466% (worse)
Linux BenchmarkRuntimeGetG 1.638 ns/op +0.001 ns/op / +0.1% (worse)
macOS BenchmarkLookupPCRandom 11.250 ns/op -0.15 ns/op / -1.3% (better)
macOS BenchmarkMergeCompilerFlags 107 ns/op -2.8 ns/op / -2.6% (better)
macOS BenchmarkMergeLinkerFlags 70.210 ns/op +3.01 ns/op / +4.5% (worse)
macOS BenchmarkChannelBuffered 22.980 ns/op +1.45 ns/op / +6.7% (worse)
macOS BenchmarkChannelHandoff 6831 ns/op +169 ns/op / +2.5% (worse)
macOS BenchmarkDefer 30.640 ns/op +2.78 ns/op / +10.0% (worse)
macOS BenchmarkDirectCall 1.004 ns/op +0.0102 ns/op / +1.0% (worse)
macOS BenchmarkGlobalRead 1.006 ns/op -0.027 ns/op / -2.6% (better)
macOS BenchmarkGlobalWrite 1.105 ns/op +0.1104 ns/op / +11.1% (worse)
macOS BenchmarkGoroutine 33657 ns/op +8185 ns/op / +32.1% (worse)
macOS BenchmarkInterfaceCall 5.629 ns/op -0.049 ns/op / -0.9% (better)
macOS BenchmarkRuntimeGetG 2.161 ns/op +0.18 ns/op / +9.1% (worse)

Compared with 3e0fdda00db3 measured in the same runner job.

@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 13.33333% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cl/instr.go 33.33% 2 Missing and 2 partials ⚠️
cl/import.go 0.00% 2 Missing and 1 partial ⚠️
cl/compile.go 0.00% 1 Missing and 1 partial ⚠️
internal/genmethod/types.go 0.00% 2 Missing ⚠️
ssa/abitype.go 0.00% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

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.

1 participant