-
Notifications
You must be signed in to change notification settings - Fork 10.6k
IRGen: fix swifterror attribute mismatch for WebAssembly
#39359
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
Conversation
|
@kateinoigakukun I'm following your previous changes and comments here. I hope the description makes sense. Do you think there's a way to add any tests for this, or will tests require the driver change to be merged first to enable testing the WASI/Wasm triple? |
|
@swift-ci please smoke test |
|
@MaxDesiatov IRGen things can be tested without the driver change. (But we need to fix the current CI failure at first. Now I'm working on it) |
|
@kateinoigakukun now that community CI failure is fixed, how do we set |
|
@swift-ci please smoke test |
|
(EDIT: Re-running Windows tests due to an unrelated error) |
DougGregor
left a comment
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.
Can you add an IRGen test to verify that the extra parameter is there for wasm?
| // This mismatch of attributes would be issue when lowering to WebAssembly. | ||
| // While lowering, LLVM counts how many dummy params are necessary to match | ||
| // callee and caller signature. So we need to add them correctly. | ||
| if (functionName == "swift_willThrow") { |
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.
Could we model this with a flag in the RuntimeFunctions.def DSL? The specific function name check feels brittle.
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.
This would require some refinement of such DSL, right? Currently it doesn't allow setting attributes on parameters. What would be the best way to specify these attributes in RuntimeFunctions.def then?
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.
Sorry, I missed your reply in my flood of GitHub notifications. I think we can do this refactoring, but it shouldn't hold up this PR. Re-running testing and switching to "accept", sorry.
|
@swift-ci please test Windows |
|
@swift-ci please test |
this macOS failure is related I guess? @kateinoigakukun have you seen this error before? |
|
Hmm weird. I perhaps missed somewhere that calls the function. Let me investigate |
6733a8c to
576434d
Compare
|
@swift-ci please test |
576434d to
950792a
Compare
|
@swift-ci please test |
|
OK, I forgot that swifterror is not supported on x86. I've fixed it and CI is now green ✅ |
On WebAssembly, tail optional arguments are not allowed because Wasm requires callee and caller signature to be the same. So LLVM adds dummy arguments for
swiftselfandswifterror. If there isswiftselfbut is noswifterrorin a swiftcc function or invocation, then LLVM adds dummyswifterrorparameter or argument. To count up how many dummy arguments should be added, we need to mark it asswifterroreven though it's not in register.Related to SR-9307.