Skip to content

[SIL] Doc'd store_unowned and load_unowned. #67693

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions docs/SIL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5222,13 +5222,45 @@ the operand (source) heap object. It need not be atomic with respect to

load_unowned
````````````
::

sil-instruction ::= 'load_unowned' '[take]'? sil-operand

%1 = load_unowned [take] %0 : $*@sil_unowned T
// T must be a reference type

Increments the strong reference count of the object stored at ``%0``.

Decrements the unowned reference count of the object stored at ``%0`` if
``[take]`` is specified. Additionally, the storage is invalidated.

TODO: Fill this in
Requires that the strong reference count of the heap object stored at ``%0`` is
positive. Otherwise, traps.

This operation must be atomic with respect to the final ``strong_release`` on
the operand (source) heap object. It need not be atomic with respect to
``store_unowned`` or ``load_unowned`` operations on the same address.

store_unowned
`````````````
::

sil-instruction ::= 'store_unowned' sil-value 'to' '[init]'? sil-operand

store_unowned %0 to [init] %1 : $*@sil_unowned T
// T must be a reference type

Increments the unowned reference count of the object at ``%0``.

Decrements the unowned reference count of the object previously stored at ``%1``
if ``[init]`` is not specified.

The storage must be initialized iff ``[init]`` is not specified.

This operation must be atomic with respect to the final ``strong_release`` on
the operand (source) heap object. It need not be atomic with respect to
``store_unowned`` or ``load_unowned`` operations on the same address.

TODO: Fill this in

fix_lifetime
````````````
Expand Down