Commit Graph

21434 Commits

Author SHA1 Message Date
Pavel Yaskevich
4d45701046 [Sema/IRGen] Extend ad-hoc requirement handling to DistributedTargetInvocationDecoder.decodeNextArgument 2024-02-12 14:26:30 -08:00
Pavel Yaskevich
4f32111bf8 [Sema/IRGen] Extend ad-hoc requirement handling to DistributedTargetInvocationEncoder.record{Argument, ReturnType} 2024-02-12 14:26:30 -08:00
Pavel Yaskevich
e59727aa3d [stdlib] Distributed: Promote remoteCall{Void} into protocol requirements 2024-02-12 13:30:59 -08:00
Konrad `ktoso` Malawski
68eab70a18 [Distributed] whenLocal adoption of typed throws (#71439) 2024-02-10 10:16:36 +09:00
Doug Gregor
a4f0709c2f Rename AsyncIteratorProtocol.next(_:) to next(isolation:)
Match the name of the method as specified in SE-0421
2024-02-09 14:18:37 -08:00
mtj0928
343f8e5df1 [docs] Fix examples for TaskLocal
TaskLocal doesn't support `static let`.
2024-02-10 00:43:31 +09:00
Alejandro Alonso
aadf4a13a2 Do a fast NFC check over the slice instead of guts 2024-02-08 10:50:03 -08:00
Alastair Houghton
2aba85f12f Merge pull request #71056 from al45tair/eng/PR-120952971
[Runtime][IRGen] Trap C++ exceptions on *throw*, not catch.
2024-02-08 15:00:35 +00:00
Alastair Houghton
9d2dcb5c4e Merge pull request #71386 from al45tair/eng/PR-122302117
[Runtime] Add an option to produce non-symbolicated backtraces.
2024-02-08 11:14:26 +00:00
Alejandro Alonso
3923e2e621 Merge pull request #71443 from Azoy/fix-specialize-function
[stdlib] Fix _specialize implementation
2024-02-07 15:46:38 -08:00
Guillaume Lessard
71640be109 Merge pull request #71363 from glessard/rdar115296219
[stdlib] properly rename validatingUTF8 to validatingCString
2024-02-07 14:37:23 -08:00
Alejandro Alonso
71fccd1696 Fix _specialize implementation 2024-02-07 11:58:57 -08:00
John McCall
2f8a33cf0a Experimental type-checking support for @isolated(any) function types. 2024-02-06 22:54:27 -05:00
Alastair Houghton
dd0b826235 [Runtime] Improved symbolication option for backtracing.
Rather than just on or off, I've changed it to allow "off", "fast",
or "full".  "fast" means that we'll do symbol lookup, but we won't
try to find inline frames and we won't run line number programs
(those are the things that are taking considerable time in some
cases).

rdar://122302117
2024-02-06 17:38:20 +00:00
Alastair Houghton
25e9ca02b0 [Runtime][Test] Add a leading underscore to swift_exceptionPersonality.
The other new runtime functions appear to have a leading underscore.
It makes sense in this case because we don't expect anything to call
this directly (other than the unwinder).

rdar://120952971
2024-02-06 16:21:09 +00:00
Alastair Houghton
143a473aa4 [Runtime][IRGen] Trap C++ exceptions on *throw*, not catch.
The previous approach was effectively to catch the exception and then
run a trap instruction.  That has the unfortunate feature that we end
up with a crash at the catch site, not at the throw site, which leaves
us with very little information about which exception was thrown or
where from.

(Strictly we do have the exception pointer and could obtain exception
information, but it still won't tell us what threw it.)

Instead of that, set a personality function for Swift functions that
call potentially throwing code, and have that personality function
trap the exception during phase 1 (i.e. *before* the original stack
has been unwound).

rdar://120952971
2024-02-06 16:19:17 +00:00
Kavon Farvardin
ee12fd6655 NCGenerics: reenable round-trip for mangling 2024-02-06 08:15:26 -08:00
Doug Gregor
e4d6bee153 Merge pull request #71400 from DougGregor/will-throw-typed
Implement `swift_willThrow` variant for typed throws.
2024-02-06 03:22:22 -08:00
Kuba (Brecka) Mracek
ea6295e47f Merge pull request #71392 from kubamracek/revert-embedded-defines
Revert "Merge pull request #71278 from kubamracek/embedded-no-mach-defines"
2024-02-05 17:48:40 -08:00
Doug Gregor
3fa07a0e7a Implement swift_willThrow variant for typed throws.
`swift_willThrow` is called with an error right before it is thrown.
This existing entrypoint requires an already-boxed error existential;
with typed errors, we don't have the error existential on hand, so we
would need to allocate the box to throw a typed error. That's not okay.

Introduce a new `swift_willThrowTypedImpl` entry point into the runtime
that will first check for the presence of an error handler and, if one
is present, box the error to provide to the error handler. This
maintains the no-allocations path for typed errors while still
allowing existing error handlers to work.

This new entrypoint isn't available on older Swift runtimes, so create
a back-deployable shim called by the compiler. On new-enough platforms,
this will call through to `swift_willThrowTypedImpl`. On older
platforms, we drop the error and don't call the registered will-throw
handler at all. This is a compromise that avoids boxing when throwing
typed errors, at the cost of a slightly different experience for this
new feature on older runtimes.

Fixes rdar://119828459.
2024-02-05 15:06:55 -08:00
Guillaume Lessard
a2df540cfa Merge pull request #71369 from oscbyspro/main
BinaryInteger advanced(by:) fixes
2024-02-05 14:42:38 -08:00
Pavel Yaskevich
09991db863 Merge pull request #71327 from xedin/raise-unexpected-executor-log-level
[stdlib] Make expected actor isolation checking crash by default
2024-02-05 09:45:55 -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
Alastair Houghton
8269bf72eb [Runtime] Add an option to produce non-symbolicated backtraces.
Symbolication can take some time, depending on the binaries involved.
In certain contexts it's better for the backtrace to finish quickly,
and then symbolication could be done offline.

rdar://122302117
2024-02-05 12:56:47 +00:00
Guillaume Lessard
da5b41a0f8 [stdlib] properly rename validatingUTF8 to validatingCString
https://github.com/apple/swift/issues/68433 was fixed
in commit d19f082665.
2024-02-03 16:19:04 -08:00
Oscar Byström Ericsson
d7b3d3e319 Minor advanced(by:) enhancement. 2024-02-03 15:18:02 +01:00
Oscar Byström Ericsson
17187e38f5 This patch fixes two unnecessary traps in BinaryInteger's advanced(to:) method.
- `Int8.min.advanced(by: 128)`, etc.
- `UInt.max.advanced(by: Int.min)`, etc.
2024-02-03 13:56:33 +01:00
Pavel Yaskevich
87878461a5 [stdlib] Make expected actor isolation checking crash by default
Only affects projects compiled with `-enable-actor-data-race-checks` flag.
2024-02-02 23:53:18 -08:00
Kavon Farvardin
b67ace7de1 Merge pull request #71137 from kavon/ncgenerics-enable-stdlib-v1
NCGenerics: synthesize Copyable/Escapable decls
2024-02-02 21:16:14 -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
Kavon Farvardin
3908c8182d NCGenerics: sometimes synth. Copyable/Escapable
When the Swift module is not available, we'll synthesize the
Copyable/Escapable decls into the Builtin module.

In the future, it might be nice to just do this always, and define
typealiases for those types in the stdlib to refer to the ones in the
builtin module.
2024-02-02 18:47:03 -08:00
Evan Wilde
5f8da9e977 Merge pull request #71348 from etcwilde/ewilde/protect-the-dependents
Protect the `add_dependencies` calls against non-existent targets
2024-02-02 16:11:33 -08:00
Kuba Mracek
4776e993ad [embedded] Use defined(__wasm__) instead of defined(__wasi__) in Visibility.h 2024-02-02 12:41:54 -08:00
Guillaume Lessard
0ec6397053 Merge pull request #71224 from glessard/rdar121395821
[stdlib] Improve documentation for the various "String from C-string" initializers
2024-02-02 12:17:50 -08:00
Tim Kientzle
ccc6ef8e68 Merge pull request #70978 from tbkka/tbkka-revert-PR68952
Revert #68952 [Casting] Make more casts look inside __SwiftValue
2024-02-02 11:03:04 -08:00
Evan Wilde
5cb3285c92 Protect the dependent
The install target is sometimes the `None` target, which doesn't
actually exist. This should perhaps be spelled `never_install` instead,
but given that these are random names, we should protect the
`add_dependencies` calls to only accept install components that actually
exist.
2024-02-02 10:50:14 -08:00
Guillaume Lessard
114f235d17 Merge pull request #71167 from vanvoorden/vanvoorden/inclusive-language
[Inclusive Language][Comments][Documentation] migrate "sanity" checks to "soundness" checks
2024-02-02 10:27:34 -08:00
Dario Rexin
55e565d838 [Runtime] Handle different types for src and dest in existentialAssignWithCopy (#71323)
rdar://117083470

An existential can contain a different type than the one that is being assigned, so we have to check the types and handle the values accordingly.
2024-02-02 08:34:37 -08:00
Allan Shortlidge
ad2fcc6e38 [TaskExecutors] Add missing return type to _DefaultGlobalConcurrentExecutor.asUnownedTaskExecutor().
Addresses a warning that appears to point to a probable bug.
2024-02-01 18:41:30 -08:00
Guillaume Lessard
e10899eff7 [stdlib] tweak deprecation message 2024-02-01 15:34:18 -08:00
Guillaume Lessard
11485e5026 [doc] fix note visibility for docc-generated pages 2024-02-01 15:34:18 -08:00
Guillaume Lessard
a74b5b7b3c [stdlib] make parameter label the same as in peer functions
These functions were the odd ones out in not using `encoding` for this parameter label. Harmonizing this term will also make the documentation more consistent.
2024-02-01 15:34:18 -08:00
Guillaume Lessard
048a948f12 [stdlib] document some deprecated initializers 2024-02-01 15:34:18 -08:00
Guillaume Lessard
e3ede3ad3a [stdlib] improve phrasing in some doc-comments 2024-02-01 15:34:18 -08:00
Guillaume Lessard
ae9892d46b [stdlib] remove useless annotations 2024-02-01 15:34:18 -08:00
Guillaume Lessard
047092a0a5 [stdlib] mark deprecated in swift 6, point to better API 2024-02-01 15:34:18 -08:00
Guillaume Lessard
4c00395b66 [stdlib] fix preconditionFailure message 2024-02-01 15:34:18 -08:00
Philippe Hausler
bd3c15e64d Add a utility method for identifying which property changed for tracking events (#71223) 2024-02-01 09:48:31 -08:00
nate-chandler
902a22d94a Merge pull request #71298 from nate-chandler/bitwise-copyable/remove-unchecked
[BitwiseCopyable] Remove @unchecked behavior.
2024-02-01 03:21:26 -08:00
Mike Ash
12de745160 Merge pull request #71254 from mikeash/libprespecialize-validation-test
[ExternalGenericMetadataBuilder] Add a test that validates built metadata against the runtime.
2024-01-31 22:19:23 -05:00