Commit Graph

111 Commits

Author SHA1 Message Date
Kuba Mracek
54a0be3509 [SwiftShims] Include Target.h in the modulemap for SwiftShims 2025-02-17 17:13:14 -08:00
Yuta Saito
35c3d7fd0e [wasm] Use __visibility__("default") for all wasm platforms
The condition previously depended on the specific OS, but the image
boundary is the same for all platforms using Wasm as image format. This
fixes the Emscripten build.
2025-02-13 02:07:36 +00:00
Alejandro Alonso
6fdb684fd2 Optimization for single component and fix tests 2025-02-04 15:16:39 -08:00
Alejandro Alonso
11fbd94668 Merge pull request #78664 from Azoy/unicode-16
[stdlib] Unicode 16
2025-01-21 09:29:35 -08:00
Alejandro Alonso
4e087653f2 Update Unicode data files in stdlib 2025-01-15 14:07:46 -08:00
Saleem Abdulrasool
358be09832 stdlib,Runtimes: begin preparing for a static stdlib on Windows
When building the standard library statically on Windows, we should not
use any __declspec(dllimport) or __declspec(dllexport) on the runtime
functions or data. Furthermore, we should internalise all of the
standard library functions so that they are not re-exported if used to
build a shared library. The code generation changes required for this
are easier to identify once a static SDK is available for Windows.
2025-01-08 15:08:14 -08:00
David Smith
26b2f7bb47 Re-land using associated objects to attach bridged Array buffers (#78452) 2025-01-07 19:38:21 -08:00
Alexis Laferrière
0c27a4c38c SwiftShims: memcmp should accept optional pointers on Darwin
Darwin defines memcmp with optional pointers. Update SwiftShims to
define it to the same type to avoid deserialization failures where we
get one over the other and the types don't match anymore.

rdar://140596571
2024-12-04 14:58:32 -08:00
Ian Anderson
052cc2ec0d Merge pull request #77349 from ian-twilightcoder/clang-headers-need-modulemaps
[CMake] clang-builtin-headers needs to copy the module maps as well as the headers
2024-11-08 12:25:48 -08:00
Ian Anderson
90a2bde994 [CMake] clang-builtin-headers needs to copy the module maps as well as the headers
When copying the clang builtin headers, the module maps need to go with them.

rdar://139084511
2024-11-01 11:24:10 -07:00
Kuba Mracek
db94dc7d36 [Concurrency] Fix memory leak around mismatched refcounting in Concurrency 2024-10-31 21:43:02 -07:00
Alejandro Alonso
cfd39367a5 Merge pull request #75048 from Benedicto-H/fix/typos-task
[Shims] Fix typos in RefCount.h
2024-08-29 09:28:11 -07:00
Ian Anderson
07a639ca9c [Shims] Don't redeclare lgamma_r in macOS 15.0 and associated SDKs
macOS 15.0, iOS 18.0, et al has started unconditionally declaring `lgamma_r` in <math.h>, add a __has_include in SwiftShims to detect that and not redeclare it when building against those SDK versions.

rdar://115192929
2024-08-16 09:00:09 -07:00
Mishal Shah
48d5aca28d Revert "Use associated objects to attach contiguous array buffers to lazy one…"
This reverts commit 7c011813f2.
2024-07-21 23:34:57 -07:00
David Smith
7c011813f2 Use associated objects to attach contiguous array buffers to lazy ones (#75148)
rdar://132124808
2024-07-19 23:21:41 -07:00
Jeremy Schonfeld
0216e62179 auto --> __swift_uint32_t 2024-07-12 10:07:42 -07:00
Jeremy Schonfeld
a3c614d924 Fix build failure in _SynchronizationShims module 2024-07-12 09:54:46 -07:00
Benedicto Hong
9ad83e71e0 Fix typos in RefCount.h
- Fixed several typos.
  - this -> `This`
  - constant -> `Constant`
  - Add a period at the end of a sentence `.`
2024-07-08 16:26:13 +09:00
Tim Kientzle
05c74e0d90 Revert "Merge pull request #74394 from tbkka/tbkka-remotemirror-no-more-mpe-metadata-partial"
This reverts commit a1708ef8b1, reversing
changes made to b5930625be.
2024-06-14 15:32:39 -07:00
Tim Kientzle
80e860881f Fix an ABI break
PR #74394 removed a field from `struct MetadataSections` whose layout is ABI.
So restore that field as an unused padding field to preserve the layout of all
the other fields in that struct.
2024-06-14 13:19:10 -07:00
Konrad `ktoso` Malawski
2ec717b115 [Concurrency] TaskExecutor ownership fixes (#74000) 2024-06-14 22:56:33 +09:00
Tim Kientzle
c20ef6de2a Remove RemoteInspection code to fetch no-longer-used reflection metadata
without relying on spare bit information in the reflection metadata
(which was added in #40906).  As a result, we can remove the
code from #40906.

This is the first step in such removal.  It removes the RemoteMirror
code for looking up such metadata.  It leaves behind:

* Sufficient stubs for LLDB to continue to build.  Once LLDB is updated, these stubs can be removed as well.

* The compiler code to emit such metadata.  This allows new binaries to still reflect MPEs on older runtimes.  This will need to be kept for a transitional period.
2024-06-13 09:34:43 -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
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