malloc introspection is a platform feature that is unavailable on
OpenBSD. There is no workaround for the feature, so we have to assume
that allocations succeed in allocating exactly the amount of memory
requested, and nothing more.
Here a new mallocSize shim is introduced so the feature check for malloc
introspection is pushed to the shims, rather than using os checks
directly from Swift. Not every use of malloc_size has been converted
yet; ManagedBuffer.swift still remains. However, this module requires
special care to fix, which will be done separately.
Currently they do nothing but allow stdlib code to use regular (Bool)
types. However, soon the wrappers for the _native variants will
provide point-of-use sanity checking.
These need to be fully generic to support class protocols and
single-payload enums (not just for optional). It also avoids a massive
amount of overloading for all the reference type variations
(AnyObject, Native, Unknown, Bridge) x 2 for optional versions of
each.
Because the wrapper is generic, type checking had to be deferred until
IRGen. Generating code for the wrapper itself will result in an
IRGen-time type error. They need to be transparent anyway for proper
diagnostics, but also must be internal.
Note that the similar external API type checks ok because it
forces conformance to AnyObject.
The sanity checks are disabled because our current facilities for
unsafe type casting are incomplete and unsound. SILCombine can
remove UnsafeMutablePointer and RawPointer casts by assuming layout
compatibility. IRGen will later discover layout incompatibility and
generate a trap.
I'll send out a proposal for improving the casting situation so we can
get the sanity checks back.
Swift SVN r28057
This reverts commit 64e9f11211a19fa603f5bc2d2bea171a9b07d3fa.
I think this is breaking ExistentialCollection test in the
Release + stdlib asserts build.
Swift SVN r27947
The wrappers for the _native variants provide point-of-use sanity checking.
They also allows stdlib code to use regular (Bool) types.
These need to be fully generic to support class protocols. It also
avoids a massive amount of overloading for all the reference type
variations (AnyObject, Native, Unknown, Bridge) x 2 for optional
versions of each.
Because the wrapper is generic, type checking had to be deferred until
IRGen. Generating code for the wrapper itself will result in an
IRGen-time type error. They need to be transparent anyway for proper
diagnostics, but also must be internal.
The external API passes type checks because it forces conformance to AnyObject.
Swift SVN r27930
Fixes <rdar://problem/18151694> Add Builtin.checkUnique to avoid lost Array copies
The isUniquelyReference APIs are now correct in the presence of full
inlining and ARC optimization. The ARC optimizer can't see into the
Builtin, which lowers to a special SIL instruction.
Swift SVN r27929
We have an SPI between the Swift compiler and Foundation based on the
SWIFT_SDK_OVERLAY_FOUNDATION_EPOCH preprocessor macro that allows us to
request the new API. rdar://20270080 tracks removing it.
Swift SVN r26475
The standard library has grown significantly, and we need a new
directory structure that clearly reflects the role of the APIs, and
allows future growth.
See stdlib/{public,internal,private}/README.txt for more information.
Swift SVN r25876