-
Notifications
You must be signed in to change notification settings - Fork 46
fix(cl): fill cross-package unexported method Ifn/Tfn so itab is complete #1560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @luoliwoshang, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces two significant compiler fixes: one addressing a nil pointer dereference when calling interface methods on types with promoted, cross-package unexported embedded methods, and another correcting Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request contains two main changes: a fix for itab generation for promoted embedded methods, and a fix for a float-to-uint conversion issue (issue #1538). The itab generation fix is well-implemented, and the associated refactoring of the ABI type system in ssa/abitype.go is a significant improvement. The regression test is also comprehensive. However, bundling the unrelated fix for issue #1538 makes this pull request difficult to review and understand. It's a strong convention to have one pull request address one concern. This helps with reviewability, testing, and maintaining a clean commit history. I highly recommend splitting this PR into two separate ones. My review comments are focused on the current state of the code.
ab67963 to
3944c0a
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1560 +/- ##
==========================================
- Coverage 91.01% 91.01% -0.01%
==========================================
Files 45 45
Lines 11971 11960 -11
==========================================
- Hits 10896 10885 -11
Misses 899 899
Partials 176 176 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
50c5e3d to
3bcc87d
Compare
Code Review SummaryThis PR correctly fixes the itab generation bug for promoted embedded methods. The fix is well-targeted: removing the flawed Strengths:
Minor suggestions:
Overall, this is a correct and focused bug fix. |
359eea3 to
9a2cc20
Compare
5309b43 to
2849944
Compare
2849944 to
d2adf5d
Compare
|
对于 Go 官方编译器,结构体的嵌入类型如果位于不同包,未导出的的 method ifn/tfn 始终为 -1 。这块可以分析一下是否还有其他实现原因。 |
Fixed #1559
Summary
fun[0]=0and causing interface calls to jump to a null pointer. NowIfn/Tfn are always emitted, so the itab is complete.
_demo/go/ifaceprom-1599(self-contained foo package) that embeds a foreignGameand asserts it implements the foreign interface, covering the crash path.cl/_testgo/abimethod/out.llto align with the corrected method metadata (no skipped Ifn/Tfn).Root Cause
abiUncommonMethods), for unexported methods from another package,skipfnset Ifn/Tfn to nil. The method name/type still matched the interface, but the pointer was nil.NewItabmatched the method but received a nil Ifn, setfun[0]=0, and marked the itab as “not implemented”; interface calls then dereferenced a null pointer and crashed.Fix
Tests
_demo/go:llgo run ./ifaceprom-1599