Commit Graph

11 Commits

Author SHA1 Message Date
Slava Pestov
9ec80df97e SIL: Remove curried SILDeclRefs 2020-03-19 02:20:21 -04:00
Michael Gottesman
3ebd8df493 [gardening] Remove unnecessary -enable-sil-ownership from tests that now just get it from their pattern.
This just eliminates -enable-sil-ownership from all target-swift-frontend and
target-swift-emit-silgen RUN lines. Both of those now include
enable-sil-ownership in their expansion.
2019-03-12 20:39:18 -07:00
Michael Gottesman
36fc50370f [closure-lifetime-fixup] Use the SSAUpdater rather than memory to extend the lifetime to the end of the function.
This beyond being slightly cleaner ensures that we do not try to promote in
PredictableMemOpts any loads from the alloc_stack. Doing this would force us to
insert a copy in ossa which then would break is_escaping_closure even when we
don't escape.

rdar://problem/46188001
2019-02-25 19:13:56 -08:00
Michael Gottesman
0af0d5fddc [ownership] Replace ValueOwnershipKind::Trivial with ValueOwnershipKind::Any.
In a previous commit, I banned in the verifier any SILValue from producing
ValueOwnershipKind::Any in preparation for this.

This change arises out of discussions in between John, Andy, and I around
ValueOwnershipKind::Trivial. The specific realization was that this ownership
kind was an unnecessary conflation of the a type system idea (triviality) with
an ownership idea (@any, an ownership kind that is compatible with any other
ownership kind at value merge points and can only create). This caused the
ownership model to have to contort to handle the non-payloaded or trivial cases
of non-trivial enums. This is unnecessary if we just eliminate the any case and
in the verifier separately verify that trivial => @any (notice that we do not
verify that @any => trivial).

NOTE: This is technically an NFC intended change since I am just replacing
Trivial with Any. That is why if you look at the tests you will see that I
actually did not need to update anything except removing some @trivial ownership
since @any ownership is represented without writing @any in the parsed sil.

rdar://46294760
2018-12-04 23:01:43 -08:00
Michael Gottesman
e4607a7191 [closure-lifetime-fixup] When emitting a load_borrow, make sure to emit the end_borrow for it as well.
In this commit I added a more convenient API for doing this sort of operation.
Specifically: SILBuilder::emitScopedBorrowOperation. This performs either a
load_borrow or begin_borrow, then calls a user provided closure, and finally
inserts the end_borrow after the scope has closed.

rdar://43398898
2018-10-26 11:11:01 -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
301d9f0cf3 AST: Give destructors a second parameter list
Constructors and methods had two parameter lists, one for self and one
for the formal parameters. Destructors only had one parameter list,
which introduced an annoying corner case.
2018-07-19 12:28:13 -07:00
Arnold Schwaighofer
968d2279a9 ClosureLifetimeFixup: Fix closure insertion point in deallocating deinits
We must not capture self beyond the call to super.deinit

rdar://40660799
2018-06-01 09:12:00 -07:00
Arnold Schwaighofer
261639d18d ClosureLifetimeFixup: We need to insert a None on the backedge of a loop after we destroyed the value
rdar://40221767
2018-05-15 08:02:39 -07:00
Arnold Schwaighofer
1f65ee25f6 Distinguish between withoutActuallyEscaping and passing @noescape
Objective C closures when reporting that a closure has escaped

rdar://39682865
2018-05-01 07:24:19 -07:00
Arnold Schwaighofer
1ae309c44c ClosureLifetimeFixup: Add support for copy_block_without_escaping instructions
Replace:

  %copy = copy_block_without_escaping %block withoutEscaping %closure

  ...
  destroy_value %copy

by (roughly) the instruction sequence:

  %copy = copy_block %block

  ...
  destroy_value %copy
  %e = is_escaping %closure
  cond_fail %e
  destroy_value %closure

rdar://39682865
2018-05-01 07:24:19 -07:00