Commit Graph

7802 Commits

Author SHA1 Message Date
Guillaume Lessard
5f5e6b68c9 [stdlib] make OutputSpan changes from SE-0485 2025-07-14 23:04:47 -07:00
Guillaume Lessard
ada94db18c [stdlib] internal UnsafeRawBufferPointer tweaks 2025-07-14 23:04:47 -07:00
Guillaume Lessard
733a261b28 [stdlib] InlineArray consumed by OutputSpan 2025-07-14 23:04:46 -07:00
Guillaume Lessard
1d776a6b06 [stdlib] in-place initializer for InlineArray 2025-07-14 23:04:46 -07:00
Guillaume Lessard
4ed4f2e63c [stdlib] add OutputRawSpan 2025-07-14 23:04:45 -07:00
Guillaume Lessard
2fce25b53f [stdlib] add OutputSpan 2025-07-14 23:04:45 -07:00
Guillaume Lessard
a2ae072430 [stdlib] alignment-checking functions for pointers
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
2025-07-14 23:04:45 -07:00
Alex Martini
891fbbed9b Add actors to the list of types with identity 2025-07-14 15:21:17 -07:00
Saleem Abdulrasool
85228415a8 core: add some additional unsafe markers (#83016)
Mark the `CVAListPointer` construction as unsafe. This resolves some
warnings when building the standard library for Android.
2025-07-13 13:21:18 -05:00
Stephen Canon
d10b3f82fc Optimization pass over String and UTF8Span's allASCII helper (#82540)
This ranges between parity (for very small strings) and 5x faster (for
32-63B strings) in benchmarking on M1 MBP. For largeish strings it
delivers a roughly 2x speedup; further increase in blocksize nets a
small win in microbenchmarks that I do not expect would translate to
real world usage due to codesize impact and the fact that most strings
are smallish.

There's some opportunity for further work here; in particular, if people
start building Swift for a baseline of AVX2 or AVX512, we should have
paths for that (and we should also implement them if/when we get better
multiversioning dispatch machinery in the language). Span adoption would
be interesting. It's likely we should have a dedicated "small core"
implementation that uses only aligned accesses. Still, this is a
significant improvement as-is, and we should land it.


![allASCII](https://github.com/user-attachments/assets/ebbc45ba-5ba8-42dd-bf63-31ca77844fca)
2025-07-11 12:08:17 -04:00
Guillaume Lessard
1e3d26f8a6 [stdlib] rename RawSpan.extracting functions 2025-07-09 17:36:35 -07:00
Guillaume Lessard
dd833569e0 [stdlib] rename Span.extracting functions 2025-07-09 17:25:27 -07:00
Guillaume Lessard
7e2697276a Merge pull request #82851 from glessard/rdar154331399-makeReallyContiguous
[stdlib] Make String.makeContiguousUTF8() strictly true
2025-07-09 08:11:30 -07:00
Guillaume Lessard
9341973700 [stdlib] update doc-comments 2025-07-08 14:29:21 -07:00
Guillaume Lessard
77f34f4f29 [stdlib] update doc-comment and add a code comment 2025-07-08 13:20:11 -07:00
Guillaume Lessard
62115791c0 [stdlib] make makeContiguousUTF8 stricter 2025-07-08 13:20:11 -07:00
Guillaume Lessard
fe6a8fac39 Merge pull request #82866 from glessard/rdar155275054-default-inits-allspans
[stdlib] Default initializers for Span-family types
2025-07-08 09:46:14 -07:00
Guillaume Lessard
37737a10f2 [gardening] conditional compilation spelling tweak 2025-07-08 00:46:26 -07:00
Guillaume Lessard
619ec95693 [stdlib] add no-parameter initializers for Span types
This was an addition in SE-0485.
2025-07-07 17:57:12 -07:00
Guillaume Lessard
9d179716f8 Merge pull request #82828 from glessard/mutableSpan-extractingBug
[stdlib] fix some unsafe errors
2025-07-07 14:28:18 -07:00
Guillaume Lessard
36b5090a98 Merge pull request #82598 from glessard/rdar153654652-now-available
[stdlib] add `span` properties to the backdeployment library
2025-07-07 02:46:10 -07:00
Guillaume Lessard
9ac65cf735 [stdlib] fix some unsafe errors 2025-07-07 02:29:51 -07:00
Alex Martini
c727b0e3bc Merge pull request #82635 from amartini51/typo_154473231
Fix repeated words in documentation

Fixes: rdar://154473231
2025-07-02 19:26:55 -07:00
Stephen Canon
fddd8bd5b9 Mark the concrete SIMD/Scalar comparisons disfavored (#82686)
Adding the concrete versions (https://github.com/swiftlang/swift/pull/81892) introduced an ambiguity for concrete vec .<= .zero comparisons; previously the concrete SIMD .<= SIMD operation would win (because we didn't have a concrete overload for SIMD .<= SIMD.Scalar). We can restore the old behavior by marking these disfavored.
2025-07-02 11:59:07 -04:00
Guillaume Lessard
5d4c445347 [stdlib] some span properties are more available 2025-06-30 17:13:35 -07:00
Stephen Canon
377c66b6e7 Replace some precondition with _precondition in the stdlib. (#82641) 2025-06-30 19:12:00 -04:00
Guillaume Lessard
f97961a86f [stdlib] fix _makeMutableAndUniqueUnchecked() 2025-06-30 16:05:00 -07:00
Alex Martini
3928ddfeb4 Fix repeated text 2025-06-30 09:36:37 -07:00
Henrik G. Olsson
bd11926bf7 [Swiftify] Adjust _SwiftifyImport invocation to align with the signature
of the macro in the currently laoded macro module

Stdlib macros are shipped with the SDK, so we need to make sure that the
way we invoke the macro matches the version of the macro in the SDK.
This patch skips the `spanAvailability` parameter if it isn't present.
There's no good way to test this, because we will always pick up the
current macro in our llvm-lit test suite, but I've tested it manually.

rdar://152278292
2025-06-27 19:10:23 -07:00
David Smith
1a56da655f Native implementation of -lengthOfBytesUsingEncoding, plus handling ASCII-subset MacRoman in a few places (#81791)
Fixes rdar://154341146
2025-06-27 13:48:10 -07:00
Guillaume Lessard
96f6f5e25a Merge pull request #82442 from glessard/rdar147500261-utf8span-32bit 2025-06-27 08:18:46 -07:00
Ben Rimmington
1b1e9d4d80 [stdlib] Update InlineArray documentation (#82363)
Remove misleading big O notation from initializers.
2025-06-27 11:14:24 +01:00
Guillaume Lessard
4927c0c1c8 [stdlib] improve more accessor declarations 2025-06-26 14:57:21 -07:00
Guillaume Lessard
c8092f50d1 [stdlib] simplify borrowing accessors 2025-06-26 14:57:21 -07:00
Guillaume Lessard
bbfe648c54 [stdlib] improve accessor declarations 2025-06-26 14:57:21 -07:00
Guillaume Lessard
791dd4cb0a [stdlib] name your constants better
- computed properties have an ABI impact; a function is fine here
2025-06-25 22:01:28 -07:00
Alejandro Alonso
596b015994 Adjust ABI test and guard address of property 2025-06-25 14:08:53 -07:00
Alejandro Alonso
6953a7c6f9 Update InlineArray.swift 2025-06-25 14:00:16 -07:00
Alejandro Alonso
5ac3a655d4 Update InlineArray.swift 2025-06-25 14:00:15 -07:00
Alejandro Alonso
db13bf0802 Update InlineArray.swift 2025-06-25 14:00:14 -07:00
Alejandro Alonso
8058bd26f6 Remove underscored with buffer pointer APIs on InlineArray 2025-06-25 14:00:12 -07:00
Guillaume Lessard
4a13c916d7 [stdlib] name your constants 2025-06-24 17:19:48 -07:00
Guillaume Lessard
e8f0d52fe2 [gardening] labels for conditional compilation markers 2025-06-24 17:10:37 -07:00
Erik Eckstein
0dbc63a00b Guard InlineArray addressors with feature flag
To be able to parse a recent Swift.swiftinterface file with a 6.2 compiler.
This is a follow-up fix for https://github.com/swiftlang/swift/pull/81441

rdar://154118968
2025-06-24 16:02:54 +02:00
Guillaume Lessard
0473190189 [stdlib] adjust small string for contiguity 2025-06-23 18:38:33 -07:00
Guillaume Lessard
3aad241019 [stdlib] address 32-bit watchOS ABI issue 2025-06-23 18:31:16 -07:00
Allan Shortlidge
008efc432f stdlib: Fix missing unsafe operators in more places.
Add `unsafe` where it is still missing. I missed these in previous passes due
to conditional compilation.
2025-06-22 18:46:57 -07:00
Saleem Abdulrasool
157fdd3977 Merge pull request #82342 from compnerd/unsafe
stdlib: handle `unsafe` annotations in additional places
2025-06-19 11:10:14 -07:00
michael-yuji
cf2f7154a5 Merge pull request #77836 from michael-yuji/mchiu/freebsd
[FreeBSD] Adding FreeBSD support
2025-06-18 19:59:48 -07:00
Saleem Abdulrasool
c17e67e1a9 stdlib: handle unsafe annotations in additional places
This applies more annotations in the `INTERNAL_CHECKS_ENABLED` disabled
paths, Windows, 32-bit, and non-ObjC paths. Interestingly enough, there
are a couple of compiler intrinsics which are also uncovered.
2025-06-18 09:46:17 -07:00