-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[SE-0283] Implement Equatable, Comparable, and Hashable conformance for Tuples #28833
Conversation
@rjmccall I've updated the implementation to have IRGen emit conformance descriptors for the stdlib. Let me know if this is what you had in mind. |
d507263
to
fc5facc
Compare
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.
Yes, this is basically what I was asking for, thank you.
As a general matter, I wonder if it wouldn't be better to just go a step further and make this a conditional conformance for all tuple types. That would be a big request except that you've obviously already figured out how to do some quite sophisticated stuff.
I'll look into doing this conditionally for all tuples to see what work is needed. |
0ec88a1
to
ed9783e
Compare
598d795
to
a6b47dd
Compare
f192891
to
a2519b5
Compare
Currently this initializes a new witness table everytime we need one, but it should be possible to have a single witness table in the runtime. Hmm... |
The conformance descriptor format isn't absolutely important. Fundamentally, we just need something the witness table can point to that uniquely identifies the conformance. It seems to me like we should be able to have one descriptor and one witness table that works for all tuples. |
a2519b5
to
b5ff0fd
Compare
@jckarter Sorry I was being dumb, does this look ok? Single descriptor and witness table now! |
b5ff0fd
to
c1de7fd
Compare
I haven't had time yet to look at this PR in depth, but I hope to soon. Sorry! |
c1de7fd
to
5313bb4
Compare
5313bb4
to
6d29ce7
Compare
@jckarter I've hopefully added backward compatibility for these conformances for both 5.0 and 5.1 runtimes. I'm not too versed with how the compatibility library works, but let me know if I made a mistake or something of the like. The test for compatibility should be exercised through the interpreter test I added in earlier commits, correct? I remember reading something from here: #25030 (comment) |
stdlib/toolchain/Compatibility50/BuiltinProtocolConformances.cpp
Outdated
Show resolved
Hide resolved
6d29ce7
to
04d9fb3
Compare
stdlib/toolchain/Compatibility50/BuiltinProtocolConformances.cpp
Outdated
Show resolved
Hide resolved
04d9fb3
to
4406a47
Compare
Does it make sense to also implement comparable and hashable in this pr, or should those be in separate prs? |
@Azoy It might be easier to review to break them out into their own PRs. Thanks! |
@swift-ci Please test Windows platform |
@Azoy Have you asked for commit access yet? If you have commit access then you ought to be able to trigger CI by yourself. |
All checks have passed. Should we test source compatibility again? |
I would say yes because they failed last time due to the macOS failure. |
@swift-ci Please test source compatibility |
@Azoy, this is fantastic. I guess it's ready to go? |
Should be good to go. Thanks @Azoy ! |
Has an internal crash in clang appeared during development? It seems to have started around the introduction of these changes. The full logs can be seen in https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64/6614/console. The failed assertion seems to be
In the case of the Android ARM32, the error is slightly different and might give someone a clue:
There's some Does someone has any idea what might be going on? |
I found the problematic assembly. It was collapsed by GitHub. Seems that Does anybody know which symbol can be used in front of |
@drodriguez for ARM32 on Android, it looks like it wants |
Thanks for the answer. I found that the Linux AArch64 testing seems to also had failed with a similar error: https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-18.04-aarch64/2177/console. I will try to double check tonight about using the percent sign instead of the at-symbol. |
@Azoy The ELF syntax is |
Looks likely this broke: https://ci.swift.org/job/oss-swift_tools-RA_stdlib-DA_test-device-non_executable/250/ |
Temporary disabled the test here: #34480 |
@Azoy Can you take a look, I expect that the test just needs updating. |
We're also seeing some tests fail with errors about invalid relative offsets in a conformance. I don't know for sure that it was this PR, but the timing is suspicious. I'm trying to get more details. |
@Azoy would it be OK if you reverted this? Another issue we're seeing is that it appears that executables and dylibs that link the compatibility versions of the tuple conformance implementation end up reexporting the I wonder if the issues @tbkka alluded to about invalid conformance addresses might be related to the compatibility libraries as well—if we link the compatibility libraries into a binary, but run with a new runtime that contains the real implementation of tuple conformance, that real implementation needs to take precedence, and the compatibility implementation would be invalid from the host runtime's perspective. Binaries that relies on the compatibility library for backward deployment might need to use a stub function that picks either the compatibility or host runtime version of the symbols to resolve the address of these symbols, instead of referencing the symbols directly. |
Reverted in #34492 |
From: https://forums.swift.org/t/hacking-equatable-conformance-on-void/25975
The tests right now are kind of lackluster, what else can I be testing with this? What else can be improved upon in this implementation? Is there an edge case that I hadn't thought about?
cc: @jckarter @rjmccall