Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for 32-bit platforms (with
AnyObject?
for now) (swiftlang#15)
* Restore support for 32-bit platforms On 32-bit platforms, add an extra 32-bit word to both _StringObject and _StringGuts for padding and metadata bit storage. Padding _StringObject rather than adding two extra words to _StringGuts makes for unattractively discontiguous inline storage. However, _StringObject needs 2 more metadata bits than are available in a 32-bit BridgeObject; shoving an extra word in there was easier than a full code reorganization. To make use of all this luxurious extra space, on 32-bit platforms, _StringGuts._otherBits always contains the count for contiguous strings, while the new _StringGuts._extraBits stored property contains the start address. This makes extracting an unmanaged view a trivial operation. * [runtime] SwiftObject, SwiftValue: Simplify -description implementation Previously, these classes implemented -description and -debugDescription by 1) calling _getSummary in the stdlib to get the Swift String description corresponding to the value, and then 2) calling _convertStringToNSString in the Foundation overlay to convert the resulting String into an NSString. To hold the Swift String value between the two calls, SwiftObject defined a dummy C++ struct whose layout is supposed match that of Swift Strings. Instead of updating this struct to the new String representation, this commit collapses the two stages above into a single call into a new generic function, _getDescription (defined in the Foundation overlay), which gets rid of this maintenance chore. * [runtime] Reflection: Update String representation to follow stdlib changes * _StringObject: Replace _BridgeObject with AnyObject? on 32-bit platforms Also, don't store any tagged value in _StringObject on 32-bit -- with AnyObject taking up a full word now, we only have 28 bits available (30 tops), which is not enough to store either a count nor a start address. * LibcShims: Adjust _swift_stdlib_print_hex for 32-bit platforms. * [test] Update 32-bit reflection tests Previous (speculative) update missed a couple of offset/size changes. * [test] IRGen/lazy_multi_file.swift: Allow for the possibility of an sret param before self. String is 4 words long on 32 bit platforms, which gets returned via sret on i386. * [test] DebugInfo/self.swift: Don't expect self to be alloca'd first On i386, space for a String gets allocated before the self variable. * _StringGuts: Add _RawBitPattern typealias * _StringGuts: Fix an overlapping access warning * _StringVariant: Remove IndexDistance condition * [runtime] Update mangled symbol
- Loading branch information