Commit Graph

19 Commits

Author SHA1 Message Date
Nate Chandler
d298602496 [NFC] CoroutineAccessors: Delete TODO.
Add a test case.
2025-04-17 09:23:23 -07:00
Nate Chandler
056fbc44c9 [CoroutineAccessors] Control ABI via flag. 2025-04-10 07:41:37 -07:00
Erik Eckstein
7cceaff5f3 SIL: don't print operand types in textual SIL
Type annotations for instruction operands are omitted, e.g.

```
  %3 = struct $S(%1, %2)
```

Operand types are redundant anyway and were only used for sanity checking in the SIL parser.

But: operand types _are_ printed if the definition of the operand value was not printed yet.
This happens:

* if the block with the definition appears after the block where the operand's instruction is located

* if a block or instruction is printed in isolation, e.g. in a debugger

The old behavior can be restored with `-Xllvm -sil-print-types`.
This option is added to many existing test files which check for operand types in their check-lines.
2024-11-21 18:49:52 +01:00
Nate Chandler
9bbb8e8e70 [CoroutineAccessors] Set field on RequirementMatch
The WitnessSubstitutions field must be set to the appropriate
substitution map.
2024-11-13 21:33:07 -08:00
Daniel Rodríguez Troitiño
ba68faaed5 [test] Mark tests that use experimental/upcoming features as such
Find all the usages of `--enable-experimental-feature` or
`--enable-upcoming-feature` in the tests and replace some of the
`REQUIRES: asserts` to use `REQUIRES: swift-feature-Foo` instead, which
should correctly apply to depending on the asserts/noasserts mode of the
toolchain for each feature.

Remove some comments that talked about enabling asserts since they don't
apply anymore (but I might had miss some).

All this was done with an automated script, so some formatting weirdness
might happen, but I hope I fixed most of those.

There might be some tests that were `REQUIRES: asserts` that might run
in `noasserts` toolchains now. This will normally be because their
feature went from experimental to upcoming/base and the tests were not
updated.
2024-11-02 11:46:46 -07:00
Nate Chandler
651436d46a [CoroutineAccessors] Prefer for access.
If read2/modify2 exist, prefer them as part of the access strategy for
reading/writing/read-writing.
2024-10-29 14:24:36 -07:00
Nate Chandler
459bdb0f9e [Test] Evolvingly export some types.
In preparation for putting read2 and modify2 into witness tables and
only including read and modify in them when appropriate, export these
types, mark the module resilient, but mark the types frozen.  This keeps
the test passing as written.
2024-10-29 14:24:35 -07:00
Nate Chandler
defb819806 [Test] Tightened check lines.
Expect yield_once_2 for callee-allocated coroutines.
2024-10-29 14:24:35 -07:00
Nate Chandler
f2e3e8e857 [Sema] Permit read requirement.
Along with `get` and `set`, permit `read` to be required.  When a type
defines `read`, the read impl is that `read`.
2024-10-22 18:02:30 -07:00
Nate Chandler
125b908dfd [Test] Used patterns for bbs. 2024-10-22 18:01:35 -07:00
Nate Chandler
71239d6357 [CoroutineAccessors] SIL represents callee alloc.
When its operand has coroutine kind `yield_once_2`, a `begin_apply`
instruction produces an additional value representing the storage
allocated by the callee.  This storage must be deallocated by a
`dealloc_stack` on every path out of the function.  Like any other stack
allocation, it must obey stack discipline.
2024-10-11 08:25:03 -07:00
Nate Chandler
11b5d27594 [CoroutineAccessors] Add flag to observe errors.
Temporarily allow the legacy behavior of allowing caller coroutine
accessors to observe errors (i.e. by executing no code after the yield
if the caller threw an error) behind the
CoroutineAccessorsUnwindOnCallerError flag.
2024-10-11 08:25:02 -07:00
Nate Chandler
8972d6214c [CoroutineAccessors] Don't observe caller errors.
Experience with `_modify`/`_read` has shown that it is never desireable
to cleanup differently based on whether the caller has thrown.  Emit an
`end_apply` in either case.
2024-10-11 08:25:02 -07:00
Nate Chandler
627a799fb2 [Test] Add caller of modify. 2024-10-10 18:08:26 -07:00
Nate Chandler
9ceaa77bbe [Test] Check generated modify -> modify2 function. 2024-10-10 18:08:26 -07:00
Nate Chandler
36fed87061 [Test] Fix whitespace. 2024-10-10 18:08:26 -07:00
Nate Chandler
6be4090e71 [Test] Add asserts req to experimental tests.
The CoroutineAccessors experimental feature requires asserts.
2024-09-30 07:09:49 -07:00
Nate Chandler
091368ba21 [CoroutineAccessors] Added read.
The name is a placeholder for the mutating single-yield coroutine
accessor.
2024-09-26 18:10:39 -07:00
Nate Chandler
98a2e6a7df [CoroutineAccessors] Added modify.
The name is a placeholder for the mutating single-yield coroutine
accessor.
2024-09-26 18:10:39 -07:00