Skip to content

Commit 0d58161

Browse files
committed
[SIL] Doc'd {store,load}_unowned.
Address the todo from 2016.
1 parent 77e694a commit 0d58161

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

docs/SIL.rst

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5222,13 +5222,45 @@ the operand (source) heap object. It need not be atomic with respect to
52225222

52235223
load_unowned
52245224
````````````
5225+
::
5226+
5227+
sil-instruction ::= 'load_unowned' '[take]'? sil-operand
5228+
5229+
%1 = load_unowned [take] %0 : $*@sil_unowned T
5230+
// T must be a reference type
5231+
5232+
Increments the strong reference count of the object stored at ``%0``.
5233+
5234+
Decrements the unowned reference count of the object stored at ``%0`` if
5235+
``[take]`` is specified. Additionally, the storage is invalidated.
52255236

5226-
TODO: Fill this in
5237+
Requires that the strong reference count of the heap object stored at ``%0`` is
5238+
positive. Otherwise, traps.
5239+
5240+
This operation must be atomic with respect to the final ``strong_release`` on
5241+
the operand (source) heap object. It need not be atomic with respect to
5242+
``store_unowned`` or ``load_unowned`` operations on the same address.
52275243

52285244
store_unowned
52295245
`````````````
5246+
::
5247+
5248+
sil-instruction ::= 'store_unowned' sil-value 'to' '[init]'? sil-operand
5249+
5250+
store_unowned %0 to [init] %1 : $*@sil_unowned T
5251+
// T must be a reference type
5252+
5253+
Increments the unowned reference count of the object at ``%0``.
5254+
5255+
Decrements the unowned reference count of the object previously stored at ``%1``
5256+
if ``[init]`` is not specified.
5257+
5258+
The storage must be initialized iff ``[init]`` is not specified.
5259+
5260+
This operation must be atomic with respect to the final ``strong_release`` on
5261+
the operand (source) heap object. It need not be atomic with respect to
5262+
``store_unowned`` or ``load_unowned`` operations on the same address.
52305263

5231-
TODO: Fill this in
52325264

52335265
fix_lifetime
52345266
````````````

0 commit comments

Comments
 (0)