Commit Graph

23 Commits

Author SHA1 Message Date
Doug Gregor
22eecacc35 Adopt unsafe annotations throughout the standard library 2025-02-26 14:28:01 -08:00
Joe Groff
ce0a04393c Revert "Switch to malloc_good_size instead of malloc_size (#70532)"
This reverts commit 0843891eb9.
2024-02-21 10:26:37 -08:00
David Smith
0843891eb9 Switch to malloc_good_size instead of malloc_size (#70532)
Switch to malloc_good_size instead of malloc_size
2024-01-27 19:20:33 -08:00
3405691582
7830028f55 [stdlib] Avoid malloc_size on OpenBSD.
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.
2020-04-27 15:52:37 -04:00
Ben Cohen
59dd6fb3d4 _fastEnumerationStorageMutationsTarget exists to be usableFromInline 2018-10-29 07:42:07 -07:00
Mox Soini
d4511da4f8 Make _fastEnumerationStorageMutationsPtr internal
...and make Foundation use it's own fileprivate _fastEnumerationStorageMutationsPtr
2018-04-27 00:00:26 +03:00
Slava Pestov
2e5aef9c8d stdlib: Remove redundant @usableFromInline attributes 2018-04-06 00:02:30 -07:00
Slava Pestov
e1f50b2d36 SE-0193: Rename @_inlineable to @inlinable, @_versioned to @usableFromInline 2018-03-30 21:55:30 -07:00
Slava Pestov
7f73623532 stdlib: Fix for NSFastEnumerator breakage in resilient builds 2017-10-27 18:55:05 -07:00
Max Moiseev
53b8419279 [stdlib] Make all the stdlib APIs @_inlineable
This change in theory should allow us to remove a special stdlib-only
sil-serialize-all compilation mode.

<rdar://problem/34138683>
2017-09-29 11:26:56 -07:00
Roman Levenstein
29ad714bb7 Annotate stdlib functions to get a good performance even in resilient mode, when -sil-serialize-all is disabled
This commit mostly improves the performance of arrays and ranges.
It does not cover Strings, Dictionaries and Sets yet.
2017-03-16 19:46:11 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Dmitri Gribenko
d591f9cf7a stdlib: remove most uses of @warn_unused_result, which does nothing now
I kept the one on sorted(), because that one requires a less trivial
change.
2016-05-19 18:39:39 -07:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Noah Fradin
048327cd02 Update Shims.swift 2015-12-03 16:36:19 -08:00
Dmitri Hrybenko
dd3194a18c stdlib: adopt @warn_unused_result
rdar://20957486

Swift SVN r31048
2015-08-06 14:53:18 +00:00
Andrew Trick
5bc23acf75 Add wrappers around Builtin.isUnique.
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
2015-05-01 23:45:44 +00:00
Andrew Trick
ec31f6dbc9 Revert "Add wrappers around Builtin.isUnique."
This reverts commit 64e9f11211a19fa603f5bc2d2bea171a9b07d3fa.

I think this is breaking ExistentialCollection test in the
Release + stdlib asserts build.

Swift SVN r27947
2015-04-29 23:23:13 +00:00
Andrew Trick
09db0dda92 Add wrappers around Builtin.isUnique.
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
2015-04-29 21:59:19 +00:00
Andrew Trick
9ec8fe58ca Convert stdlib classes to use Builtin.isUnique.
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
2015-04-29 21:59:17 +00:00
Dmitri Hrybenko
ab408d4dc3 Update the compiler and SDK overlay for nullability and generics in Foundation
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
2015-03-24 02:18:06 +00:00
Dmitri Hrybenko
350248dae5 Reorganize the directory structure under 'stdlib'
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
2015-03-09 05:26:05 +00:00