Commit Graph

72 Commits

Author SHA1 Message Date
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
Michael Gottesman
2503384c43 Merge pull request #77370 from gottesmm/transfer_to_send
[region-isolation] Excise 'transfer' in favor of 'sending'
2024-11-05 06:29:58 -08:00
Michael Gottesman
32b4de60a9 Rename transfer -> send.
Accomplished using clangd's rename functionality.
2024-11-04 15:17:51 -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
Michael Gottesman
9eb5d7fce2 Update tests that were added before I finished this. 2024-08-01 13:53:04 -07:00
Michael Gottesman
e7e035f60c [region-isolation] Convert the transfer non sendable typed error to be a new short-error, long-note form error.
I also messed with the text a little bit.

This eliminates the last of the old style diagnostics.
2024-07-31 13:10:02 -07:00
Michael Gottesman
bfdbc760cf [region-isolation] Convert UseAfterTransfer's typed isolation transfer error to the split small error/large note format we are standardizing on.
I also cleaned up the diagnostic a little bit.
2024-07-31 13:10:02 -07:00
Kavon Farvardin
5230b19ef6 Test: replace '@_moveOnly' with '~Copyable' 2024-07-23 11:05:33 -07:00
Michael Gottesman
ebedf63138 [region-isolation] Do not squelch use-after-transfer error even if the value is isolated to the same actor.
rdar://132074953
2024-07-19 02:25:53 -07:00
Michael Gottesman
b780ff6696 [sending] Begin parsing 'sending' while still accepting 'transferring'.
A few things:

1. Internally except for in the parser and the clang importer, we only represent
'sending'. This means that it will be easy to remove 'transferring' once enough
time has passed.

2. I included a warning that suggested to the user to change 'transferring' ->
'sending'.

3. I duplicated the parsing diagnostics for 'sending' so both will still get
different sets of diagnostics for parsing issues... but anywhere below parsing,
I have just changed 'transferring' to 'sending' since transferring isn't
represented at those lower levels.

4. Since SendingArgsAndResults is always enabled when TransferringArgsAndResults
is enabled (NOTE not vis-a-versa), we know that we can always parse sending. So
we import "transferring" as "sending". This means that even if one marks a
function with "transferring", the compiler will guard it behind a
SendingArgsAndResults -D flag and in the imported header print out sending.

rdar://128216574
2024-05-16 21:43:50 -07:00
Kavon Farvardin
0420310623 NCGenerics: it's no longer "experimental"
resolves rdar://127701059
2024-05-08 10:49:12 -07:00
Michael Gottesman
f64f2529fb [region-isolation] Some more diagnostic wordsmithing.
rdar://127580781
2024-05-06 19:20:07 -07:00
Michael Gottesman
e4db879112 [region-isolation] Some more diagnostic wordsmithing.
rdar://127580781
2024-05-06 12:09:10 -07:00
Michael Gottesman
f02172a323 [region-isolation] Change terminology to use the term 'risk' instead of could. 2024-05-05 18:01:05 -07:00
Michael Gottesman
699692bd39 [region-isolation] Change diagnostics from using the term transferring -> sending.
rdar://127580781
2024-05-05 18:00:54 -07:00
Michael Gottesman
eed51e7528 [region-isolation] Make load/load_borrow look through instructions.
This ensures that when we process, we consider load/load_borrow's result to be
equivalent to its operand. This ensures that a load/load_borrow cannot act as a
use of its operand preventing spurious diagnostics.
2024-04-11 15:41:18 -07:00
Michael Gottesman
20c24293e5 [region-isolation] Do not look through begin_borrow or move_value if they are marked as a var_decl.
The reason why we do this is that we want to treat this as a separate value from
their operand since they are the result of defining a new value.

This has a few nice side-effects, one of which is that if a let results in just
a begin_borrow [var_decl], we emit names for it.

I also did a little work around helping variable name utils to lookup names from
applies that are fed into a {move_value,begin_borrow} [var_decl] which then has
the debug_value we are searching for.
2024-04-11 15:41:18 -07:00
Emil Pedersen
efa09088ac Revert "[DebugInfo][SIL] Introduce the 'implicit' attribute for debug variable"
This reverts commit e63632fda8.

rdar://125939953
2024-04-04 17:23:32 -07:00
Michael Gottesman
e36aab6301 [region-isolation] Squelch use after transfer if the use has effectively the same isolation as the transfer inst.
To be more specific this means that either:

1. The use is actually isolated to the same actor. This could mean that the
use is global actor isolated to the same function.

2. The use is nonisolated but is executing within a function that is globally
isolated to the same isolation domain.

rdar://123474616
2024-03-25 23:32:17 -07:00
Michael Gottesman
2f9b519758 [region-isolation] Wordsmith "{access,use} here could race".
I am doing this since it isn't always going to be an access. We may not have
memory. We are talking about uses here!

I was able to just use sed so it was an easy fix.
2024-03-23 17:19:09 -07:00
Michael Gottesman
683e94f30d Merge pull request #72368 from gottesmm/pr-14b84426e480f5b5049c09df01c9445308dd19c5
[region-isolation] Change semantics of function_extract_isolation from AssertingIfNonSendable -> Require.
2024-03-15 20:13:53 -07:00
Michael Gottesman
e2ddb088cb [region-isolation] Change semantics of function_extract_isolation from AssertingIfNonSendable -> Require.
The reason why I am doing this is that:

1. function_extract_isolation can take as a parameter a non-Sendable function
today in SIL so in such a case, we crash.
2. It returns an Optional<any Actor> which always must be Sendable.

So it makes sense for it to just require that its non-Sendable parameter not be
transferred at that point.
2024-03-15 17:30:29 -07:00
Michael Gottesman
9fe64cd319 [region-isolation] Fix assert.
This assert validates that look through parameters only have a single operand
(the one we are going to lookthrough). It did not take into account though that
some of these lookthrough instructions /do/ have type dependent operands (which
we should ignore for the assert). I changed the assert to ignore those.
2024-03-15 16:18:56 -07:00
Michael Gottesman
a5c8106e6a [region-isolation] Standardize on task-isolated instead of task isolated.
This matches actor-isolated as used in other parts of the compiler.
2024-03-10 22:08:40 -07:00
Michael Gottesman
99e3f7fb13 [region-isolation] Make RegionBasedIsolation an upcoming feature for swift 6.
To make the tests pass, I had to teach sil-opt how to setup upcoming features
since it did not know how to parse them.

rdar://124100266
2024-03-05 15:15:14 -08:00
Michael Gottesman
7f43c3aa86 [region-isolation] Eliminate "call site passes self" error from all SIL tests. 2024-02-22 13:50:07 -08:00
Kavon Farvardin
ff3ea642b1 NCGenerics: increase baseline test coverage
During feature bringup, it's handy to have tests always running in CI to prevent outside regressions.
2024-02-20 18:26:05 -05:00
Michael Gottesman
188ac1ae31 Re-enable test
rdar://122773845
2024-02-14 16:48:49 -08:00
Kavon Farvardin
5fe149db16 SIL: disable invalid test case
Noncopyable types cannot be substituted for an unconstrained generic
parameter, as it will have a Copyable conformance on it.

This test should be refactored to use a concrete function like
`transferMoveOnlyStruct` instead of the generic. But its not obvious to
me the best way to update this test.
2024-02-11 20:40:03 -08:00
Michael Gottesman
dd7f5ec11d [region-isolation] Handle ref_to_bridge_object especially.
I was correct that it is lookthrough, but it has multiple parameters, so the
normal "baked" implementation cannot be used since the "baked" implementation
assumes that any insts it handles has a single operand.
2024-02-06 16:57:34 -08:00
Michael Gottesman
7d13d27685 [region-isolation] Add support for init_existential_value. 2024-02-02 14:50:10 -08:00
Michael Gottesman
9b686f564f [region-isolation] Add support for strong_copy_unmanaged_value.
I also made ref_to_unmanaged and unmanaged_to_ref look through. They should have
always been look through, but I believe early on they were marked assign and I
never touched fixed it. To get the test for strong_copy_unmanaged_value to work,
I needed them to obey these semantics so I fixed them at the same time.
2024-02-02 14:50:10 -08:00
Michael Gottesman
34dcb8d48c [region-isolation] Add support for load_unowned. 2024-02-02 14:50:10 -08:00
Michael Gottesman
62c6ed2c77 [region-isolation] Add support for open_existential_value. 2024-02-02 14:50:10 -08:00
Michael Gottesman
e42b112f53 [region-isolation] Add support for {begin,end}_unpaired_access. 2024-02-02 14:50:10 -08:00
Michael Gottesman
12e4e8d6e8 [region-isolation] Add support for all pack instructions. 2024-02-02 14:50:10 -08:00
Michael Gottesman
4414636f5f [region-isolation] Add support for bind_memory and rebind_memory. 2024-02-02 14:50:10 -08:00
Michael Gottesman
62a64d3b37 [region-isolation] Update for throw_addr.' 2024-02-02 14:50:10 -08:00
Michael Gottesman
45bb16764e [region-isolation] Add support for await_async_continuation. 2024-02-02 14:50:10 -08:00
Michael Gottesman
4218f5b79d [region-isolation] Teach the checker about unmanaged {retain, release, autorelease}. 2024-02-02 14:50:10 -08:00
Michael Gottesman
3cacb1f86d [region-isolation] Add support for mark_function_escape. 2024-02-02 14:50:10 -08:00
Michael Gottesman
5323a65c88 Add a missing test declaration that was lost in a git rebase. 2024-02-01 21:31:39 -08:00
Michael Gottesman
3acdc09895 [region-isolation] Add support for test_specification_inst. 2024-02-01 21:23:06 -08:00
Michael Gottesman
ce32a8dbe8 [region-isolation] Add support for store_unowned. 2024-02-01 21:22:25 -08:00
Michael Gottesman
0cd57e4431 [region-isolation] Add support for unconditional_checked_cast_addr. 2024-02-01 21:20:48 -08:00
Michael Gottesman
02ad3dedcb [region-isolation] Add support for unchecked_ref_cast_addr. 2024-02-01 21:20:20 -08:00
Michael Gottesman
b107a18f68 [region-isolation] Handle BeginCowMutation. 2024-02-01 21:19:52 -08:00
Michael Gottesman
3ffe5c5dff [region-isolation] Add increment_profiler_counter support. 2024-01-29 21:34:41 -08:00
Michael Gottesman
86ef55542c [region-isolation] Clean up the handling of ref_element_addr let for Sendable types.
Specifically, if we access a Sendable type from a ref_element_addr and the field
is mutable, we need to treat the use as a require since we could race on writing
to the field. If the field is a let though (and thus immutable), we can still
ignore it.

I also used this as an opportunity to add SIL tests for ref_element_addr.
2024-01-29 21:34:41 -08:00
Michael Gottesman
edf4543b0c [region-isolation] Add support for ref_tail_addr. 2024-01-29 21:34:41 -08:00