Skip to content

[shims] Move bit masks to SwiftShims and include/swift/ABI. #12306

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

Merged
merged 2 commits into from
Oct 6, 2017

Conversation

milseman
Copy link
Member

@milseman milseman commented Oct 5, 2017

Move bits mask from Metadata.h to SwiftShims's HeapObject.h. This
exposes the bit masks to the stdlib, so that the stdlib doesn't have
to have its own magic numbers per-platform. This also enhances
readability for BridgeObject, whose magic numbers are mostly derived
from Swift's ABI.

@milseman milseman requested a review from jckarter October 5, 2017 22:08
@milseman
Copy link
Member Author

milseman commented Oct 5, 2017

@swift-ci please test

#define SWIFT_ABI_S390X_SWIFT_SPARE_BITS_MASK 0x0000000000000007ULL

#endif /* SWIFT_ABI_SYSTEM_H */
#endif // __SWIFT_ABI_SYSTEM_H__
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline at end of file

Copy link
Contributor

@jckarter jckarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me, thanks for centralizing these magic numbers!

Move bits mask from Metadata.h to SwiftShims's HeapObject.h. This
exposes the bit masks to the stdlib, so that the stdlib doesn't have
to have its own magic numbers per-platform. This also enhances
readability for BridgeObject, whose magic numbers are mostly derived
from Swift's ABI.
@milseman milseman force-pushed the spooky_bit_masques branch from ee08fc7 to 3d04fb5 Compare October 5, 2017 23:32
@milseman
Copy link
Member Author

milseman commented Oct 5, 2017

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Oct 5, 2017

Build failed
Swift Test Linux Platform
Git Sha - ee08fc72a1bed982ee62406d0c62d59c31093627

@swift-ci
Copy link
Contributor

swift-ci commented Oct 5, 2017

Build failed
Swift Test OS X Platform
Git Sha - ee08fc72a1bed982ee62406d0c62d59c31093627

/// Corresponding namespaced decls
#ifdef __cplusplus
namespace heap_object_abi {
static const uintptr_t LeastValidPointerValue =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be __swift_uintptr_t?

Copy link
Member Author

@milseman milseman Oct 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, what is the point of __swift_uintptr_t? My guess was that __swift_uintptr_t was so that it would be specially imported to the stdlib as UInt rather than UInt<n>. If that's the case, then this isn't visible to the stdlib as it's C++. I'm happy to make the style match, I'm just curious whether there's something more going on here.

edit: formatting and grammar

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is given in SwiftStdint.h. Briefly: it breaks a dependency cycle on Darwin and avoids a tools bug on Linux.

@milseman
Copy link
Member Author

milseman commented Oct 6, 2017

@swift-ci please smoke test

@milseman milseman merged commit 9497049 into swiftlang:master Oct 6, 2017
@milseman milseman deleted the spooky_bit_masques branch October 6, 2017 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants