Commit Graph

4421 Commits

Author SHA1 Message Date
Slava Pestov
7ed5d2bfc2 ASTDemangler: Round-trip @isolated @sil_implicit_leading_param parameter attributes
We sometimes mangle SILFunctionTypes when generating debug info
for reabstraction thunks, and these can have various exotic
parameter and result attributes. Two recent additions were
never plumbed through the mangler, causing assertion failures
when emitting debug info.

Fixes rdar://153730847.
2025-06-26 15:00:44 -04:00
Andrew Trick
9bcc3f41dc LifetimeDependenceScopeFixup: crash handling dead-end coroutine
When extending a coroutine, handle the end_borrow instruction used to end a
coroutine lifetime at a dead-end block.

Fixes rdar://153479358 (Compiler crash when force-unwrapping optional ~Copyable type)

(cherry picked from commit 5b5f370ce1)
2025-06-17 09:59:14 -07:00
Pavel Yaskevich
fd79a85981 [Demangle] Implement missing Node::Kind::OutlinedInitializeWithTakeNoValueWitness
Implements de/remangler support for `WOB` manglings.

(cherry picked from commit 8e49860349)
2025-06-06 10:05:56 -07:00
Pavel Yaskevich
e12201769d [AST/Sema/SIL] Implement @_inheritActorContext(always)
- Extend `@_inheritActorContext` attribute to support optional `always` modifier.
  The new modifier will make closure context isolated even if the parameter is not
  captured by the closure.
- Implementation `@_inheritActorContext` attribute validation - it could only be
  used on parameter that have `@Sendable` or `sending` and `@isolated(any)` or
  `async` function type (downgraded to a warning until future major Swift mode
  to avoid source compatibility issues).
- Add a new language feature that guards use of `@_inheritActorContext(always)` in swift interface files
- Update `getLoweredLocalCaptures` to add an entry for isolation parameter implicitly captured by `@_inheritActorContext(always)`
- Update serialization code to store `always` modifier

(cherry picked from commit 04d46760bb)
(cherry picked from commit c050e8f75a)
(cherry picked from commit c0aca5384b)
(cherry picked from commit a4f6d710cf)
(cherry picked from commit 6c911f5d42)
(cherry picked from commit 17b8f7ef12)
2025-05-22 11:32:35 -07:00
Meghana Gupta
cc72edb119 Introduce end_cow_mutation_addr instruction 2025-04-30 14:38:48 -07:00
Anthony Latsis
f7ca793218 [docs] Diagnostics: Add quoting guidelines 2025-04-23 19:18:11 +01:00
Pavel Yaskevich
c8c7eef43e [Docs] NFC: Remove last remaining references to @execution attribute
(cherry picked from commit 4b1695b999)
2025-04-16 13:20:16 -07:00
Doug Gregor
50f0ebca9f Drop the ".md" suffix from diagnostic group file names in GROUP
While here, document the GROUP macro appropriately.
2025-04-15 07:03:22 -07:00
Doug Gregor
e88f8995e1 [Diagnostics] Eliminate educational notes in favor of diagnostic groups
We've been converging the implementations of educational notes and
diagnostic groups, where both provide category information in
diagnostics (e.g., `[#StrictMemorySafety]`) and corresponding
short-form documentation files. The diagnostic group model is more
useful in a few ways:

* It provides warnings-as-errors control for warnings in the group
* It is easier to associate a diagnostic with a group with
GROUPED_ERROR/GROUPED_WARNING than it is to have a separate diagnostic
ID -> mapping.
* It is easier to see our progress on diagnostic-group coverage
* It provides an easy name to use for diagnostic purposes.

Collapse the educational-notes infrastructure into diagnostic groups,
migrating all of the existing educational notes into new groups.
Simplify the code paths that dealt with multiple educational notes to
have a single, possibly-missing "category documentation URL", which is
how we're treating this.
2025-03-29 15:40:35 -07:00
Caleb Hearth
62207ced88 Add missing closing paren in CMake example 2025-03-28 10:36:37 -06:00
Doug Gregor
e0b52cd20e [SIL] Extend checked-cast instructions with "prohibit isolated conformances" flag
When performing a dynamic cast to an existential type that satisfies
(Metatype)Sendable, it is unsafe to allow isolated conformances of any
kind to satisfy protocol requirements for the existential. Identify
these cases and mark the corresponding cast instructions with a new flag,
`[prohibit_isolated_conformances]` that will be used to indicate to the
runtime that isolated conformances need to be rejected.
2025-03-26 22:31:47 -07:00
Andrew Trick
edf02f9aff [docs] SIL mark_dependence 2025-03-25 23:02:06 -07:00
Nate Chandler
5eacbfd9d9 [DefaultOverrides] Mangling. 2025-03-25 07:22:14 -07:00
Hamish Knight
f8ab391737 Introduce type sugar for InlineArray (#80087)
* [CS] Decline to handle InlineArray in shrink

Previously we would try the contextual type `(<int>, <element>)`,
which is wrong. Given we want to eliminate shrink, let's just bail.

* [Sema] Sink `ValueMatchVisitor` into `applyUnboundGenericArguments`

Make sure it's called for sugar code paths too. Also let's just always
run it since it should be a pretty cheap check.

* [Sema] Diagnose passing integer to non-integer type parameter

This was previously missed, though would have been diagnosed later
as a requirement failure.

* [Parse] Split up `canParseType` 

While here, address the FIXME in `canParseTypeSimpleOrComposition`
and only check to see if we can parse a type-simple, including
`each`, `some`, and `any` for better recovery.

* Introduce type sugar for InlineArray

Parse e.g `[3 x Int]` as type sugar for InlineArray. Gated behind
an experimental feature flag for now.
2025-03-23 15:31:37 -07:00
Kuba (Brecka) Mracek
f8e9c1b19f Merge pull request #80147 from kubamracek/embedded-faq1
[embedded] Update embedded UserManual.md to explain how to use a macOS downloadable toolchain
2025-03-19 21:26:44 -07:00
Amritpan Kaur
3c30d68d2e Merge pull request #78823 from amritpan/method-keypaths
[Sema/SILGen/IRGen] Implement method & initializer keypaths.
2025-03-19 18:59:17 -07:00
Kuba Mracek
bc6c5fe677 [embedded] Update embedded UserManual.md to explain how to use a macOS downloadable toolchain 2025-03-19 16:03:02 -07:00
Amritpan Kaur
555a486cda [Mangler] Add new mangling schemes. 2025-03-19 10:54:06 -07:00
Erik Eckstein
96e7e30927 docs: add a section about formal vs lowered types in the SIL documentation 2025-03-19 16:18:11 +01:00
Erik Eckstein
d225c47d25 AST: rename OpenArchetypeType -> ExistentialArchetypeType
NFC
2025-03-11 20:21:46 +01:00
Konrad `ktoso` Malawski
6e725f277d Update CLion instructions (#79900)
We use the `RelWithDebInfo` configuration nowadays, so correct the instructions.
2025-03-10 22:27:03 -07:00
Nate Chandler
a50a3f022b [CoroutineAccessors] Mangling.
Change the suffix to Twc and demangle.
2025-03-07 11:40:38 -08:00
Michael Gottesman
e608b98432 Merge pull request #79772 from gottesmm/pr-9dc8d133c4df0ac75898153321c06dfee9f3416a
[DebuggingTheCompiler] Add a note about using -debug-cycles to debug request evaluator cycles.
2025-03-04 18:38:54 -08:00
Michael Gottesman
297307549f [DebuggingTheCompiler] Add a note about using -debug-cycles to debug request evaluator cycles. 2025-03-04 13:10:40 -08:00
강수진
56144a0eb0 [docs] Fix markdown link text for SE-0302 (#79681)
Added missing link text for marker protocol reference.
2025-02-28 11:47:27 -08:00
nate-chandler
30d91d39bf Merge pull request #79625 from nate-chandler/general-coro/20250212/1
[CoroutineAccessors] Use retcon.once variant.
2025-02-27 12:58:49 -08:00
Nate Chandler
3d655f58a2 [IRGen] Add coroutine fp link entities.
Duplicative boilerplate copying what was done for async function
pointers which these have the same characteristics as.
2025-02-27 07:53:13 -08:00
Alastair Houghton
583a2f8df4 [Backtracing] Update JSON output slightly after review.
Always put `registers` in the thread record, and always use the `threads`
top level key, even if we ask for only the crashed thread.  Also add an
`omittedThreads` key.

rdar://121430255
2025-02-26 14:12:21 +00:00
Alastair Houghton
9fdbbc7e22 Update docs/Backtracing.rst
Fix a typo.

Co-authored-by: Honza Dvorsky <honza@apple.com>
2025-02-26 14:12:21 +00:00
Alastair Houghton
20685b991d [Docs] Update backtracing documentation.
Added documentation for the JSON output.

rdar://121430255
2025-02-26 14:12:20 +00:00
Alastair Houghton
0bc76dae80 [Backtracing] Add warning suppression option, enable it for tests.
The backtracing code will warn you if you attempt to forcibly enable
backtracing for a privileged executable.  This is apparently upsetting
the Driver/filelists.swift test.

Since we want to force it on for tests, so that we will definitely get
backtraces, add an option to suppress warning messages, and turn that
on for tests as well.

rdar://144497613
2025-02-24 12:55:16 +00:00
Pavel Yaskevich
7484f01f8e Merge pull request #79504 from xedin/execution-caller-mangling
[Mangling] Mangle presence of `@execution(caller)` in a function type
2025-02-20 14:01:26 -08:00
Konrad `ktoso` Malawski
e8668684a1 Merge pull request #79411 from amartini51/typo_144059094
Remove double word ("a a" and "the the")
2025-02-20 13:05:06 +09:00
Pavel Yaskevich
1067ead82c [Mangling] Mangle presence of @execution(caller) in a function type
If `@execution(caller)` attribute is present on a function type,
mark its presence in the mangling with `YC` suffix.
2025-02-19 16:48:41 -08:00
Alex Martini
633f101e0a Fix double 'the the' in various places 2025-02-14 17:27:51 -08:00
Alastair Houghton
864f3dc023 [Backtracing] Fix bug in Compact Image Map decoder.
The `expand` opcode was being decoded incorrectly in the case where we
were trying to expand prefixes with codes of 64 or above.

rdar://144497804
2025-02-14 14:59:20 +00:00
Erik Eckstein
6af5876f72 PerformanceInliner: add the @_semantics("optimize.sil.inline.aggressive") attribute to enable inlining into large functions.
This attribute overrides the limit of maximum number of basic blocks in the caller.
2025-02-13 07:40:24 +01:00
Erik Eckstein
a022457257 docs: update documentation of optimization related semantic attributes 2025-02-13 07:30:44 +01:00
Erik Eckstein
e0b4f71af6 SIL: remove the alloc_vector instruction
It's not needed anymore, because the "FixedArray" experimental feature is replaced by inline-arrays.
2025-02-12 10:51:14 +01:00
Max Desiatov
2f09abbdfc Fix typo, refine formatting in EmbeddedSwift/UserManual.md (#79197)
The document should refer to `libswiftUnicodeDataTables.a`, not `libUnicodeDataTables.a`, as the latter doesn't exist.
2025-02-06 20:53:53 -08:00
Andrew Trick
840ad142b9 [docs] mark_dependence description clarification 2025-02-03 10:02:40 -08:00
Alastair Houghton
ab8e561583 Merge pull request #78516 from al45tair/eng/PR-124913332
[Backtracing] Implement API per SE-0419
2025-01-28 10:48:33 +00:00
Alastair Houghton
26d0e49764 [Backtracing] Updates following review.
Added some explanatory text to the Compact Backtrace Format
documentation, and also to the `CMakeLists.txt` for the runtime.

Tweaked the conversions for `Backtrace.Address` to truncate, which
should result in reasonable behaviour for negative fixed-width
integers.

Use a constant for the ASCII values for `/` and `\` in the Compact
Image Format encoder/decoder.

Make the TSD key for `ElfImageCache` non-optional, and call
`fatalError()` if we don't get one.

rdar://124913332
2025-01-27 17:22:39 +00:00
Alastair Houghton
c9c5dc0de1 [Backtracing] Add platform and architecture information.
It's useful to capture the platform and platform version with the image map.
Also, display both the platform and architecture information when generating
a crash log.

rdar://124913332
2025-01-27 15:44:28 +00:00
eeckstein
95f1dfbf07 Merge pull request #78885 from eeckstein/fix-without-actually-escaping
Fix two problems with `withoutActuallyEscaping`
2025-01-27 07:59:02 +01:00
Michael Gottesman
0ea22f819a [rbi] Remove support for sending result for impl-function-type in the old mangler. 2025-01-24 13:19:18 -08:00
Erik Eckstein
3ec5d7de24 SIL: replace the is_escaping_closure instruction with destroy_not_escaped_closure
The problem with `is_escaping_closure` was that it didn't consume its operand and therefore reference count checks were unreliable.
For example, copy-propagation could break it.
As this instruction was always used together with an immediately following `destroy_value` of the closure, it makes sense to combine both into a `destroy_not_escaped_closure`.
It
1. checks the reference count and returns true if it is 1
2. consumes and destroys the operand
2025-01-24 19:23:27 +01:00
Michael Gottesman
7ae56aab2e [sil] Add a new instruction ignored_use.
This is used for synthetic uses like _ = x that do not act as a true use but
instead only suppress unused variable warnings. This patch just adds the
instruction.

Eventually, we can use it to move the unused variable warning from Sema to SIL
slimmming the type checker down a little bit... but for now I am using it so
that other diagnostic passes can have a SIL instruction (with SIL location) so
that we can emit diagnostics on code like _ = x. Today we just do not emit
anything at all for that case so a diagnostic SIL pass would not see any
instruction that it could emit a diagnostic upon. In the next patch of this
series, I am going to add SILGen support to do that.
2025-01-22 21:12:36 -08:00
Anthony Latsis
76d1ea3fd5 Merge pull request #78760 from AnthonyLatsis/solanum-melongena
docs: Fully spell out the name of `docs/ABI/CallConvSummary.rst`
2025-01-23 01:03:50 +00:00
Anthony Latsis
cbe420c79d docs: Fully spell out the name of docs/ABI/CallConvSummary.rst
"Conv" is ambiguous. Perhaps "CallConv" is not, but the full name is
still more helpful for those of us browsing or searching for targeted
info.
2025-01-22 21:05:42 +00:00