Commit Graph

18 Commits

Author SHA1 Message Date
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
Andrew Trick
d593623ffb Do not insert dynamic exclusivity checks in closure cycles
Closure cycles were originally enforced "conservatively". Real code
does, however, use recursive local functions. And it's surprisingly
easy to create false exclusivity violations in those cases.

This is safe as long as we can rely on SILGen to keep captured
variables in boxes if the capture escapes in any closure that may call
other closures that capture the same variable.

Fixes https://github.com/apple/swift/issues/61404
Dynamic exclusivity checking bug with nested functions. #61404

Fixes rdar://102056143 (assertion failure due to exclusivity checker -
AccessEnforcementSelection should handle recursive local captures)
2022-12-18 12:32:25 -08:00
Michael Gottesman
9e44011e4d [sil] Add a new attribute called @closureCaptured to SILFunctionArguments that are closure capture arguments.
I am adding this to make it easy to determine if a SILFunction that is not inout
aliasable is captured. This is useful when emitting certain types of
diagnostics like I need to emit with move only.
2022-12-14 15:16:43 -08:00
Holly Borla
8713d78704 [PrintOptions] Print explicit 'any' in SIL. 2022-08-18 01:15:12 -04:00
Andrew Trick
ddf0965d3f Rewrite ClosureScopeAnalysis for generality.
Handle recursive non-escaping local functions.

Previously, it was thought that recursion would force a closure to be
escaping. This is not necessarilly true.

Update AccessEnforcementSelection to conservatively handle closure cycles.

Fixes rdar://88726092 (Compiler hangs when building)
2022-03-18 02:28:53 -07:00
Slava Pestov
a44125eb91 These tests no longer need -swift-version 3 2018-10-31 15:29:18 -04:00
Andrew Trick
2ecb48a89d Remove exclusivity support for Swift 3 mode.
Remove the compiler support for exclusivity warnings.

Leave runtime support for exclusivity warnings in non-release builds
only for unit testing convenience.

Remove a test case that checked the warning log output.

Modify test cases that relied on successful compilation in the
presence of exclusivity violations.

Fixes: <rdar://problem/45146046> Remaining -swift-version 3 tests for exclusivity
2018-10-12 09:08:42 -07:00
Erik Eckstein
39bb14b094 change mangling prefix from $S to $s
This is the final ABI mangling prefix

rdar://problem/38471478
2018-09-19 13:55:11 -07:00
Slava Pestov
5d2752f7d2 Run tests with -swift-version 4 by default
Some test now fail, so add an explicit -swift-version 3.
2018-06-19 23:24:19 -07:00
Arnold Schwaighofer
d981bb1d96 Mangling: noescape functions will be trivial and no longer compatible with escape function types.
Mangle escapeness as part of the type.

Part of:
SR-5441
rdar://36116691
2018-02-06 08:51:43 -08:00
Erik Eckstein
cd3d50a5d9 ABI: Change the mangling prefix from _T0 to $S 2018-01-06 13:55:59 -08:00
Pavel Yaskevich
f90d943a29 [Mangling/ABI] NFC: Fix SILOptimizer tests to reflect label mangling changes 2017-12-18 15:45:50 -08:00
Andrew Trick
ed07a03b71 [Exclusivity] Update test case FIXME's for my current understanding of the model. 2017-05-17 10:14:34 -07:00
Andrew Trick
dd31c40995 [Exclusivity] Disable dynamic enforcement in noescape closures. 2017-05-08 17:27:26 -07:00
Devin Coughlin
de9c646804 [Exclusivity] Use dynamic enforcement on boxes whose projections escape
In AccessEnforcementSelection, treat passing a projection from a box to
a partial_apply as an escape to force using dynamic enforcement on the box.

This will now correctly use dynamic enforcement on variables that are taken
as inout and also captured by storage address in a closure:

  var x = ...

  x.mutatingMethod { ... use x ...}

but does pessimize some of our existing enforcement into dynamic since
access enforcement selection.

Ideally we would distinguish between escaping via an nonescaping closures
(which can only conflict with accesses that are in progress) and
escaping via escaping closures (which can conflict for any reachable code
after the escape)
2017-05-02 14:54:12 -07:00
Andrew Trick
2336a87866 [Exclusivity] Enable access markers for the entire -Onone pipeline.
Dynamic markers are still conditional on the command line option.
2017-04-28 21:33:09 -07:00
Andrew Trick
915b319810 [AccessEnforce] must handle undef before diagnostics. 2017-04-14 18:28:37 -07:00
Andrew Trick
66d42287a6 AccessEnforcementSelector: add support for arguments.
I'm using source-level tests to help bootstrap the -Onone pipeline
with access markers enabled.
2017-04-12 17:33:17 -07:00