To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit e5848b32 authored by qinsoon's avatar qinsoon
Browse files

initial commit for issue27.

parent ecef49cd
......@@ -180,6 +180,28 @@ Return the created ``tagref64`` value.
They have undefined behaviours if ``%tr`` does not hold the value of the
expected type.
Garbage Collection Instructions
===============================
.. _finaliser:
Finaliser
---------
::
[0x280]@uvm.gc.prevent_death_once (%r: ref<T>) -> void
[0x281]@uvm.gc.next_object_to_finalise () -> ref<void>
- ``prevent_death_once`` tags an object reference as *finalisable*. When the GC
decided that the object of ``%r`` is a garbage, it will put the reference
to the **objects-to-finalise queue** instead of reclaiming the memory. The
object will remain alive in the queue. This instruction is *atomic*.
- ``next_object_to_finalise`` removes one reference from the
**objects-to-finalise queue** and returns it.
The current Mu thread blocks if this queue is empty.
This instruction is *atomic*.
Math Instructions
=================
......
......@@ -207,6 +207,22 @@ references which refers to a weakly reachable object to ``NULL``.
The garbage collector may move objects.
Finaliser
---------
Mu does not invoke client-side finalisers upon object death for the client.
However, Mu maintains an
**objects-to-finalise queue**. Client can mark an object as finalisable with
the common instruction ``@uvm.gc.prevent_death_once``
(see `Common Instruction <common-insts.rst#finaliser>`__).
Mu guarantees that finalisable objects will be put to an **objects-to-finalise
queue** at the first time they are found dead,
and remain alive in the queue. Client can use ``@uvm.gc.next_object_to_finalise``
to fetch an object reference from the queue, and invoke its finaliser. This
instruction blocks the thread when the queue is empty. Client can consider starting
a dedicated finalising thread, which runs Mu code as a loop to fetch finalisable
objects, and invoke finalisers.
Memory Accessing
================
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment