Alastair Houghton
e5ece81cc9
[Freestanding] Remove uses of stat() and dlsym().
...
We shouldn't be using stat() or dlsym() in the freestanding
runtime.
rdar://111214571
rdar://106555012
2023-06-23 17:05:59 +01:00
Dario Rexin
36ddb77fcd
[IRGen+Runtime] Layout string getEnumTag for generic multi payload enums ( #66872 )
...
We already store all necessary information to extract the tag in the layout string, so we should utilize it for the getEnumTag witness
2023-06-22 19:07:50 -07:00
Alastair Houghton
4f4d0147ca
Merge pull request #66721 from al45tair/eng/PR-110665213
...
[Threading][TSan] Fix TSan errors from lazy init on Linux.
2023-06-22 20:03:00 +01:00
Dario Rexin
37220ed37f
[Runtime] Handle generic multi payload enums in resilient resolve ( #66848 )
...
* [Runtime] Handle generic multi payload enums in resilient resolve
* Update BytecodeLayouts.cpp
* Update BytecodeLayouts.cpp
2023-06-22 12:02:46 -07:00
Dario Rexin
c3ae41381d
[Runtime] Use proper offset in generic multi payload enum layout strings ( #66856 )
2023-06-22 12:02:33 -07:00
Dario Rexin
806fd1b58b
[Runtime] Handle generic single payload enums in resilient resolve ( #66849 )
2023-06-22 10:53:55 -07:00
David Smith
e20be0edc6
Revert [Runtime] Let CF provide us with state, avoiding runtime lookup. rdar://111104451 ( #66606 )
2023-06-22 10:24:51 -07:00
Yuta Saito
a613ab2521
Revert "Revert "Merge pull request #66793 from kateinoigakukun/pr-a75d757a3dcce5b990423cf1ab73ba4cd2f95b10""
...
This reverts commit 7aa4a8de06 .
2023-06-22 08:31:32 +00:00
Yuta Saito
ad9409b517
[static-stdlib] NFC: Generalize the static-executable-args.lnk file generation
...
This patch makes the build system to copy the lnk files for each
stdlib targets if needed instead of only for the Linux target.
This is the take 2 of the patch. The first one was reverted in
7aa4a8de06
2023-06-22 08:30:37 +00:00
Dario Rexin
fd369cd050
[Runtime] Refactor layout string code ( #66831 )
...
Made the code a bit more readable by adding a reader and writer type that encapsulate
the layout string and offset.
2023-06-21 19:46:22 -07:00
Slava Pestov
3676379302
Merge pull request #66814 from slavapestov/variadic-type-conditional-conformance
...
Conditional conformances for variadic generic types
2023-06-21 17:52:28 -04:00
Slava Pestov
8742b1a1e2
Runtime: Fix shape requirement handling in _checkGenericRequirements()
...
We would say the shape requirement was always satisfied since we
incorrectly checked the left-hand side type twice.
2023-06-21 15:03:53 -04:00
Slava Pestov
3052e36f7e
Runtime: Fix dynamic casts of variadic types that conditionally conform
2023-06-21 13:42:57 -04:00
Slava Pestov
d1cb9307c9
Runtime: Support for conditional conformances with pack conformance requirements
2023-06-21 13:42:57 -04:00
Max Desiatov
bcc102d621
Revert "Merge pull request #66759 from kateinoigakukun/pr-a33fc5da8cdbc494e3935399dd7b74eba2288267"
...
This reverts commit 0795dede1c , reversing
changes made to 0845bc1373 .
2023-06-21 17:55:05 +01:00
Max Desiatov
7aa4a8de06
Revert "Merge pull request #66793 from kateinoigakukun/pr-a75d757a3dcce5b990423cf1ab73ba4cd2f95b10"
...
This reverts commit c9d20c4024 , reversing
changes made to ca0061dab7 .
2023-06-21 17:54:43 +01:00
David Smith
7eb8283a49
[Runtime] Let CF provide us with state, avoiding runtime lookup. rdar://111104451 ( #66606 )
...
Provide a hook for CF to tell us about the state we need from it, rather than us having to look it up at runtime
2023-06-21 08:38:14 -07:00
Yuta Saito
c9d20c4024
Merge pull request #66793 from kateinoigakukun/pr-a75d757a3dcce5b990423cf1ab73ba4cd2f95b10
...
[static-stdlib] Add static executable support for WASI target
2023-06-21 18:19:47 +09:00
Dario Rexin
493a25faae
[IRGen+Runtime] Add layout string support for generic single payload enums ( #66791 )
2023-06-20 20:46:54 -07:00
Yuta Saito
2555dc7e35
[static-stdlib] Add static executable support for WASI target
...
This patch adds static-executble-args.lnk file for WASI target
2023-06-21 03:29:20 +00:00
swift-ci
0795dede1c
Merge pull request #66759 from kateinoigakukun/pr-a33fc5da8cdbc494e3935399dd7b74eba2288267
...
[static-stdlib] NFC: Generalize the static-executable-args.lnk file generation
2023-06-20 20:22:44 -07:00
Yuta Saito
29b27374d9
[static-stdlib] NFC: Generalize the static-executable-args.lnk file generation
...
This patch makes the build system to copy the lnk files for each
stdlib targets if needed instead of only for the Linux target.
Co-authored-by: Max Desiatov <m_desiatov@apple.com >
2023-06-21 01:07:32 +00:00
Yuta Saito
ae0a061663
Merge pull request #66543 from kateinoigakukun/pr-b1e7535cbac5af8c5e06068a747c1b925d571265
...
[wasm] Add metadata registration for WebAssembly
2023-06-20 19:52:07 +09:00
Alastair Houghton
bad716f2cd
[Threading][TSan] Rearrange things again.
...
We need ThreadSanitizer.cpp in libswiftCore for the runtime case, but
we also need it in libswiftThreading for non-runtime cases.
rdar://1106655213
2023-06-19 17:00:39 +01:00
Alastair Houghton
8ed8a28478
[Threading][TSan] Move ThreadSanitizer.cpp into the main runtime.
...
On Darwin, `RTLD_NEXT` doesn't do what we need it to here, with the
result that if `libswiftCore`'s TSan initializer gets found first,
then `libswift_Concurrency` won't have its initializer called at all,
in spite of us using `RTLD_NEXT` to find the next definition.
Fix this by centralising the initializer in `libswiftCore` instead.
rdar://110665213
2023-06-19 15:33:36 +01:00
Yuta Saito
f527f72640
Merge pull request #66423 from kateinoigakukun/pr-0c7c2f57b05a694965ab652f57cbfead006a33d7
...
[static-stdlib] Move static-executable-args.lnk under stdlib/public/Resources/linux
2023-06-19 19:30:53 +09:00
Yuta Saito
8d84a64556
[wasm] Add metadata registration for WebAssembly
...
This patch adds the metadata registration for the wasm targets, and also
adds build support for it.
2023-06-19 06:13:20 +00:00
Dario Rexin
d74c085fe8
[Runtime+IRGen] Add layout string support for generic singleton enums ( #66647 )
2023-06-14 20:13:15 -07:00
Saleem Abdulrasool
df71ee08ba
Merge pull request #66524 from hjyamauchi/dump-generic-metadata
...
Fix the swift-inspect dump-generic-metadata operation.
2023-06-14 14:48:07 -07:00
swift-ci
12b1843289
Merge pull request #66377 from mikeash/section-scan-signposts
...
[Runtime] Add tracing for section scans.
2023-06-14 13:50:28 -07:00
Dario Rexin
8b48a0d3e0
[Runtime+IRGen] Instantiate layout strings for generic multi payload enum ( #66621 )
...
Instantiating layout strings for generic types reduces code size and is expected to improve performance of generic value witnesses.
2023-06-14 09:31:11 -07:00
Mike Ash
110f428780
[Runtime] Add tracing for section scans.
...
Section scans (for metadata, protocols, etc.) can be costly. This change adds tracing calls to those scans so we can more easily see how much time is spent in these scans and where they're initiated.
This adds an os_signpost implementation controlled by SWIFT_STDLIB_TRACING, and a default empty implementation for when that's disabled.
rdar://110266743
2023-06-14 12:07:44 -04:00
Alastair Houghton
dd7acb1739
[Backtracing][Linux] Properly align the stacks.
...
We have two stacks that we set up during crash handling, both of
which were potentially misaligned. This only tripped us up on
Ubuntu 20.04 on aarch64 - my guess is that maybe `clone()` aligns
the stack pointer on newer kernels which is why we didn't see it
on 22.04.
rdar://110743884
2023-06-14 13:40:51 +01:00
Dario Rexin
58ff42af16
[Runtime] Properly handle tuple types in layout string instantiation ( #66603 )
...
Tuple types contain metadata entries for each element, so we can handle them individually to avoid unnecessary indirection.
2023-06-13 13:48:05 -07:00
Alastair Houghton
7145ff019d
Merge pull request #66567 from al45tair/eng/PR-110653167
...
[Backtracing][Linux] Fix Ubuntu 20.04-aarch64 CI failures.
2023-06-13 15:50:01 +01:00
Dario Rexin
4ec82768ce
[Runtime] Extract some layout string functionality into separate functions ( #66577 )
...
We want to re-use them for enum layout string instantiation, so best to pull them into separate functions.
2023-06-12 23:40:58 -07:00
Alastair Houghton
7e632c0ee0
[Backtracing][Linux] Fix Ubuntu 20.04-aarch64 CI failures.
...
These seem to be related to signal handling issues in threads that
have been started presumably by the C library or some other library.
Primarily this appears to affect Ubuntu 20.04 on aarch64, though I
have seen sporadic issues on 18.04 as well.
We address the problem by making the thread suspension mechanism
more robust in the face of threads with masked signals.
rdar://110653167
2023-06-12 18:54:05 +01:00
Yuta Saito
3198412db0
[wasm][stdlib] Fix return-address strategy selection
...
__GNUC__ can be defined on Wasm targets as well, so we need to check
__wasm__ first.
2023-06-10 10:15:34 +00:00
Dario Rexin
91d547f982
[Runtime] Properly handle unaligned reads in readTagBytes for layout strings ( #66506 )
2023-06-09 23:02:34 -07:00
Hiroshi Yamauchi
50ef384f88
Fix the swift-inspect dump-generic-metadata operation.
...
ReflectionContext::allocationMetadataPointer() was reading the
metadata pointer from a wrong offset because of the out-of-sync struct
layouts and dump-generic-metadata was not working correctly.
This change resync's the layouts and adds a static_assert to verify
that the offsets match between GenericMetadataCacheEntry and
GenericCacheEntry.
2023-06-09 18:33:06 -07:00
Alastair Houghton
be7725f0fd
[Backtracing][Linux] Include declarations for gettid() and tgkill().
...
Older glibc doesn't include these. Nor does Musl, it seems. The
previous fix put the gettid() declaration too far down the file.
rdar://110417355
2023-06-09 09:04:27 +01:00
Yuta Saito
2410da4259
[static-stdlib] Move static-executable-args.lnk under stdlib/public/Resources/linux
...
This is a preparatory change for adding a static executable support for WASI
2023-06-08 11:46:18 +00:00
Alastair Houghton
77de53b944
[Backtracing][Linux] Use syscall() to call gettid().
...
Older versions of Linux don't have gettid() in their headers, so
use syscall() to call it instead.
rdar://110417355
2023-06-07 21:24:32 +01:00
Alastair Houghton
0b9747e77a
[Backtracing] Also update the Linux crash handler, now it's merged.
...
The Linux crash handler should have the same `output-to` behaviour
as on macOS.
rdar://110371557
2023-06-07 13:55:17 +01:00
Alastair Houghton
2f0e42ba8d
[Backtracing] Use stderr by default unless interactive.
...
This means we don't need to specify `output-to` in CI.
rdar://110371557
2023-06-07 13:54:36 +01:00
Alastair Houghton
5d03a72dcb
Merge pull request #66338 from al45tair/eng/PR-101623265
...
[Backtracing][Linux] Enable Linux backtracing, add tests.
2023-06-07 13:49:49 +01:00
Alastair Houghton
d67354473f
Merge pull request #66335 from al45tair/eng/PR-110261712
...
[Backtracing][Linux] Add support for Linux in the _Backtracing module.
2023-06-07 13:48:46 +01:00
Alastair Houghton
3042cd742e
[Backtracing][Linux] Enable backtrace-on-crash for Linux.
...
This reverts commit e5f4c2015e .
rdar://101623265
2023-06-07 09:08:18 +01:00
Alastair Houghton
ae9a0c1007
Merge pull request #66334 from al45tair/eng/PR-110261430
...
[Backtracing][Linux] Add Linux crash handler to the runtime.
2023-06-07 08:41:28 +01:00
Alastair Houghton
1262518ee4
[Backtracing][Linux] Add a comment about __cxa_demangle.
...
`__cxa_demangle()` is a rather unusual API; one of its "features" is that
the pointer you pass in must either be `nullptr`, in which case it
will call `malloc()` itself, _or_ it has to be a pointer to a block
of memory allocated with `malloc()`, because `__cxa_demangle()` may
`realloc()` it for you.
This seems to me to be something of a non-obvious footgun, so we never
pass the caller's pointer through to `__cxa_demangle()`, which lets them
decide how they want to allocate space.
rdar://110261712
2023-06-07 08:22:40 +01:00