Commit Graph

507 Commits

Author SHA1 Message Date
Robert Widmann
266f2c8912 Merge pull request #16589 from kitasuke/update_documentation_of_alloc_stack_for_sil
[Gardening] Update alloc_stack documentation in SIL.rst
2019-12-02 10:34:08 -08:00
Michael Gottesman
7ee5ad7318 [sil] Rename {,Strong}Copy{Unowned,Unmanaged}. 2019-10-26 17:03:47 -07:00
Michael Gottesman
a84497b834 [sil.rst] Try to make it clearer that copy_unmanaged_value performs a "strong copy" of the underlying value. 2019-09-25 18:59:07 -07:00
Varun Gandhi
2255e81ad0 [NFC] Replacing potentially confusing phrase "memory allocation promotion" 2019-09-18 10:30:36 -07:00
Andrew Trick
7b1b0a0077 Add comments to destroy_addr in SIL.rst.
`destroy_addr` is never semantically a "no-op". Just because an
instruction can be safely eliminated does not mean the instruction has
no semantics! That would be like saying we could move an unknown
memory read below an otherwise dead store!
2019-09-12 16:21:39 -07:00
Erik Eckstein
3d0b12e7bc MemoryLifetime: fix a problem where DestroyHoisting moved a destroy_addr before a use of a trivial type.
Even if a destroy_addr of a trivial type is a no-op, we must not end up with using such a value after a destroy_addr.
The fix is to also handle aggregate fields of trivial types in MemoryLifetime.

rdar://problem/55125020
2019-09-11 13:49:23 +02:00
Michael Gottesman
d05dc8ac31 [SIL.rst] Add docs for copy_unowned_value and copy_unmanaged_value.
This commit adds docs for copy_unmanaged_value to SIL.rst as requested by
@eeckstein in #26839. I noticed while doing the PR that copy_unowned_value was
also not documented, so I added docs for it as well as a bonus. = ).
2019-08-26 09:28:16 -07:00
Joe Groff
ca4c2211b9 Merge pull request #26523 from rxwei/clarify-partial-apply-inout-aliasable
[Docs] Clarify partial_apply's ownership of @inout_aliasable arguments.
2019-08-10 11:42:15 -07:00
Erik Eckstein
282907fc0a Fix property wrappers with tuples.
In case of a tuple as value type, the initializer and setter takes the tuple elements as separate arguments. This was just not handled in the assign_by_wrapper instruction lowering.

rdar://problem/53866473
2019-08-08 21:46:08 +02:00
Richard Wei
ffa9c40047 [Docs] Clarify partial_apply's ownership of @inout_aliasable arguments.
`partial_apply` does not own `@inout_aliasable` arguments, so the original description "the closure does however take ownership of the partially applied arguments" is not accurate. This patch makes things clear.
2019-08-06 15:50:00 -07:00
Richard Wei
642cc3c074 [Docs] Fix typo in SIL.rst.
"an `@noescape`" -> "a `@noescape`"
2019-08-03 11:38:57 +02:00
Erik Eckstein
237a3ef77f SIL: Extend cond_fail by a second operand, which is a static string literal, indicating the failure reason. 2019-07-16 12:31:10 +02:00
Brent Royal-Gordon
d5a2912a26 Revert "Better runtime failure messages (not yet enabled by default)" 2019-07-15 13:42:40 -07:00
Erik Eckstein
e2d313ef68 SIL: Extend cond_fail by a second operand, which is a static string literal, indicating the failure reason. 2019-07-12 14:03:13 +02:00
Doug Gregor
c02ecf9859 [SE-0258] Rename to Property Wrappers 2019-05-29 22:17:50 -07:00
Jonas Devlieghere
5fbab9ddaa [Docs] Fix headings in SIL.rst
Fixes "Title underline too short." warning which is treated as an error.
2019-05-22 17:04:18 -07:00
Arnold Schwaighofer
56924d4962 Document dynamic_function_ref and prev_dynamic_function_ref 2019-05-22 09:13:11 -07:00
Erik Eckstein
2e01b0edeb SIL: add assign_by_delegate instruction
Used for property delegates.
2019-04-23 11:32:28 -07:00
Slava Pestov
1159af50d9 Rename -enable-resilience to -enable-library-evolution and make it a driver flag
Fixes <rdar://problem/47679085>.
2019-03-14 22:24:26 -04:00
Manu Sridharan
244a1f2fd7 Fix types in open_existential_addr / value
Result type for `open_existential_addr` should be `$*@opened P`.  Similar change for `open_existential_value`
2019-03-05 16:51:25 -08:00
Richard Wei
976a9c7fe2 [SIL.rst] Fix is_escaping_closure code block. 2019-02-17 02:47:17 -08:00
Robert Widmann
441c85fe98 Merge pull request #22499 from rex4539/fix-typos
Fix typos
2019-02-14 14:11:27 -05:00
Andrew Trick
cd78226f84 Merge pull request #21867 from LucianoPAlmeida/gardening-link-sil-docs
[gardening] Adding some links to SIL files
2019-02-13 16:28:32 -08:00
Dimitris Apostolou
d84048e555 Fix typos 2019-02-11 08:33:47 +02:00
Richard Wei
dcbb26cc6d Fix typo in SIL.rst: [stack] -> [on_stack]. 2019-01-28 05:09:55 -05:00
swift-ci
10f84f0f9b Merge pull request #21985 from gottesmm/pr-44903c025f4dedd6fcf95759f6512365cd8eb662 2019-01-18 15:30:04 -08:00
Michael Gottesman
3585d7d36d Make text clearer. 2019-01-18 13:49:45 -08:00
Michael Gottesman
5701eb33bb Update given John's feedback. 2019-01-18 13:43:47 -08:00
Michael Gottesman
cbb3f11909 [sil] Add clarity to how load_weak [take] and store_weak effect an objects weak ref count. 2019-01-18 13:18:59 -08:00
Arnold Schwaighofer
ccbf25b0a2 Merge pull request #21933 from aschwaighofer/partial_apply_stack
Use stack allocation for Swift closures
2019-01-18 10:35:46 -08:00
Gwynne Raskind
664e5659c5 Merge pull request #21910 from gwynne/drop-litre-references
Remove all references to unused LitRe tool
2019-01-16 18:49:55 -06:00
Arnold Schwaighofer
f664b16010 SIL: Add an on stack version of partial_apply
It does not take ownership of its non-trivial arguments, is a trivial
function type and therefore must not be destroyed. The compiler must
make sure to extend the lifetime of non-trivial arguments beyond the
last use of the closure.

  %objc = copy_value %0 : $AnObject
  %closure = partial_apply [stack] [callee_guaranteed] %16(%obj) : $@convention(thin) (@guaranteed AnObject) -> ()
  %closure2 = mark_dependence %closure : $@noescape @callee_guaranteed () -> () on %obj : $AnObject
  %user = function_ref @useClosure : $@convention(thin) (@noescape @callee_guaranteed () -> ()) -> ()
  apply %user(%closure2) : $@convention(thin) (@noescape @callee_guaranteed () -> ()) -> ()
  dealloc_stack %closure : $() ->()
  destroy_value %obj : $AnObject // noescape closure does not take ownership

SR-904
rdar://35590578
2019-01-15 11:20:33 -08:00
Luciano Almeida
ff51f4d307 Fix broken ref of HighLevelSILOptimizations.rst on SIL.rst 2019-01-15 01:35:59 -02:00
Luciano Almeida
50d0118463 Adding some links on SIL docs. 2019-01-15 01:29:54 -02:00
Jordan Rose
425c190086 Restore initializing entry points for @objc convenience initializers (#21815)
This undoes some of Joe's work in 8665342 to add a guarantee: if an
@objc convenience initializer only calls other @objc initializers that
eventually call a designated initializer, it won't result in an extra
allocation. While Objective-C /allows/ returning a different object
from an initializer than the allocation you were given, doing so
doesn't play well with some very hairy implementation details of
compiled nib files (or NSCoding archives with cyclic references in
general).

This guarantee only applies to
(1) calling `self.init`
(2) where the delegated-to initializer is @objc
because convenience initializers must do dynamic dispatch when they
delegate, and Swift only stores allocating entry points for
initializers in a class's vtable. To dynamically find an initializing
entry point, ObjC dispatch must be used instead.

(It's worth noting that this patch does NOT check that the calling
initializer is a convenience initializer when deciding whether to use
ObjC dispatch for `self.init`. If we ever add peer delegation to
designated initializers, which is totally a valid feature, that should
use static dispatch and therefore should not go through objc_msgSend.)

This change doesn't /always/ result in fewer allocations; if the
delegated-to initializer ends up returning a different object after
all, the original allocation was wasted. Objective-C has the same
problem (one of the reasons why factory methods exist for things like
NSNumber and NSArray).

We do still get most of the benefits of Joe's original change. In
particular, vtables only ever contain allocating initializer entry
points, never the initializing ones, and never /both/ (which was a
thing that could happen with 'required' before).

rdar://problem/46823518
2019-01-14 13:06:50 -08:00
Gwynne Raskind
687585eafa Docs: Remove all references to long-unused LitRe tool. Also incidentally removes redundant/duplicate check for sphinx-build binary. 2019-01-13 21:15:56 -06:00
Slava Pestov
6a507b460e Document non_abi linkage in SIL.rst 2019-01-02 18:00:05 -05:00
Brett Koonce
79fec2d230 minor spelling tweaks 2018-12-30 07:45:38 -08:00
Mike Ash
798edb9d0e [Runtime][Stdlib][Overlays] Rename various Objective-C classes and methods that would conflict when loading old Swift libraries into a process alongside ABI-stable libraries.
rdar://problem/35768222
2018-09-13 16:55:10 -04:00
Erik Eckstein
99a9ed5535 SIL: remove the pinning instructions: strong_pin, strong_unpin, is_unique_or_pinned
They are not used anymore after removing the pinning addressors.
2018-08-23 12:47:56 -07:00
Andrew Trick
c9033ed938 Add a SIL attribute [without_actually_escaping].
ConvertFunction and reabstraction thunks need this attribute. Otherwise,
there is no way to identify that withoutActuallyEscaping was used
to explicitly perform a conversion.

The destination of a [without_actually_escaping] conversion always has
an escaping function type. The source may have either an escaping or
@noescape function type. The conversion itself may be a nop, and there
is nothing distinctive about it. The thing that is special about these
conversions is that the source function type may have unboxed
captures. i.e. they have @inout_aliasable parameters. Exclusivity
requires that the compiler enforce a SIL data flow invariant that
nonescaping closures with unboxed captures can never be stored or
passed as an @escaping function argument. Adding this attribute allows
the compiler to enforce the invariant in general with an escape hatch
for withoutActuallyEscaping.
2018-08-14 17:14:25 -07:00
Jordan Rose
7d8acefd3d [docs] Update SIL.rst for the new verifier checks on enum instructions (#18450) 2018-08-01 13:12:18 -07:00
Andrew Trick
f6ba49e292 Add docs/SILDevelopment.rst.
Document SILFunction and `apply` arguments.

Create TBD headers to give the document some form.
2018-07-27 11:02:01 -07:00
kitasuke
8e591b0820 Fix wrong blockquote 2018-07-01 17:35:04 +09:00
Joe Shajrawi
93c036a77d Documentation: add entry for value_to_bridge_object 2018-05-22 17:15:43 -07:00
kitasuke
c4b4ecb3a4 Add current behavior for alloc_stack explicitly 2018-05-16 01:05:33 +09:00
Andrew Trick
24c94f78fc Document begin/end access marker flags in SIL.rst. 2018-05-14 10:51:18 -07:00
kitasuke
7afd2f5078 Delete explanation about dynamically allocated memory from alloc_stack section 2018-05-14 15:45:13 +09:00
Slava Pestov
e24fbbbc17 Fix formatting in SIL.rst 2018-05-01 17:40:53 -06: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