-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[stdlib][SR-2239] Refactor AAPCS64 variable argument list support. #21237
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
@drodriguez This looks really good and the refactoring is more than welcome. I don't have the time or access to hardware to test changes on platforms other than AArch64/Linux. This was the reason for the focus of the original PR to only AArch64/Linux. If this PR can address the issues raised by @compnerd and @rjmccall in the previous PR and allow for support of more platforms then this is absolutely awesome. |
I think it's a good idea because it helps to immediately identify a common source of problems in porting, but you can absolutely do it in a follow-up. |
✅ All checks and tests have passed on AArch64/Linux. |
To be clear, we didn't expect that you would do that kind of testing. The goal is to (1) get your port working (2) without harming any existing ports while (3) trying to keep the code maintainable and (4) setting the stage to make future ports easier. One of the advantages of |
@swift-ci Please test. |
Build failed |
Build failed |
I will have a look at those errors (probably) on Monday. I must have screw up the logic and write the opposite of what I needed. |
219c499
to
d0cf4d3
Compare
Hopefully fixed. x86-64 va_list is a struct, it should have gone in the last group. Tried it against my Linux x86-64 and passes the tests. |
[just running tests, not reviewing] @swift-ci Please test |
Build failed |
Build failed |
I will try to figure out that failure in Foundation in Linux today. |
I cannot reproduce the segfault in my machine (obviously). From reading the logs it seems to fail in |
It does seem like TestXMLDocument.test_xpath just timed out, which seems like a weird result for a varargs bug. Let's try two ways of finding this: @swift-ci Please test Linux |
@swift-ci Please asan test |
I don't see anything obviously wrong in your refactoring either, although John (or you, or Neil) probably would have already spotted if something were clearly off. |
(ASan test did get queued; it's just waiting for a macOS executor.) |
This refactoring uses large portions of the already existing code for x86_64 and s390 to implement AAPCS64 __VaListBuilder. The parts where each implementation differ are the x86_64 header, and the order of the general and vector registers. The changes also addresses many of the request from the reviewers in swiftlang#20862 which were not addressed originally, like the reuse of the already existing code, and the generalizations for the code to be useful for platforms different than Linux (Android, for example).
d0cf4d3
to
7cfaf9f
Compare
@rjmccall, @jrose-apple I was hoping to get this ball moving again, if possible. I have rebased the changes into a recent master to avoid merge problems (there was no problem), and I will love for this to get into 5.0, if possible (since the previous version was hold). @rjmccall: I tried to implement |
@swift-ci Please asan test |
@swift-ci Please test |
I'll let John respond; I think he's the primary reviewer at this point. |
Build failed |
Build failed |
Hmm. This seems to be a layering problem, since for some reason |
Not completely unreasonable, and it gives me an idea of what can be done. I will check if the In any case, I consider this refactor should be independent from those changes. If you disagree, and you want the change in |
No, I think it's fine to commit this. We probably wouldn't dream of taking that refactor for 5 anyway, whereas this might have a shot. |
We are rapidly running out of time for this kind of change in Swift 5.0. John, if you really think this might be safe enough for 5.0, we should get it merged to master ASAP and start the discussion of whether to take it for 5.0. |
Alright, let me re-run tests just for completeness. @swift-ci Please test. |
Merged. Daniel, do you want to open a 5.0 PR? You should do that relatively soon if you want it to actually be merged. |
I will work on it tomorrow morning. Thanks for merging! |
Use the already existing support for x86_64 and s390 to implement AAPCS64 __VaListBuilder. The parts where each implementation differ are the x86_64 header, and the order of the general and vector registers. This change brings in one commit the changes introduced in swiftlang#20862 and in swiftlang#21237.
This refactoring uses large portions of the already existing code for
x86_64 and s390 to implement AAPCS64 __VaListBuilder. The parts where
each implementation differ are the x86_64 header, and the order of the
general and vector registers.
The changes also addresses many of the request from the reviewers in
#20862 which were not addressed originally, like the reuse of the
already existing code, and the generalizations for the code to be useful
for platforms different than Linux (Android, for example).
Some of the previous reviewers concerns were not addressed. Below are my explanations.
@compnerd:
_fpRegisterWords
should not beMemoryLayout<Double>.size / MemoryLayout<Int>.size
, because the size ofDouble
is just 8 bytes, while the vector registers seems to be 16 bytes wide.-64
and-128
. If you want me to add the math is fine, but I think the real math according to the standard is confussing in this case (MemoryLayout<Double>.size * _countFPRegisters
was also incorrect for the reason above).@rjmccall:
@_va_list_kind
you were proposing, but I’m not against it. I think, however, that it is of limited utility (it will only be used here, and probably nowhere else). If you still think it is a good idea, can I implement it as a follow up?@futurejones: I hope you don’t mind I’m modifying the code and adopting the feedback from the previous PR. The code is generally useful to more platforms than Linux, so it will be a pity not to use it. My only intention is to have a better support for all the platforms with a cleaner code.