-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[DebugInfo] Ignore noescape bit for all @convention(c) pointers #42189
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
I think that the change looks good; would you mind adding some test cases to the unittests for the demangler/remangler please? |
@compnerd Sure, added! |
A |
@jckarter This was exactly my thought (see SR). However:
Note that the mangling is applied only for the debug info generation, not for the real symbols (similar thing is done for escaping / non-escaping |
All |
@jckarter I feel like trying to open a small can of worms :) Looks like the representation field is a bit abused (and this is why AST function representation and SIL function representation enums overlay – see FIXME there) and therefore non-supported representations could be passed from SIL level down to Please review |
This looks good, thanks! |
@jckarter We cannot do this in ctor apparently :) The reason is quite severe: types are unique. If we'd silently drop noescape bit in the ctor we will create new function type which might be identical to the existing one. So, we'd need to do this in |
Ah, yeah, that makes sense! |
@swift-ci Please test |
@swift-ci Please test source compatibility |
@jckarter Given that all
Are we ok with this? This certainly a source code compatibility break... |
@asl That's strange, passing an escaping function as nonescaping should be allowed. Maybe it's confused by the combination of representation and escapingness change? |
@jckarter I misread the logs. We're having extra diagnostics now, e.g.:
|
@jckarter @BradLarson will you please trigger CI for me? |
@swift-ci Please test |
@swift-ci Please test macOS |
That failure on macOS looks unrelated, let me try it again. |
Hm, I don't see why |
@jckarter I cannot reproduce on arm64-darwin. Just did another rebase of the branch on top of |
@asl The test only applies for x86_64 macOS, can you test in that configuration? |
@jckarter Looks like not easily as |
If it built the x86_64 slice of the runtime and standard library, it'll hopefully work to go into the build dir and do |
Looks like utils/build-script silently filters out everything non-arm64. Anyway, I managed to build necessary stuff by hand and after some plumbing, trying to reproduce & compare with |
Interesting. In
while with this PR:
Note that functions in question are
And in branch we do not have
I'm attaching LLVM IR just in case. It looks like escape => noescape conversion inhibited some specializations |
Ah. I think the mangled name change should be harmless, then, so you can just change the test expectation. Thanks! |
Yes... Though I'm a bit worried in general that this exposes some additional transformations :) |
@jckarter will you please ping the CI? |
@swift-ci Please test |
@asl I agree that exposing the optimizer to new patterns is a concern, but it doesn't seem harmful here. And I've been generally trying to eliminate unnecessary function representation changes from generated SIL, so it's nice that this change helps there. Thanks for fixing this! |
I think that this regressed the Windows build (seems that the CI didnt trigger?) CC: @shahmishal |
Currently @escaping and @NoEscape @convention(c) functions are mangled in the same way: the escaping flag is silently ignored. This cases all kinds of problems and type mismatches when type is reconstructed by a demangler as flag is lost.
Ignore noescape bit in the ctors for
AnyFunctionType
/SILFunctionType
Resolves SR-15871