Skip to content

Commit c773364

Browse files
authored
Merge pull request swiftlang#26842 from gottesmm/pr-30ea01bc2b3b5696b7ebd88b6c149bd1e7abcfe7
2 parents 364c926 + d05dc8a commit c773364

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

docs/SIL.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2802,6 +2802,21 @@ It is expected that the strong reference count of the object is one.
28022802
Furthermore, no other thread may increment the strong reference count during
28032803
execution of this instruction.
28042804

2805+
copy_unowned_value
2806+
``````````````````
2807+
::
2808+
2809+
sil-instruction ::= 'copy_unowned_value' sil-operand
2810+
2811+
%1 = copy_unowned_value %0 : $@unowned T
2812+
// %1 will be a strong @owned value of type $T.
2813+
// $T must be a reference type
2814+
2815+
Asserts that the strong reference count of the heap object referenced by ``%0``
2816+
is still positive, then increments the reference count and returns a new strong
2817+
reference to ``%0``. The intention is that this instruction is used as a "safe
2818+
ownership conversion" from ``unowned`` to ``strong``.
2819+
28052820
strong_retain_unowned
28062821
`````````````````````
28072822
::
@@ -3712,6 +3727,21 @@ This instruction has the same local semantics as ``retain_value`` but:
37123727
The intention is that this instruction is used to implement unmanaged
37133728
constructs.
37143729

3730+
copy_unmanaged_value
3731+
``````````````````````
3732+
3733+
::
3734+
3735+
sil-instruction ::= 'copy_unmanaged_value' sil-value
3736+
3737+
%1 = copy_unmanaged_value %0 : $@sil_unmanaged A
3738+
// %1 will be a strong @owned $A.
3739+
3740+
This instruction has the same semantics as ``copy_value`` except that its input
3741+
is a trivial ``@sil_unmanaged`` type that doesn't require ref counting. This is
3742+
intended to be used semantically as a "conversion" like instruction from
3743+
``unmanaged`` to ``strong`` and thus should never be removed by the optimizer.
3744+
37153745
copy_value
37163746
``````````
37173747

0 commit comments

Comments
 (0)