Commit Graph

21434 Commits

Author SHA1 Message Date
Alastair Houghton
e2c7ec6ee7 Merge pull request #75108 from al45tair/eng/PR-130992923
[Runtime][Win32] Fix fatalError() backtraces.
2024-07-11 14:49:19 +01:00
Mykola Pokhylets
816d62c972 Merge remote-tracking branch 'upstream/main' into mpokhylets/isolated-deinit
# Conflicts:
#	include/swift/Basic/Features.def
#	lib/SILGen/SILGenDestructor.cpp
#	test/Concurrency/flow_isolation.swift
#	test/abi/macOS/arm64/concurrency.swift
#	test/abi/macOS/x86_64/concurrency.swift
2024-07-11 13:11:59 +02:00
Mykola Pokhylets
e9173ff2f4 Make sure legacy executor checking mode is always used in swift_task_deinitOnExecutor() 2024-07-11 13:09:08 +02:00
Mykola Pokhylets
8dbddec82e Don't read current task executor to avoid extra access of the task-local storage. 2024-07-11 13:09:08 +02:00
Mykola Pokhylets
1b69068105 Keep current task executor when taking fast path in isolated deinit 2024-07-11 13:09:08 +02:00
Mykola Pokhylets
ab4d338f6a Added flags to be able to control task-locals behaviour in the future 2024-07-11 13:09:08 +02:00
Mykola Pokhylets
35f0334eb6 Rename performOnExecutor into deinitOnExecutor.
It cannot be used for executing general-purpose work, because such function would need to have a different signature to pass isolated actor instance.

And being explicit about using this method only for deinit allows to use object pointer for comparison with executor identity.
2024-07-11 13:09:07 +02:00
Mykola Pokhylets
a043ebf97a Don't switch threads when running isolated deinit of the default actor. 2024-07-11 13:09:07 +02:00
Mykola Pokhylets
cdba7b321f Removed explicit deinit from MainActor - not needed. 2024-07-11 13:09:07 +02:00
Mykola Pokhylets
f04f1de75e Fixed some typos 2024-07-11 13:09:07 +02:00
Mykola Pokhylets
72cad34662 Don't hop to @MainActor if already running on the main thread. 2024-07-11 13:09:06 +02:00
Mykola Pokhylets
62dbc6c966 Fixed some tests. Using extract_executor SIL instruction instead of custom code. 2024-07-11 13:09:06 +02:00
Mykola Pokhylets
b13da727b5 Removed declaration of the AdHocJob from the ABI headers 2024-07-11 13:09:06 +02:00
Mykola Pokhylets
411cdb7f73 Added unit-tests for (not)copying task-local values. Fixed release after deallocation. 2024-07-11 13:09:06 +02:00
Mykola Pokhylets
d4e449b62d SILGen for isolated deinit 2024-07-11 13:09:05 +02:00
Mykola Pokhylets
b7e23c2e2e Runtime support for isolated deinit 2024-07-11 13:09:04 +02:00
Alastair Houghton
a72c167af5 [Runtime][Win32] Further tweaks to SymbolInfo.cpp and Errors.cpp.
Fix an unused variable warning in `Errors.cpp`.

Use brace initialization syntax in `SymbolInfo.cpp` rather than using
a constructor call.

rdar://130992923
2024-07-11 11:51:59 +01:00
Tim Kientzle
fac8c972a5 Tailored error reporting when dynamic casts have nonsensical type args
This inserts a suitably named function into the stack trace whenever
a dynamic cast failure involves a NULL source or target type.
Very often, crash logs include backtraces with function names but
no log output; with this change, such a backtrace might look like
the following -- note `TARGET_TYPE_NULL` in the function name
here to mark the missing type information:

```
 frame #0: __pthread_kill + 8
 frame #1: pthread_kill + 288
 frame #2: abort + 128
 frame #3: swift::fatalErrorv()
 frame #4: swift::fatalError()
 frame #5: swift_dynamicCastFailure_TARGET_TYPE_NULL()
 frame #6: swift::swift_dynamicCastFailure()
 frame #7: ::swift_dynamicCast()
```

Resolves rdar://130630157
2024-07-10 15:57:36 -07:00
Doug Gregor
2a8b3fcf95 Merge pull request #75093 from DougGregor/unsafe-inherit-executor-vs-pound-isolation
Ensure that a `@_unsafeInheritExecutor` function does not depend on `#isolation`
2024-07-10 11:05:37 -07:00
Tim Kientzle
55d4a56c69 Merge pull request #74821 from tbkka/tbkka-bincompat
Upstream some binary-compatibility logic
2024-07-10 09:47:14 -07:00
Alastair Houghton
418a240e80 [Runtime][Win32] Tweak SymbolInfo slightly based on review comments.
Prefer `ZeroMemory()` to `::memset()` here.

Use `sizeof(*wszBuffer)` instead of `sizeof(WCHAR)`, just in case.

Don't use `*this=other`, because that motivates tests around `::free()`,
but instead pull the shared code out into some private functions.

Also, fix `SymbolInfo()` to initialize the pointer members.

rdar://130992923
2024-07-10 12:22:35 +01:00
Doug Gregor
8964436f36 Add _unsafeInheritExecutor_ version of TaskLocal.withValue 2024-07-09 15:38:38 -07:00
Allan Shortlidge
0ba007661a AST: Promote BuiltinAddressOfRawLayout to baseline. 2024-07-09 14:29:30 -07:00
Allan Shortlidge
45f3e94b46 AST: Promote AssociatedTypeImplements feature to baseline. 2024-07-09 14:28:30 -07:00
Allan Shortlidge
b85da32707 AST: Promote OptionalIsolatedParameters feature to baseline. 2024-07-09 14:28:29 -07:00
Allan Shortlidge
99dbbe4a12 AST: Promote BuiltinStoreRaw feature to baseline. 2024-07-09 14:28:29 -07:00
Allan Shortlidge
9717961202 AST: Promote BuiltinAllocVector feature to baseline. 2024-07-09 14:28:29 -07:00
Allan Shortlidge
ab99cac77d AST: Promote BuiltinUnprotectedStackAlloc feature to baseline. 2024-07-09 14:28:28 -07:00
Tim Kientzle
0ab1b1631d Upstream some binary-compatibility logic 2024-07-09 13:30:13 -07:00
Ian Anderson
dad0a21b01 Merge pull request #74920 from ian-twilightcoder/builtin_float_module-abi-name
[overlay] Support the older @rpath Darwin library for _Builtin_float's $ld$previous$ symbols
2024-07-09 12:04:37 -07:00
Alastair Houghton
8ad89c08e2 [Runtime][Win32] Fix fatalError() backtraces.
We were calling `SymInitialize()` multiple times, which is wrong, which
was making the `SymbolInfo::lookup()` call fail.  Also, we weren't
fetching the module names, so we should do that too.

rdar://130992923
2024-07-09 18:50:20 +01:00
Ian Anderson
9e9d66efc9 [overlay] Support the older @rpath Darwin library for _Builtin_float's $ld$previous$ symbols
The _Builtin_float symbols were moved twice, most recently from the OS Darwin library, but previously they were in the embedded @rpath Darwin library. @_originallyDefinedIn doesn't support multiple install names, but it can be replaced with -module-abi-name, and then multiple $ld$previous$ symbols can be used.
Update the Platform and Concurrency magic symbols to use $ld$previous$ everywhere.

rdar://130107191
2024-07-09 09:13:30 -07:00
Joe Groff
dfc5321ca6 Merge pull request #74997 from jckarter/protocol-extension-self-same-type-runtime-resolution
Runtime: Fix runtime type resolution when mangled names refer to protocol extensions with Self same type constraints.
2024-07-09 09:10:19 -07:00
Doug Gregor
a2038f92f8 Address code review feedback and fix rebase typo in a test 2024-07-09 08:13:24 -07:00
Konrad `ktoso` Malawski
a3e0b173ea [Concurrency] TaskExecutors may be non-swift objects; dont swift_release them (#75059) 2024-07-09 02:55:11 -07:00
Doug Gregor
a2b2324e7f Use @_unsafeInheritExecutor forms of with*Continuation from @_unsafeInheritExecutor functions
The move from `@_unsafeInheritExecutor` to `#isolation` for the
with*Continuation breaks code that is using `@_unsafeInheritExecutor` and
calling these APIs. This originally caused silent breakage (which manifest
as runtime crashes), and is now detected by the compiler as an error.

However, despite `@_unsafeInheritExecutor` being an unsafe,
not-intended-to-be-user-facing feature, it is indeed being used, along
with these APIs. Introduce _unsafeInheritExecutor_-prefixed versions of
the `with*Continuation` and `withTaskCancellationHandler` APIs into
the _Concurrency library that use `@_unsafeInheritExecutor`. Then,
teach the type checker to swap in these
_unsafeInheritExecutor_-prefixed versions in lieu of the originals
when they are called from an `@_unsafeInheritExecutor` function. This
allows existing code using `@_unsafeInheritExecutor` with these APIs
to continue working as it has before, albeit with a warning that
`@_unsafeInheritExecutor` has been removed.

Fixes rdar://131151376.
2024-07-08 23:35:37 -07:00
Allan Shortlidge
7e4425c97e Merge pull request #75090 from tshortli/no-more-ncg-condfails
AST: Remove `NoncopyableGenerics` feature suppression
2024-07-08 23:03:40 -07:00
Allan Shortlidge
b1bf693f3f stdlib: Remove #if $NoncopyableGenerics guards.
The stdlib is always built with NoncopyableGenerics enabled, so `#if
$NoncopyableGenerics` guards in non-inlinable code are superfluous.
Additionally, the stdlib's interface no longer needs to support compilers
without the feature, so the guards in inlinable code can also be removed.
2024-07-08 17:44:24 -07:00
Allan Shortlidge
20d97556ae stdlib: Remove #if $TypedThrows guards.
https://github.com/swiftlang/swift/pull/72612 can be reverted because it is no
longer necessary for the interface of the stdlib to be compatible with
compilers without `$TypedThrows` support.
2024-07-08 16:52:52 -07:00
Joe Groff
e0df8ffdb5 Runtime: Fix runtime type resolution when mangled names refer to protocol extensions with Self same type constraints.
If a type or opaque type descriptor appears inside of a protocol extension of the form:

```
extension P where Self == Nominal { ... }
```

then the runtime representation of the extension context was interpreted by the runtime
demangler as a nominal type extension, even though the parameterization is on the
`<Self>` generic signature of the protocol extension and not the generic signature of
the nominal type. This would cause spurious rejection of mangled names referencing the
extension context because we mistakenly thought that the type arguments mismatched with
the nominal type signature rather than matching them to the extension context.

Add some code to `_findExtendedTypeContextDescriptor` to detect when an extension is
a protocol extension with a `Self == SameType` constraint, and pass the extension along
rather than treating it as a nominal type extension. Fixes rdar://130168101.
2024-07-08 07:41:24 -07:00
Nate Cook
6d4f4a45cf Improve RangeSet union performance (#74963) 2024-07-08 09:00:37 -05:00
Alastair Houghton
565a9b9208 Merge pull request #75051 from al45tair/eng/PR-131294724
[Runtime] Add missing cast.
2024-07-08 13:27:08 +01:00
Egor Zhdan
71c81d5fc5 Merge pull request #74994 from swiftlang/egorzhdan/cxx-overlay-maccatalyst
[cxx-interop] Build Cxx and CxxStdlib modules for macCatalyst
2024-07-08 12:11:55 +01:00
Alastair Houghton
b6e7a5107a Merge pull request #75024 from Sajjon/cyon_typo_batch__stdlib
Typos: `stdlib`
2024-07-08 10:57:54 +01:00
Alastair Houghton
64b891d5fe [Runtime] Add missing cast.
Apparently we're missing a cast in `_swift_initRuntimePath()`.  Previously
this code was accidentally not being used, which is why we hadn't noticed
it.

rdar://131294724
2024-07-08 10:29:31 +01:00
Konrad `ktoso` Malawski
a8f68aab4b Merge pull request #75008 from kateinoigakukun/yt/fix-mutex-guard-wasm-thread
Concurrency: Guard TG state with a mutex even with cooperative executor
2024-07-08 17:56:31 +09: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
Konrad `ktoso` Malawski
df43b63f44 [Concurrency] Attempt to unbreak embedded build (#75006) 2024-07-08 11:21:12 +09:00
Konrad `ktoso` Malawski
3c75f2fac8 Add comment explaining #if guard 2024-07-08 10:49:38 +09:00
Konrad `ktoso` Malawski
5ad2291ac0 [Concurrency] Fix build in actors as locks configuration (#75004) 2024-07-07 10:37:33 +09:00