-
Notifications
You must be signed in to change notification settings - Fork 951
transform (LowerInterfaces): link-time type renaming results in type errors #2197
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
Comments
Does this fix it? #1898 |
Yes. Merging #1898 into the asyncify branch fixes the problem. |
Interesting. While it does fix the small test case, it didn't appear to fix effectively the same issue in a larger codebase:
(The compiler building the above actually is more than just |
@dgryski If you cannot share the code, can you try to identify which pass is introducing the type error?
The passes are all run in |
Yes, I'll try to isolate this bug today. |
You might also want to try #2202. There is a chance it fixes this bug as a side effect. |
@aykevl Merging the
Allows our codebase to build and pass tests! Thanks for all your great work on this. (Now to get all these in-flight PRs merged...) |
Okay, I am going to close this as a duplicate of #1887 |
Originally, the TinyGo frontend worked by compiling and dumping all used functions and types into a single LLVM module.
This lead to a nice property in the IR: every Go type corresponded to exactly one LLVM type.
However, in #1612 we switched to building each package independently and then linking them together.
Now that we link LLVM modules together, it is possible to have a Go type map to multiple LLVM types - one from each package that uses the type. Most of the time, the module linker can merge the types. However, it seems unable to merge self-referencing types (or at least I think that is the unmerged scenario?). When the unmerged types meet, the linker adds bitcasts to convert between them.
As a result of this renaming process, different implementations of an interface may use different-but-equivalent LLVM types. The interface lowering pass does not handle this, so it can create type errors.
The text was updated successfully, but these errors were encountered: