Commit Graph

63 Commits

Author SHA1 Message Date
Doug Gregor
53f14688a6 Update strict memory safety annotations for Synchronization module 2025-03-10 15:42:32 -07:00
Doug Gregor
1efb994375 Enable strict memory safety in the Synchronization module 2025-02-26 14:28:28 -08:00
Ben Rimmington
4bb3cf1496 [stdlib] Update WordPair: Comparable conformance (#79606) 2025-02-25 10:17:05 -08:00
Alejandro Alonso
d2309d264d Fix tests 2025-01-28 12:50:51 -08:00
Alejandro Alonso
9af4a76b52 Use tuple comparison 2025-01-23 15:55:19 -08:00
Alejandro Alonso
8500d0cba1 Less than is a static function.. 2025-01-23 13:09:47 -08:00
Alejandro Alonso
22d5acd207 Fix logic around comparison 2025-01-23 11:55:21 -08:00
Alejandro Alonso
d5b131a436 Add Comparable conformance to WordPair 2025-01-23 10:08:52 -08:00
Meghana Gupta
20eff53585 Revert "Make Atomic.deinit @_transparent"
This reverts commit dd037f896f.

@_transparent on deinit was diagnosed as an error in older compilers

Making Atomic.deinit @_transparent will break compiling newer sdk with older compilers

Fixes rdar://139194948
2024-11-05 14:58:04 -08:00
Meghana Gupta
dd037f896f Make Atomic.deinit @_transparent 2024-10-31 13:42:34 -07:00
Meghana Gupta
02a58738a0 Remove -enable-ossa-module for Synchronization and Distributed
These modules import Darwin which is not in ossa. -enable-ossa-modules
results in a one-time recompilation of dependencies when they are not in ossa.
This is not compatible with Explicit Build Modules when the original invocation
did not have -enable-ossa-modules.
2024-10-31 10:55:35 -07:00
Doug Gregor
8378562e12 Adopt @unsafe throughout the standard library
Annotate all of the `Unsafe*` types and `unsafe` functions in the standard
library (including concurrency, synchronization, etc.) as `@unsafe`. Add a
few tests to ensure that we detect uses of these types in clients that
have disabled unsafe code.
2024-08-19 14:33:09 -07:00
Evan Wilde
cae88d3344 Fix add_swift_target_library for the static SDK
add_swift_target_library was missing pieces for passing sources and
flags to the static SDK build. As a result, the static SDK was missing
pieces (specifically Mutex).

Also adding the Musl import to the Linux Mutex implementation.
2024-08-13 15:59:31 -07:00
Doug Gregor
ac0f574fdb Merge pull request #75127 from carlos4242/embedded-avr-cross-compile-stdlib
[AVR] standard library support for AVR
2024-07-17 22:17:42 -07:00
Alejandro Alonso
24a46c422b Merge pull request #74946 from Azoy/mutex-sending-inout
[stdlib] Adopt inout sending for Mutex
2024-07-17 10:56:57 -07:00
Carl Peto
3689427834 [AVR] standard library support for AVR
- when compiling embedded cross compile target standard libraries, include AVR
- add 16-bit pointer as a conditional compilation condition and get the void pointer size right for gyb sources
- attempt to fix clang importer not importing __swift_intptr_t correctly on 16 bit platforms
- changed the unit test target to avr-none-none-elf to match the cmake build

[AVR] got the standard library compiling in a somewhat restricted form:

General
- updated the Embedded Runtime
- tweaked CTypes.swift to fix clang import on 16 bit platforms

Strings
- as discussed in https://forums.swift.org/t/stringguts-stringobject-internals-how-to-layout-on-16-bit-platforms/73130, I went for just using the same basic layout in 16 bit as 32 bit but with 16 bit pointers/ints... the conversation is ongoing, I think something more efficient is possible but at least this compiles and will probably work (inefficiently)

Unicode
- the huge arrays of unicode stuff in UnicodeStubs would not compile, so I skipped it for AVR for now.

Synchronization
- disabled building the Synchronization library on AVR for now. It's arguable if it adds value on this platform anyway.
2024-07-16 12:28:27 +01:00
Allan Shortlidge
0ba007661a AST: Promote BuiltinAddressOfRawLayout to baseline. 2024-07-09 14:29:30 -07:00
Alexander Cyon
c21b1e68fd [stdlib] Fix typos 2024-07-06 13:09:57 +02:00
Alejandro Alonso
9cbf410220 Adopt inout sending for Mutex 2024-07-03 10:54:20 -07:00
Kuba Mracek
6eeef12849 [embedded] Add a embedded-libraries CMake target to simplify the test dependencies 2024-06-23 13:08:01 -07:00
Alejandro Alonso
49e8a73027 Adjust Synchronization module dependencies for macCatalyst 2024-06-12 23:55:51 -07:00
Alejandro Alonso
e3a53abe13 Don't use aarch64 hint for arm targets 2024-06-10 09:23:21 -07:00
Alejandro Alonso
b1ceb9b947 Update MutexUnavailable.swift (#74182)
Fixes the availability syntax for minimal platforms.
Resolves: rdar://129345303
2024-06-06 12:46:28 -07:00
Alejandro Alonso
4f8181dde6 Merge pull request #74143 from Azoy/mutex-minimal-thing
[stdlib] Condition Mutex.swift on platform
2024-06-06 07:54:36 -07:00
Yuta Saito
da6f015e3c Merge pull request #74171 from kateinoigakukun/yt/fix-mutex-wasm-test
[Synchronization] Fix wasm atomic intrinsic declarations
2024-06-06 16:58:32 +09:00
Alex Lorenz
bffb878476 Merge pull request #74160 from hyp/eng/fix-android-synchro
[android] Fix Synchronization Android build
2024-06-05 23:38:47 -07:00
Yuta Saito
2dbbbcf646 [Synchronization] Skip atomic operations in single-threaded mode on WebAssembly
Use of atomics instructions requires the support of threads proposal and
it's not widely supported yet. So we should enable actual atomic
operations only when targeting wasm32-uknown-wasip1-threads.
2024-06-06 04:18:13 +00:00
Yuta Saito
0536c9ac65 [Synchronization] Fix wasm atomic intrinsic declarations
Otherwise, isel will not be able to select the desired atomic
instructions.
2024-06-06 04:18:13 +00:00
Alex Lorenz
74d2a66a27 [androd] Fix Synchronization Android build
Add Android import for Mutex implementation
2024-06-05 16:58:05 -07:00
Alejandro Alonso
fcfbf068a5 Add a special file for mutex on unavailable platforms 2024-06-05 13:51:55 -07:00
Yuta Saito
3b1791a638 [Synchronization] Fix Wasm mutex build
This change fixes the following build error happening on Wasm:
```
error: referencing instance method '_wait(expected:)' on 'Atomic' requires the types '_MutexHandle.State' and 'UInt32' be equivalent
```
2024-06-05 17:15:43 +00:00
Alejandro Alonso
bc0e6ab392 Conditionalize Mutex.swift 2024-06-05 09:20:59 -07:00
Alejandro Alonso
cb3fc4b451 Adopt sending and movesAsLike 2024-06-04 09:49:21 -07:00
Alejandro Alonso
6b29e779e4 Support visionOS for Mutex 2024-06-04 09:06:37 -07:00
Alejandro Alonso
66ec7abd54 Underscore some things, add explicit internal
Fix some compile issues
2024-06-04 09:06:37 -07:00
Alejandro Alonso
fbfb218d11 Update LinuxImpl.swift 2024-06-04 09:06:37 -07:00
Alejandro Alonso
3a115fc290 Properly handle the syscalls on Linux and do some spins
fix some stuff
2024-06-04 09:06:37 -07:00
Alejandro Alonso
9b389a3df5 Fix tests and toolchain build 2024-06-04 09:06:37 -07:00
Alejandro Alonso
e99268864c Use Builtin.addressOfRawLayout 2024-06-04 09:06:37 -07:00
Alejandro Alonso
6d6e518c38 It is WASI, not WASM 2024-06-04 09:06:37 -07:00
Alejandro Alonso
97072e5b79 Adopt transferring for Mutex init 2024-06-04 09:06:37 -07:00
Alejandro Alonso
ba1787c1d5 Move atomic sources into a folder 2024-06-04 09:06:37 -07:00
Alejandro Alonso
89748d4229 Actually implement the API now 2024-06-04 09:06:36 -07:00
Alejandro Alonso
92e6a989b2 Cache TID in TLS on Linux 2024-06-04 09:06:36 -07:00
Alejandro Alonso
5b7e3d8ca2 Add a WasmMutex 2024-06-04 09:06:36 -07:00
Alejandro Alonso
1146b41d14 Add the underscored unsafe locking primitives 2024-06-04 09:06:36 -07:00
Alejandro Alonso
882568ca4d Directly call gettid syscall instead of library function 2024-06-04 09:06:36 -07:00
Alejandro Alonso
1f206ec58e Attempt to release the lock and wake when we can't 2024-06-04 09:06:36 -07:00
Alejandro Alonso
2a60c88457 Implement Mutex in Synchronization 2024-06-04 09:06:34 -07:00
Alejandro Alonso
3053c81259 Enforce that atomic representations are bitwisecopyable 2024-05-18 10:18:32 -07:00