-
Notifications
You must be signed in to change notification settings - Fork 10.5k
IRGen: improve DLLStorage computation for Windows #30292
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
This slightly regresses the standard library build (intentionally) while generally improving the build of dispatch, foundation, xctest. Rather than continuing to rely on the short-term hack of special casing the standard library, identify the module where the decl originates from. If the module is the current module, then assume that the symbol need not be imported (static linking does not currently work on Windows anyways). This allows for properly identifying the module where the symbol will be homed. Because we no longer special case the standard library here, a few known metadata types will be incorrectly marked as being imported rather than local. Since linked entities which have `Shared` SILLinkage should be module local, special case them to always be local. Without this the metadata access function is still marked incorrectly. With this computation we now get nearly all the cases correct. Dispatch no longer has to rely on the linker relaxing the import to a local binding. XCTest is also clean. Foundation misses the following case: - `$sSS10FoundationE19_bridgeToObjectiveCAA8NSStringCyF` The regressed cases in swiftCore are: - `$sBi64_WV` - `$sBi8_WV` - `$sBi16_WV` - `$sBi32_WV` - `$sBpWV` - `$syycWV` - `$sBoWV` - `$sBOWV` - `$sBbWV` - `$sytWV`
@swift-ci please clean test |
@swift-ci please test Windows platform |
The Windows JIT regression is known and is not caused by this PR (discussion in #29863). |
Nice! Could we also use this to further tighten the accuracy of when The |
@jckarter hmm, yes, we should be able to do that (though I believe it is outside the scope of this change). Yes, the structural VWT references need to be special cased in the standard library. I'll poke around once more, but, I think that this is a significant leap forward in the accuracy for most libraries and is valuable enough as is, assuming that I didn't miss some silly case and/or have some other error. |
I agree! |
Re-reading your comment, I think that I misunderstood what you had said. The VWT references there are regressions for the standard library. That is we get them computed incorrectly for the standard library. This is an intentional regression in the sense that I know clearly where that has been regressed: https://github.com/apple/swift/pull/30292/files#diff-62e4305d226cedd49d95b3dff4f8b7b8L1845-L1846 would previously simply state that the reference is local for the standard library. Now, we no longer special case the standard library. My desire is to completely remove the special case tracking of the standard library which is ... less than desired. Unfortunately, at the time, it was the most expedient thing to do, and now one must pay down their debts. Having looked at this once more, I now can explain why the VWT issue exists. The |
Thanks for digging deeper. I agree we should minimize special case behavior for the standard library. To me, it seems like it'd be reasonable to have |
This slightly regresses the standard library build (intentionally) while
generally improving the build of dispatch, foundation, xctest.
Rather than continuing to rely on the short-term hack of special casing
the standard library, identify the module where the decl originates
from. If the module is the current module, then assume that the symbol
need not be imported (static linking does not currently work on Windows
anyways). This allows for properly identifying the module where the
symbol will be homed.
Because we no longer special case the standard library here, a few known
metadata types will be incorrectly marked as being imported rather than
local.
Since linked entities which have
Shared
SILLinkage should be modulelocal, special case them to always be local. Without this the metadata
access function is still marked incorrectly.
With this computation we now get nearly all the cases correct. Dispatch
no longer has to rely on the linker relaxing the import to a local
binding. XCTest is also clean. Foundation misses the following case:
$sSS10FoundationE19_bridgeToObjectiveCAA8NSStringCyF
The regressed cases in swiftCore are:
$sBi64_WV
$sBi8_WV
$sBi16_WV
$sBi32_WV
$sBpWV
$syycWV
$sBoWV
$sBOWV
$sBbWV
$sytWV
Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.
Resolves SR-NNNN.