Commit Graph

634 Commits

Author SHA1 Message Date
Alejandro Alonso
66ec7abd54 Underscore some things, add explicit internal
Fix some compile issues
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
92e6a989b2 Cache TID in TLS on Linux 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
2a60c88457 Implement Mutex in Synchronization 2024-06-04 09:06:34 -07:00
Alastair Houghton
5e24abc970 [Shims] Fix nullability for musl.
Apparently I got the merge for this slightly wrong.

rdar://128388845
2024-05-20 12:18:59 +01:00
Alastair Houghton
0fa5e65bb2 [Stdlib][Build] Fix the standard library build for fully static Linux.
Mostly this just means adding `Musl` as a module dependency of various
things and making sure that we build things for `swift_static` even
if `SWIFT_BUILD_STATIC_STDLIB` isn't enabled.

There's also a slight difference in the declaration of `memcmp()`;
musl's declaration is more like the one we have on Darwin.

rdar://123508245
2024-05-07 16:56:20 +01:00
Kuba (Brecka) Mracek
70d1d998ab Merge pull request #72530 from kubamracek/embedded-add-ivar-destroyers
[embedded] Add IVarDestroyers into class metadata, add support for throws in initializers
2024-03-27 09:12:34 -07:00
Kuba Mracek
37d9be636a [embedded] Handle NULL IVarDestroyers, expand test 2024-03-26 21:14:21 -07:00
Kuba Mracek
b8bd832fba [embedded] Add IVarDestroyers into class metadata, add support for throws in initializers 2024-03-26 20:52:17 -07:00
Yuta Saito
f4d3ee6a92 [embedded] Use __has_extension(swiftcc) to detect Swift calling convention
This change replaces the use of `__has_feature(swiftasynccc)` with
`__has_extension(swiftcc)` to detect the SwiftCC availability. The former
condition works fine for most platforms that support both SwiftCC and
SwiftAsyncCC or neither, but it fails for WebAssembly, which supports
SwiftCC but not SwiftAsyncCC.

We add `swiftcc` extension to Clang, and use it here.
2024-03-20 23:07:29 +00:00
Saleem Abdulrasool
ac4123b7b9 shims: adjust declaration for android NDK
Mark the nullability to repair the build against NDK r26b.
2024-03-14 15:47:00 -07:00
Daniel Rodríguez Troitiño
42e43edef3 [cmake] Unify usage of create_symlink/copy across the build files. (#72202)
In several places, there was the same or similar code to either do
a symlink or use copy/copy_if_different/copy_directory in Windows
systems. The checks were also slightly different in some cases.

There is a `SWIFT_COPY_OR_SYMLINK` that can be controlled as a CMake
option, and uses `CMAKE_HOST_UNIX` as default. Change all cases that
I can find to use that value. Also create a parallel value
`SWIFT_COPY_OR_SYMLINK_DIR` to apply to directories.

There is still a couple of cases that are specific to macOS SourceKit
framework which I have left as-is, since symlinks is probably the only
right thing to do there.

There's a case for Windows specifically that uses symlinks (in
523f807694/cmake/modules/SwiftConfigureSDK.cmake (L502))
which I have not modified as well.
2024-03-09 18:03:55 -08:00
Mike Ash
4d484c9f12 Merge pull request #71993 from mikeash/fix-32-bit-unowned-refcount-overflow
[Runtime] Fix strong and unowned refcount overflow on 32-bit.
2024-03-06 17:54:26 -05:00
Saleem Abdulrasool
ede186c20f Merge pull request #71980 from compnerd/build-host-target
SwiftShims: use the correct variable for the behaviour check
2024-03-01 07:45:53 -08:00
Mike Ash
13b58a0b5c [Runtime] Fix strong and unowned refcount overflow on 32-bit.
Fix overflow detection on unowned refcounts so that we create a side table when incrementing from 126. Implement strong refcount overflow to the side table.

The unowned refcount is never supposed to be 127, because that (sometimes) represents the immortal refcount. We attempt to detect that by checking newValue == Offsets::UnownedRefCountMask, but the mask is shifted so that condition is never true. We managed to hit the side table case when incrementing from 127, because it looks like the immortal case. But that broke when we fixed immortal side table initialization in b41079a8f54ae2d61c68cdda46c74232084af020. With that change, we now create an immortal side table when overflowing the unowned refcount, then try to increment the unowned refcount in that immortal side table, which traps.

rdar://123788910
2024-03-01 09:42:45 -05:00
finagolfin
10ad6f35f7 [android] Update memcmp() declaration for nullability annotations added in NDK 26 (#71968) 2024-02-29 15:31:12 -08:00
Saleem Abdulrasool
82954fc46e SwiftShims: use the correct variable for the behaviour check
We would check the SYSTEM_NAME rather than the HOST_SYSTEM_NAME variable
where the former is the host and the latter is the build. The behaviour
is concerning the build and so we would behave incorrectly.
2024-02-29 07:22:15 -08:00
Konrad `ktoso` Malawski
1d44e2e8e0 [Distributed] Undo new record and mangling scheme for dist.p.witnesses (#71801) 2024-02-22 23:02:29 +09: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
Jonathan Grynspan
d35dcc8f9c Add swift5_tests to MetadataSections. (#71509) 2024-02-19 13:47:40 -05:00
Konrad `ktoso` Malawski
e9c7f3c382 [Distributed] Target identifiers for protocol calls (#70928) 2024-02-16 07:19:20 -08:00
Kuba Mracek
dba8d5d3a0 Revert "Merge pull request #71278 from kubamracek/embedded-no-mach-defines"
This reverts commit 21eddf0b1a, reversing
changes made to e2d516f3c9.
2024-02-05 09:05:22 -08:00
Kuba (Brecka) Mracek
21eddf0b1a Merge pull request #71278 from kubamracek/embedded-no-mach-defines
[embedded] Implicitly define __APPLE__ and __MACH__ when on -apple-none triples
2024-02-02 19:30:56 -08:00
Kuba Mracek
4776e993ad [embedded] Use defined(__wasm__) instead of defined(__wasi__) in Visibility.h 2024-02-02 12:41:54 -08:00
Mike Ash
590c33ed70 [Runtime] Correctly initialize side tables of immortal objects on 32-bit.
The code to copy the refcounts from the object to a new side table wasn't quite right on 32-bit. Fix it to copy the PureSwiftDealloc field, and if the object is immortal, mark the side table's refcount as immortal too.

rdar://121943608
2024-01-31 17:08:06 -05:00
Ian Anderson
288f37b2c1 [Concurrency] [shims] Don't declare exit in the concurrency shims
Don't delete the OS declaration of `exit` because the concurrency shims aren't always imported, and so the shim declaration might not always be available.
Don't override the OS declaration of `exit` in the concurrency shims since we can't just delete the OS one. Instead, set up internal shims just for building Concurrency that forward declares `exit`.
2024-01-29 16:25:46 -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
Kuba Mracek
2c30b0a0e2 [embedded] Resolve ptrauth crashes by signing HeapObjects's isa pointers in embedded Swift 2024-01-22 16:45:07 -08:00
Allan Shortlidge
582c0de28c NFC: Add _Null_unspecified _swift_stdlib_getEnviron() declaration.
Makes the BSD and `__APPLE__` branches consistent and suppresses the following
warning:

```
warning: pointer is missing a nullability type specifier
```
2024-01-16 13:27:55 -08:00
Saleem Abdulrasool
6f9a28921a SwiftShims: silence a deprecation warning on Windows
Silence a deprecation warning on Windows by using the Microsoft
extension.
2023-12-05 07:51:20 -08:00
Kuba Mracek
df09cf16b1 [embedded] Avoid using swiftcc on targets that don't support it 2023-11-13 12:59:41 -08:00
swift-ci
e83a375e20 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-06 06:36:52 -07:00
Yuta Saito
cdc47aabfb [WASILibc] Exclude semaphore APIs from overlay
Since wasi-libc does not support those APIs
2023-10-06 01:49:30 +00:00
swift-ci
75ce2f5734 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-03 07:13:54 -07:00
Kuba Mracek
d579c62fee [embedded] Resolve empty -sdk path warning in embedded stdlib build, take 3 2023-10-02 17:55:02 -07:00
swift-ci
a230c675b6 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-02 13:55:10 -07:00
Kuba Mracek
268a1e3556 Revert "[embedded] Resolve empty -sdk path warning in embedded stdlib build, take 2"
This reverts commit a1a48b5c83.
2023-10-02 09:35:21 -07:00
swift-ci
e565849dd4 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-29 12:58:02 -07:00
Kuba Mracek
a1a48b5c83 [embedded] Resolve empty -sdk path warning in embedded stdlib build, take 2 2023-09-28 09:17:32 -07:00
swift-ci
39f5388c07 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-27 10:16:49 -07:00
Kuba (Brecka) Mracek
859ce6b9a4 Merge pull request #68783 from kubamracek/embedded-posix-memalign
[embedded] Fix a warning in LibcShims.h about missing nullability annotations
2023-09-27 10:03:12 -07:00
Kuba Mracek
a46abb0cf8 [embedded] Put __ptrauth specifier at the right spot so that it parses even in C++ mode 2023-09-26 17:32:35 -07:00
Kuba Mracek
1d24e0b343 [embedded] Fix a warning in LibcShims.h about missing nullability annotations 2023-09-26 16:23:50 -07:00
Kuba Mracek
8009f45b05 [embedded] Avoid warning about redefined macro by using attributes directly 2023-09-26 16:16:13 -07:00
Kuba Mracek
b718c506da [embedded] Fix arm64e pointer signing in embedded heap object destruction 2023-09-26 16:13:03 -07:00
Evan Wilde
700aa8aa70 Merge remote-tracking branch 'upstream/main' into rebranch
Merge conflict while removing `nocapture` from
`s21move_function_dbginfo20addressOnlyValueTestyyxAA1PRzlF`. Resolution
was to remove nocapture from the expected output in both cases:
```
// CHECK-LABEL: define swiftcc void @"$s21move_function_dbginfo20addressOnlyValueTestyyxAA1PRzlF"(ptr noalias[-nocapture-] %0, ptr %T, ptr %T.P)
```

Conflict cause: 4858cb6225
This is the same as the original change to this file. The conflict seems
to be due to the next line changing, when moving from llvm.dbg.addr to
llvm.dbg.value.

Conflicts:
  test/DebugInfo/move_function_dbginfo.swift
2023-09-26 13:36:57 -07:00
Kuba Mracek
0758e7da85 [embedded] Use posix_memalign from shims instead of manual declaration 2023-09-25 19:51:19 -07:00
Kuba Mracek
86ad378928 [embedded] Add a simple Swift runtime, written in embedded Swift 2023-09-25 19:51:19 -07:00