Casting runtime: Use the runtime's constant for reserved bits in an ObjC pointer.

Previously, we had a predicate that only worked properly for 64-bit
architectures; the 32-bit platforms don't have tagged pointers, and
have an annoying tendency to allocate objects with the high bit of the
address set. Fixes <rdar://problem/17544277>.

Swift SVN r19523
This commit is contained in:
Doug Gregor
2014-07-03 17:55:38 +00:00
parent b1cc0a2455
commit 0598b6db5e

View File

@@ -87,7 +87,8 @@ uint8_t swift::swift_classShift = 0;
#if SWIFT_OBJC_INTEROP
/// Does this object use a tagged-pointer representation?
static bool isTaggedPointerOrNull(const void *object) {
return ((long)object & 1) || ((long)object <= 0);
return ((uintptr_t)object & heap_object_abi::ObjCReservedBitsMask) ||
object == nullptr;
}
#endif