File tree Expand file tree Collapse file tree 4 files changed +30
-5
lines changed Expand file tree Collapse file tree 4 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -171,9 +171,9 @@ static_assert(alignof(HeapObject) == alignof(void*),
171
171
#define _swift_abi_SwiftSpareBitsMask \
172
172
(__swift_uintptr_t ) SWIFT_ABI_S390X_SWIFT_SPARE_BITS_MASK
173
173
#define _swift_abi_ObjCReservedBitsMask \
174
- (__swift_uintptr_t ) SWIFT_ABI_DEFAULT_OBJC_RESERVED_BITS_MASK
174
+ (__swift_uintptr_t ) SWIFT_ABI_S390X_OBJC_RESERVED_BITS_MASK
175
175
#define _swift_abi_ObjCReservedLowBits \
176
- (unsigned ) SWIFT_ABI_DEFAULT_OBJC_NUM_RESERVED_LOW_BITS
176
+ (unsigned ) SWIFT_ABI_S390X_OBJC_NUM_RESERVED_LOW_BITS
177
177
#define _swift_BridgeObject_TaggedPointerBits \
178
178
(__swift_uintptr_t ) SWIFT_ABI_DEFAULT_BRIDGEOBJECT_TAG_64
179
179
Original file line number Diff line number Diff line change 164
164
/* ********************************** s390x ************************************/
165
165
166
166
// Top byte of pointers is unused, and heap objects are eight-byte aligned.
167
- #define SWIFT_ABI_S390X_SWIFT_SPARE_BITS_MASK 0x0000000000000007ULL
167
+ // On s390x it is theoretically possible to have high bit set but in practice
168
+ // it is unlikely.
169
+ #define SWIFT_ABI_S390X_SWIFT_SPARE_BITS_MASK 0xFF00000000000007ULL
170
+
171
+ // Objective-C reserves just the high bit for tagged pointers.
172
+ #define SWIFT_ABI_S390X_OBJC_RESERVED_BITS_MASK 0x8000000000000000ULL
173
+ #define SWIFT_ABI_S390X_OBJC_NUM_RESERVED_LOW_BITS 0
174
+
175
+ // BridgeObject uses this bit to indicate whether it holds an ObjC object or
176
+ // not.
177
+ #define SWIFT_ABI_S390X_IS_OBJC_BIT 0x4000000000000000ULL
178
+
179
+ // ObjC weak reference discriminator is the high bit
180
+ // reserved for ObjC tagged pointers plus the LSB.
181
+ #define SWIFT_ABI_S390X_OBJC_WEAK_REFERENCE_MARKER_MASK \
182
+ (SWIFT_ABI_S390X_OBJC_RESERVED_BITS_MASK | \
183
+ 1 <<SWIFT_ABI_S390X_OBJC_NUM_RESERVED_LOW_BITS)
184
+ #define SWIFT_ABI_S390X_OBJC_WEAK_REFERENCE_MARKER_VALUE \
185
+ (1 <<SWIFT_ABI_S390X_OBJC_NUM_RESERVED_LOW_BITS)
168
186
169
187
#endif /* SWIFT_ABI_SYSTEM_H */
Original file line number Diff line number Diff line change @@ -82,6 +82,11 @@ public typealias CLongDouble = Double
82
82
public typealias CLongDouble = Float80
83
83
#endif
84
84
// TODO: Fill in definitions for other OSes.
85
+ #if arch(s390x)
86
+ // On s390x '-mlong-double-64' option with size of 64-bits makes the
87
+ // Long Double type equivalent to Double type.
88
+ public typealias CLongDouble = Double
89
+ #endif
85
90
#endif
86
91
87
92
// FIXME: Is it actually UTF-32 on Darwin?
Original file line number Diff line number Diff line change @@ -61,9 +61,11 @@ using namespace swift;
61
61
// / Returns true if the pointer passed to a native retain or release is valid.
62
62
// / If false, the operation should immediately return.
63
63
static inline bool isValidPointerForNativeRetain (const void *p) {
64
- #if defined(__x86_64__) || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
65
- // On these platforms, the upper half of address space is reserved for the
64
+ #if defined(__x86_64__) || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64) || defined(__s390x__)
65
+ // On these platforms, except s390x, the upper half of address space is reserved for the
66
66
// kernel, so we can assume that pointer values in this range are invalid.
67
+ // On s390x it is theoretically possible to have high bit set but in practice
68
+ // it is unlikely.
67
69
return (intptr_t )p > 0 ;
68
70
#else
69
71
return p != nullptr ;
You can’t perform that action at this time.
0 commit comments