Skip to content

Commit 7500d0b

Browse files
committed
[SIL] Doc'd {store,load}_unowned.
Address the todo from 2016.
1 parent f94837e commit 7500d0b

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
@@ -5268,13 +5268,45 @@ operations on the same address.
52685268

52695269
load_unowned
52705270
````````````
5271+
::
5272+
5273+
sil-instruction ::= 'load_unowned' '[take]'? sil-operand
5274+
5275+
%1 = load_unowned [take] %0 : $*@sil_unowned T
5276+
// T must be a reference type
5277+
5278+
Increments the strong reference count of the object stored at ``%0``.
5279+
5280+
Decrements the unowned reference count of the object stored at ``%0`` if
5281+
``[take]`` is specified. Additionally, the storage is invalidated.
52715282

5272-
TODO: Fill this in
5283+
Requires that the strong reference count of the heap object stored at ``%0`` is
5284+
positive. Otherwise, traps.
5285+
5286+
This operation must be atomic with respect to the final ``strong_release`` on
5287+
the operand (source) heap object. It need not be atomic with respect to
5288+
``store_unowned`` or ``load_unowned`` operations on the same address.
52735289

52745290
store_unowned
52755291
`````````````
5292+
::
5293+
5294+
sil-instruction ::= 'store_unowned' sil-value 'to' '[init]'? sil-operand
5295+
5296+
store_unowned %0 to [init] %1 : $*@sil_unowned T
5297+
// T must be a reference type
5298+
5299+
Increments the unowned reference count of the object at ``%0``.
5300+
5301+
Decrements the unowned reference count of the object previously stored at ``%1``
5302+
if ``[init]`` is not specified.
5303+
5304+
The storage must be initialized iff ``[init]`` is not specified.
5305+
5306+
This operation must be atomic with respect to the final ``strong_release`` on
5307+
the operand (source) heap object. It need not be atomic with respect to
5308+
``store_unowned`` or ``load_unowned`` operations on the same address.
52765309

5277-
TODO: Fill this in
52785310

52795311
fix_lifetime
52805312
````````````

0 commit comments

Comments
 (0)