-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[runtime] Remove TwoWordPair and use the Swift calling convention instead. #14373
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
stdlib/public/runtime/HeapObject.cpp
Outdated
return _swift_allocBox(type); | ||
} | ||
|
||
static BoxPair::Return _swift_allocBox_(const Metadata *type) { | ||
SWIFT_CC(swift) | ||
static BoxPair _swift_allocBox_(const Metadata *type) { |
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.
I think it's correct to use swiftcall
here, but it's worth noting that this method was added since the original PR.
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.
All three of the allocBox pieces should be swiftcall
: the _swift_allocBox
function pointer and the functions swift_allocBox
and _swift_allocBox_
.
Having said that, I see that Instruments does not actually use the _swift_allocBox
function pointer which is the only reason for the extra function and function pointer to exist. We can mark swift_allocBox
as swiftcall
and delete the other two.
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.
I'm planning to remove all of these function pointers later. For now we can just fix the existing swift_allocBox
pieces in place.
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.
I've removed the function pointer and simplified it to just the implementation. Unless I'm mistaken (and it's entirely possible I am), we shouldn't need to repeat the SWIFT_CC(swift)
before the implementations since it's already in the header files.
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.
Or delete them now. That's good too.
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.
There is also a function pointer declaration in InstrumentsSupport.h.
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.
I removed the BoxPair (*_swift_allocBox)(Metadata const *type)
declaration there in the same commit.
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.
Apparently I can't read header files today. I missed that and your earlier change to swift_allocBox in HeapObject.h. Everything looks good now.
@swift-ci please test |
Build failed |
Build failed |
Ugh, should this wait for https://reviews.llvm.org/D42768 ? |
What effect would D42768 have on this change? |
I don’t think there’s much reason to wait. This was in for a few months previously and fixes the Win64 build. If someone hits the Clang assertion on Windows because of this, they can make a one-line change in Clang’s MicrosoftMangle.cpp to get past it until your Clang PR is merged. Besides, I think Windows uses swiftcall C functions even without this PR. |
Reinstate #13299, which was reverted in #14079 due to a bug in the original PR.
Original PR message: