Commit Graph

3151 Commits

Author SHA1 Message Date
Dario Rexin
b97fbac9a6 [Runtime] Fix CVW for genreic single payload enums with no extra inha… (#73186)
* [Runtime] Fix CVW for genreic single payload enums with no extra inhabitants

rdar://126728925

When the payload of a generic SPE did not have any extra inhabitants, we erroneously always treated it as the no payload case.
Additionally the offset and skip values were improperly computed.

* Fixed FileCheck string
2024-04-22 22:56:57 -07:00
Mike Ash
84983353d3 [Runtime] Add the pointer location to the "failed to look up symbolic reference" error.
The pointer location can be computed from the symbolic reference location and offset, which we already provide, but it's not clear that you should add them together, nor is it clear why this failure would occur. Add the location of the NULL pointer itself to the error message, and also mention that it's probably caused by a missing weak symbol.
2024-04-19 10:48:44 -04:00
Tim Kientzle
9f2acb294f Merge pull request #72943 from tbkka/tbkka-rdar102906195
Fill in extended existential support for type(of:) and mirror
2024-04-11 12:31:42 -07:00
Mike Ash
b8f29cfda0 [Runtime] Allow disabling/enabling prespecializations library per-process.
Read a list of disabled process names from the prespecializations library, and turn the feature off if the current process matches. Also allow passing process names in environment variables. Processes can be disabled by name using SWIFT_DEBUG_LIB_PRESPECIALIZED_DISABLED_PROCESSES, and a disable can be overridden with SWIFT_DEBUG_LIB_PRESPECIALIZED_ENABLED_PROCESSES.

rdar://126216786
2024-04-10 14:29:19 -04:00
Tim Kientzle
810792843b Fill in extended existential support for type(of:) and mirror
type(of:) now returns the dynamic type of the contents of
an extended existential (just like it does for a regular existential)

Mirror can now reflect fields of a value stored inside an extended
existential (just like it can with a regular existential).  This
requires type(of:) support, since Mirror internals use that to
determine how to reflect a value.

Resolves rdar://102906195
2024-04-09 17:37:57 -07:00
Yuta Saito
ef07102b88 Merge pull request #72891 from kateinoigakukun/yt/fix-wasm-float16 2024-04-10 01:01:58 +09:00
eeckstein
648705e524 Merge pull request #72850 from eeckstein/sensitive
Add the experimental attribute `@sensitive` for struct declarations
2024-04-09 15:46:22 +02:00
Mike Ash
deab2fa5ef Merge pull request #72519 from mikeash/fix-validate-prespecialized-metadata
[Runtime] Fix _swift_validatePrespecializedMetadata when type lookup fails.
2024-04-09 09:14:39 -04:00
Erik Eckstein
ce33d47a4c stdlib: add the swift_clearSensitive runtime function 2024-04-09 12:01:10 +02:00
Saleem Abdulrasool
269565c9dd runtime: add an explicit cast for older C++ runtimes
The older C++ runtime seems to be unhappy with the implicit conversion
of the parameters:

~~~
FAILED: stdlib/public/runtime/CMakeFiles/swiftRuntime-linux-x86_64.dir/Errors.cpp.o
/home/build-user/build/buildbot_incremental_lsan/llvm-linux-x86_64/./bin/clang++ -DCMARK_STATIC_DEFINE -DGTEST_HAS_RTTI=0 -DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -DSWIFT_BUILD_SWIFT_SYNTAX -DSWIFT_INLINE_NAMESPACE=__runtime -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_HARDENED_MODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/build-user/build/buildbot_incremental_lsan/swift-linux-x86_64/stdlib/public/runtime -I/home/build-user/swift/stdlib/public/runtime -I/home/build-user/swift/stdlib/include -I/home/build-user/swift/stdlib/public/SwiftShims -I/home/build-user/build/buildbot_incremental_lsan/swift-linux-x86_64/include -I/home/build-user/swift/include -I/home/build-user/build/buildbot_incremental_lsan/llvm-linux-x86_64/include -I/home/build-user/llvm-project/clang/include -I/home/build-user/build/buildbot_incremental_lsan/llvm-linux-x86_64/tools/clang/include -I/home/build-user/cmark/src/include -I/home/build-user/build/buildbot_incremental_lsan/cmark-linux-x86_64/src -I/home/build-user/swift-corelibs-libdispatch/src/BlocksRuntime -I/home/build-user/swift-corelibs-libdispatch -gline-tables-only -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fno-omit-frame-pointer -fsanitize=leak -fdiagnostics-color -ffunction-sections -fdata-sections -O2 -DNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -funwind-tables -fno-rtti -Werror=gnu -Werror=c++98-compat-extra-semi -UNDEBUG -Werror=switch -Wimplicit-fallthrough -Wunreachable-code -Woverloaded-virtual -Wno-nested-anon-types -fno-sanitize=all -Wall -Wformat-nonliteral -Werror=format-nonliteral -Wglobal-constructors -Werror=global-constructors -Wexit-time-destructors -Werror=exit-time-destructors -DSWIFT_RUNTIME_CLOBBER_FREED_OBJECTS=1 -DswiftCore_EXPORTS -I/home/build-user/swift/stdlib/include/llvm/Support -I/home/build-user/swift/include -DSWIFT_TARGET_LIBRARY_NAME=swiftRuntime -DSWIFT_RUNTIME -DSWIFT_LIB_SUBDIR="linux" -DSWIFT_ARCH="x86_64" -target x86_64-unknown-linux-gnu -fno-omit-frame-pointer -O0 -g -mcx16 -DSWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS -march=core2 -DSWIFT_OBJC_INTEROP=0 -DSWIFT_LIBRARY_EVOLUTION=1 -DSWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT -DSWIFT_ENABLE_REFLECTION -DSWIFT_STDLIB_HAS_DLADDR -DSWIFT_STDLIB_HAS_DLSYM=1 -DSWIFT_STDLIB_HAS_FILESYSTEM -DSWIFT_STDLIB_HAS_DARWIN_LIBMALLOC=1 -DSWIFT_STDLIB_HAS_STDIN -DSWIFT_STDLIB_HAS_ENVIRON -DSWIFT_STDLIB_HAS_LOCALE -DSWIFT_THREADING_LINUX -DSWIFT_RUNTIME_OS_VERSIONING -DSWIFT_STDLIB_SHORT_MANGLING_LOOKUPS -DSWIFT_STDLIB_ENABLE_VECTOR_TYPES -DSWIFT_STDLIB_HAS_TYPE_PRINTING -DSWIFT_STDLIB_SUPPORTS_BACKTRACE_REPORTING -DSWIFT_STDLIB_ENABLE_UNICODE_DATA -DSWIFT_STDLIB_OVERRIDABLE_RETAIN_RELEASE -std=c++17 -MD -MT stdlib/public/runtime/CMakeFiles/swiftRuntime-linux-x86_64.dir/Errors.cpp.o -MF stdlib/public/runtime/CMakeFiles/swiftRuntime-linux-x86_64.dir/Errors.cpp.o.d -o stdlib/public/runtime/CMakeFiles/swiftRuntime-linux-x86_64.dir/Errors.cpp.o -c /home/build-user/swift/stdlib/public/runtime/Errors.cpp
/home/build-user/swift/stdlib/public/runtime/Errors.cpp:315:13: error: no matching function for call to 'atomic_compare_exchange_strong_explicit'
315 | } while (!std::atomic_compare_exchange_strong_explicit(&kFatalErrorMessage,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../include/c++/7/atomic:1121:5: note: candidate template ignored: deduced conflicting types for parameter '_ITp' ('const char ' vs. 'char ')
1121 | atomic_compare_exchange_strong_explicit(atomic<_ITp> __a,
| ^
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../include/c++/7/atomic:1129:5: note: candidate template ignored: deduced conflicting types for parameter '_ITp' ('const char ' vs. 'char ')
1129 | atomic_compare_exchange_strong_explicit(volatile atomic<_ITp> __a,
| ^
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../include/c++/7/bits/shared_ptr_atomic.h:220:5: note: candidate template ignored: could not match 'shared_ptr' against 'atomic'
220 | atomic_compare_exchange_strong_explicit(shared_ptr<_Tp> __p,
| ^
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../include/c++/7/bits/shared_ptr_atomic.h:272:5: note: candidate template ignored: could not match '__shared_ptr' against 'atomic'
272 | atomic_compare_exchange_strong_explicit(__shared_ptr<_Tp, _Lp> __p,
| ^
1 error generated.
~~~

Use an explicit cast to resolve the ambiguity.
2024-04-08 10:28:31 -07:00
Yuta Saito
c32c7f55fe [wasm] Fix build failure due to lack of _Float16 support
WebAssembly does not support _Float16 type, so we need to guard the use
of the type. Unfortunately, Clang does not provide a good way to detect
the support of _Float16 type at compile time, so just disable for wasm
targets.
2024-04-07 16:34:11 +00:00
Saleem Abdulrasool
2de6442e93 Merge pull request #72785 from compnerd/error-storage
Runtime: add a non-Darwin error message storage
2024-04-06 12:03:12 +09:00
Stephen Canon
6ac852f3f4 Move Float16 print tests to their own file and test exhaustively (#72859)
We can easily test all 2**16 values, so let's do it. Also now _Float16 is properly supported in clang, so we can pass arguments to CPP that way, which lets us get snan right on more platforms.
2024-04-05 19:55:19 -04:00
Saleem Abdulrasool
32a2dfc566 Runtime: add a non-Darwin error message storage
This introduces a non-Darwin (non-CrashReporter) storage for error
messages to allow extraction for crash reporting. This is initially
meant to be used on Windows, though it is generic enough to be used on
any platform.
2024-04-05 14:02:09 -07:00
Mike Ash
2841b5944a Merge pull request #72870 from mikeash/libprespecialize-address-range-rejection
[Runtime] Don't attempt to look up prespecialized metadata involving pointers outside the shared cache.
2024-04-05 14:31:04 -04:00
Alastair Houghton
6932f9e02d Merge pull request #72833 from al45tair/eng/PR-125727356
[Runtime] Disable prespecialized metadata if we have overridden images.
2024-04-05 17:49:36 +01:00
Mike Ash
98229fe4db [Runtime] Don't attempt to look up prespecialized metadata involving pointers outside the shared cache.
The descriptor and arguments for prespecialized metadata will always be in the shared cache. Skip creating the mangling for any lookup involving pointers outside the shared cache, as an optimization.
2024-04-05 10:19:34 -04:00
Anton Korobeynikov
c7a216058f [AutoDiff] First cut of coroutines differentiation (#71461)
This PR implements first set of changes required to support autodiff for coroutines. It mostly targeted to `_modify` accessors in standard library (and beyond), but overall implementation is quite generic.

There are some specifics of implementation and known limitations:
 - Only `@yield_once` coroutines are naturally supported
 - VJP is a coroutine itself: it yields the results *and* returns a pullback closure as a normal return. This allows us to capture values produced in resume part of a coroutine (this is required for defers and other cleanups / commits)
 - Pullback is a coroutine, we assume that coroutine cannot abort and therefore we execute the original coroutine in reverse from return via yield and then back to the entry
 - It seems there is no semantically sane way to support `_read` coroutines (as we will need to "accept" adjoints via yields), therefore only coroutines with inout yields are supported (`_modify` accessors). Pullbacks of such coroutines take adjoint buffer as input argument, yield this buffer (to accumulate adjoint values in the caller) and finally return the adjoints indirectly.
 - Coroutines (as opposed to normal functions) are not first-class values: there is no AST type for them, one cannot e.g. store them into tuples, etc. So, everywhere where AST type is required, we have to hack around.
 - As there is no AST type for coroutines, there is no way one could register custom derivative for coroutines. So far only compiler-produced derivatives are supported
 - There are lots of common things wrt normal function apply's, but still there are subtle but important differences. I tried to organize the code to enable code reuse, still it was not always possible, so some code duplication could be seen
 - The order of how pullback closures are produced in VJP is a bit different: for normal apply's VJP produces both value and pullback closure via a single nested VJP apply. This is not so anymore with coroutine VJP's: yielded values are produced at `begin_apply` site and pullback closure is available only from `end_apply`, so we need to track the order in which pullbacks are produced (and arrange consumption of the values accordingly – effectively delay them)
 - On the way some complementary changes were required in e.g. mangler / demangler

This patch covers the generation of derivatives up to SIL level, however, it is not enough as codegen of `partial_apply` of a coroutine is completely broken. The fix for this will be submitted separately as it is not directly autodiff-related.

---------

Co-authored-by: Andrew Savonichev <andrew.savonichev@gmail.com>
Co-authored-by: Richard Wei <rxwei@apple.com>
2024-04-04 17:24:55 -07:00
Alastair Houghton
419214daf9 [Runtime] Disable prespecialized metadata if we have overridden images.
We need to check for overridden images on every image load, otherwise
XCTest (among others) may `dlopen()` an image that pulls in something
that is overridden, at which point the prespecialized metadata won't
match the image we loaded.

rdar://125727356
2024-04-04 16:20:12 +01:00
Doug Gregor
ae01d20428 Runtime checking for associated types conforming to invertible protocols
Emit metadata for runtime checks of conformances of associated types to
invertible protocols, e.g., `T.Assoc: Copyable`. This allows us to
correctly handle, e.g., dynamic casting involving conditional
conformances that have such constraints.

The model we use here is to emit an invertible-protocol constraint
that leaves only the specific bit clear in the invertible protocol
set.
2024-04-02 16:42:16 -07:00
Doug Gregor
b84f8ab080 Rename "suppressible protocols" to "invertible protocols".
We've decided to use the "invertible protocols" terminology throughout
the runtime and compiler, so move over to that terminology
consistently.
2024-03-29 11:31:48 -07:00
Konrad `ktoso` Malawski
86f5441294 [SerialExecutor] SerialExecutor.checkIsolated() to check its own tracking for isolation checks (#71172) 2024-03-29 07:06:34 +09:00
Doug Gregor
bbfdf7b36a Merge pull request #72470 from DougGregor/dynamic-suppressible-protocols
Metadata and runtime support for suppressible protocol requirements
2024-03-27 11:49:00 -07:00
Doug Gregor
cd20dbafbf [Runtime] Don't check suppressible protocols for non-key generic arguments 2024-03-26 21:33:53 -07:00
Mike Ash
fe9de7beb5 [Runtime] Fix _swift_validatePrespecializedMetadata when type lookup fails.
When we fail to look up a type by name, we print an error, then try to compare anyway, which crashes. Skip the comparison when that happens.

While we're in there, modify _swift_validatePrespecializedMetadata to be more useful for debugging, by removing the parameters and having it print the results directly.
2024-03-22 13:52:32 -04:00
Doug Gregor
af38d88ba3 Fix typos spotted by code review, thank you! 2024-03-22 08:28:45 -07:00
Doug Gregor
11774e5d17 [Runtime] Check function types against suppressible protocols
Form a set of suppressed protocols for a function type based on
the extended flags (where future compilers can start recording
suppressible protocols) and the existing "noescape" bit. Compare
that against the "ignored" suppressible protocol requirements, as we
do for other types.

This involves a behavior change if any client has managed to evade the
static checking for noescape function types, but it's unlikely that
existing code has done so (and it was unsafe anyway).
2024-03-22 07:45:50 -07:00
Doug Gregor
5b020068c5 Extend runtime checking for suppressible protocols
Add more runtime support for checking suppressible protocol requirements:
* Parameter packs now check all of the arguments appropriately
* Most structural types now implement checking (these are hard to test).
2024-03-21 19:22:28 -07:00
Doug Gregor
b167eece42 Metadata and runtime support for suppressible protocol requirements
Introduce metadata and runtime support for describing conformances to
"suppressible" protocols such as `Copyable`. The metadata changes occur
in several different places:

* Context descriptors gain a flag bit to indicate when the type itself has
  suppressed one or more suppressible protocols (e.g., it is `~Copyable`).
  When the bit is set, the context will have a trailing
  `SuppressibleProtocolSet`, a 16-bit bitfield that records one bit for
  each suppressed protocol. Types with no suppressed conformances will
  leave the bit unset (so the metadata is unchanged), and older runtimes
  don't look at the bit, so they will ignore the extra data.
* Generic context descriptors gain a flag bit to indicate when the type
  has conditional conformances to suppressible protocols. When set,
  there will be trailing metadata containing another
  `SuppressibleProtocolSet` (a subset of the one in the main context
  descriptor) indicating which suppressible protocols have conditional
  conformances, followed by the actual lists of generic requirements
  for each of the conditional conformances. Again, if there are no
  conditional conformances to suppressible protocols, the bit won't be
  set. Old runtimes ignore the bit and any trailing metadata.
* Generic requirements get a new "kind", which provides an ignored
  protocol set (another `SuppressibleProtocolSet`) stating which
  suppressible protocols should *not* be checked for the subject type
  of the generic requirement. For example, this encodes a requirement
  like `T: ~Copyable`. These generic requirements can occur anywhere
  that there is a generic requirement list, e.g., conditional
  conformances and extended existentials. Older runtimes handle unknown
  generic requirement kinds by stating that the requirement isn't
  satisfied.

Extend the runtime to perform checking of the suppressible
conformances on generic arguments as part of checking generic
requirements. This checking follows the defaults of the language, which
is that every generic argument must conform to each of the suppressible
protocols unless there is an explicit generic requirement that states
which suppressible protocols to ignore. Thus, a generic parameter list
`<T, Y where T: ~Escapable>` will check that `T` is `Copyable` but
not that it is `Escapable`, and check that `U` is both `Copyable` and
`Escapable`. To implement this, we collect the ignored protocol sets
from these suppressed requirements while processing the generic
requirements, then check all of the generic arguments against any
conformances not suppressed.

Answering the actual question "does `X` conform to `Copyable`?" (for
any suppressible protocol) looks at the context descriptor metadata to
answer the question, e.g.,

1. If there is no "suppressed protocol set", then the type conforms.
This covers types that haven't suppressed any conformances, including
all types that predate noncopyable generics.
2. If the suppressed protocol set doesn't contain `Copyable`, then the
type conforms.
3. If the type is generic and has a conditional conformance to
`Copyable`, evaluate the generic requirements for that conditional
conformance to answer whether it conforms.

The procedure above handles the bits of a `SuppressibleProtocolSet`
opaquely, with no mapping down to specific protocols. Therefore, the
same implementation will work even with future suppressible protocols,
including back deployment.

The end result of this is that we can dynamically evaluate conditional
conformances to protocols that depend on conformances to suppressible
protocols.

Implements rdar://123466649.
2024-03-21 14:57:47 -07:00
Mike Ash
0491192337 [Runtime] Remove ExternalGenericMetadataBuilder. 2024-03-21 17:56:17 -04:00
Doug Gregor
735e28b551 Merge pull request #72336 from DougGregor/demangle-inverse-requirements-to-ast
Demangle inverse requirements when building AST types
2024-03-14 17:30:49 -07:00
Doug Gregor
a2ae2149e8 Demangle inverse requirements when building AST types
Extend TypeDecoder with support for inverse requirements, passing them
along to the type builder. Then implement support for inverse
requirements within the AST demangler, which addresses the round-trip
demangling failures we've been seeing.

The runtime and remote inspection facilities still need metadata to
deal with inverse requirements.

Fixes rdar://124564447.
2024-03-14 14:01:53 -07:00
Ben Barham
9779c18da3 Rename startswith to starts_with
LLVM is presumably moving towards `std::string_view` -
`StringRef::startswith` is deprecated on tip. `SmallString::startswith`
was just renamed there (maybe with some small deprecation inbetween, but
if so, we've missed it).

The `SmallString::startswith` references were moved to
`.str().starts_with()`, rather than adding the `starts_with` on
`stable/20230725` as we only had a few of them. Open to switching that
over if anyone feels strongly though.
2024-03-13 22:25:47 -07:00
Mike Ash
3100be12fa [Runtime] Don't enable tracing in logd, diagnosticd, notifyd.
We can't use os_log functionality in logd, diagnosticd, or notifyd. Check for them and disable tracing in those processes.

Add a new TracingCommon.h for common code shared between swiftCore and swift_Concurrency tracing. Add a single function that checks if tracing should be enabled, which now checks if os_signpost_enabled is available, and if the process is one of these. Modify the tracing code to check this before creating os_log objects.

rdar://124226334
2024-03-11 21:06:15 -04:00
Alastair Houghton
07031a1ab5 [Tests] Fix LongRefcounting test.
We were retaining one too many times in the two `_DeathTest` tests,
which caused the tests to fail.  This was previously masked by a bug.

rdar://124212794
2024-03-07 16:33:49 +00: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
Mike Ash
9200364f8c Merge pull request #71926 from mikeash/instancestart-size-no-shrink
[Runtime] Don't shrink class InstanceStart when initing field offset vectors.
2024-02-29 09:41:43 -05:00
Konrad `ktoso` Malawski
c56a1e8be7 [Distributed] Handle mangling thunks in extensions with generic AS and $Stubs (#71914) 2024-02-29 04:22:00 -08:00
Tim Kientzle
2be0f047f8 Missing include 2024-02-28 10:42:52 -08:00
Mike Ash
a71eaf15db [Runtime] Don't shrink class InstanceStart when initing field offset vectors.
When ObjC interop is enabled, we emit what we think will be the class's InstanceStart and InstanceSize based on what we know about the superclass. We then fix up those values at runtime if they don't match. The compiler will emit this data into read-only memory if it knows they will always match, and then the runtime avoids writing to these fields if they already contain the correct value.

However, the compiler aligns the InstanceStart, but instance size is not aligned. For example:

class Super<T> { var bool = true }
class Sub: Super<Int> { var obj: AnyObject? }

Super's InstanceSize is 17 (on 64-bit) but Sub's InstanceStart is 24. The compiler sees a fixed layout and emits Sub's rodata into constant memory. The runtime sees that 24 does not equal 17 and tries to update it, but we don't want it to.

Instead, only update InstanceStart if it's too small to accommodate the superclass's InstanceSize. If it's overlay large then we'll just leave it alone. The compiler underestimates InstanceStart when it doesn't know the superclass's size so this should only happen due to alignment.

rdar://123695998
2024-02-28 10:49:42 -05:00
Tim Kientzle
5337c8b208 Preserve legacy behavior on Apple OSes in all environments 2024-02-27 17:46:49 -08:00
Tim Kientzle
fac88221c5 Fix hash/isEqual interop conditionals, update tests
Github PR #71620 mixed up one of the bincompat conditionals.
It also had some errors in the tests for ObjC interop.

For now, this leaves the legacy behavior in place for
all Apple platforms.
2024-02-27 17:46:49 -08:00
Mike Ash
20d60406cb [Runtime] Harden SWIFT_DEBUG_LIB_PRESPECIALIZED_PATH.
Have SWIFT_DEBUG_LIB_PRESPECIALIZED_PATH use dlopen with RTLD_NOLOAD. We don't want it to allow loading arbitrary dylibs. Instead, a user can use something like DYLD_INSERT_LIBRARIES to load the dylib, which we will then pick up in the runtime, and processes that deny DYLD_INSERT_LIBRARIES will not be able to work around it with SWIFT_DEBUG_LIB_PRESPECIALIZED_PATH.

rdar://123643585
2024-02-26 14:38:09 -05: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
Ben Barham
ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00
Yuta Saito
d3d4bd203c Merge pull request #71768 from kateinoigakukun/pr-5b0947b86ee45b937e9b6fedd0963644227b754d 2024-02-22 04:07:42 +09:00
Yuta Saito
f3f13a2637 [wasm] Enable --gc-sections for WebAssembly by default
This change enables the `--gc-sections` linker flag for WebAssembly
targets by default. This flag has been disabled because it did not
respect `llvm.used` and it caused stripping `swift5` metadata sections
even though they were used through encapsulation symbols (a.k.a `__start`/`__stop`).

The issue has been fixed in the LLVM side (ba3c1f9ce3)
by adding new segment flags to the WebAssembly object file format.
2024-02-21 02:13:01 +00:00
Joe Groff
b9f91144d1 Fix ABI breakage caused by ValueOwnership order change.
The `ABI` headers had accidentally grown an `#include` into compiler headers,
allowing the enum constant values of the `ValueOwnership` enum to leak into
the runtime ABI. Sever this inappropriate relationship by declaring a separate
`ParameterOwnership` enum with ABI-stable values in the ABI headers, and
explicitly converting between the AST and ABI representation where needed.
Fixes rdar://122435628.
2024-02-20 07:55:16 -08:00
Michael Gottesman
f4efcec55c [transferring] Add mangling support for transferring.
This includes runtime support for instantiating transferring param/result in
function types. This is especially important since that is how we instantiate
function types like: typealias Fn = (transferring X) -> ().

rdar://123118061
2024-02-19 12:11:57 -08:00
Jonathan Grynspan
d35dcc8f9c Add swift5_tests to MetadataSections. (#71509) 2024-02-19 13:47:40 -05:00