File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -363,6 +363,14 @@ internal func _class_getInstancePositiveExtentSize(_ theClass: AnyClass) -> Int
363
363
#endif
364
364
}
365
365
366
+ @_inlineable
367
+ @_versioned
368
+ internal
369
+ func _isValidAddress( _ address: UInt ) -> Bool {
370
+ // TODO: define (and use) ABI max valid pointer value
371
+ return address >= _swift_abi_LeastValidPointerValue
372
+ }
373
+
366
374
//===--- Builtin.BridgeObject ---------------------------------------------===//
367
375
368
376
// TODO(<rdar://problem/34837023>): Get rid of superfluous UInt constructor
Original file line number Diff line number Diff line change @@ -29,8 +29,6 @@ import SwiftShims
29
29
// FIXME: what about ppc64 and s390x?
30
30
//
31
31
32
-
33
-
34
32
@_fixed_layout
35
33
public // FIXME
36
34
struct _StringGuts {
@@ -78,7 +76,7 @@ extension _StringGuts {
78
76
} else if _object. isUnmanaged {
79
77
} else if _object. isCocoa {
80
78
if _object. isContiguous {
81
- _sanityCheck ( _otherBits != 0 ) // TODO: in ABI's address space
79
+ _sanityCheck ( _isValidAddress ( _otherBits) )
82
80
} else {
83
81
_sanityCheck ( _otherBits == 0 )
84
82
}
@@ -238,7 +236,7 @@ extension _StringGuts {
238
236
@inline ( __always)
239
237
get {
240
238
_sanityCheck ( _object. isContiguousCocoa)
241
- _sanityCheck ( Int ( bitPattern : _otherBits) >= 1 ) // TODO: ABI's min address
239
+ _sanityCheck ( _isValidAddress ( _otherBits) )
242
240
return UnsafeRawPointer (
243
241
bitPattern: _otherBits
244
242
) . _unsafelyUnwrappedUnchecked
You can’t perform that action at this time.
0 commit comments