Commit 6364e803 authored by Eliot Moss's avatar Eliot Moss

Another pass at defining what persists.

parent 4c74ca7f
......@@ -120,52 +120,57 @@ types are native-safe:
reference types* as well as ``struct``, ``array`` or ``hybrid`` that contains
them.)
Types Related to the Persistence Extension
==========================================
In the persistence extension, a type may be prefixed by ``persistent`` or
``transient``. Transient data are not preserved across system stoppages,
while persistent data are. If an object is strongly reachable from a
persistent root via a chain of non-transient references, then the object will
persist. This is true even if some references to the object are marked
``transient``. If an object becomes unreachable from persistent roots, then
the system can reclaim it (i.e., persistent data can be garbage collected).
**TODO** What about persistent data in the untraced region? No reason not to
support that, but it may require using a persistent uptr type when allocating,
etc.
An implementation of Mu might not support persistence according to the levels
of persistence listed below. If certain types are not persistent, then
``persistent`` and ``transient`` are ignored for those types.
The levels of persistence:
+-------+------------------------------------------+
| Level | Type supported |
+-------+------------------------------------------+
| 0 | None (no persistence) |
+-------+------------------------------------------+
| 1 | Not functions, threads, or thread stacks |
+-------+------------------------------------------+
| 2 | Not threads or thread stacks |
+-------+------------------------------------------+
| 3 | All types |
+-------+------------------------------------------+
Note that while Level 3 persistence can, in principle, save the value of an
instance of any type, whether the value is useful after a stoppage depends on
other factors. For example, and open file handle is probably not useful after
a system stoppage and recovery.
If a Mu implementation support Level N persistence, a Mu client may choose to
use any level of persistence M as long as M does not exceed N. A Mu client
Types and the Persistence Extension
===================================
Mu defines several possible levels of persistence:
+-------+-----------------------------------------------------------+
| Level | Types persistable |
+-------+-----------------------------------------------------------+
| 0 | None (no persistence) |
+-------+-----------------------------------------------------------+
| 1 | Most types, but not code-related or thread-related types |
+-------+-----------------------------------------------------------+
| 2 | Most, but not thread-related types |
+-------+-----------------------------------------------------------+
| 3 | Most types |
+-------+-----------------------------------------------------------+
Note that ``uptr`` and ``ufuncptr`` types are never persistable. (**TODO**
define a persistence explicitly managed heap.) The code-related types are
``funcref`` types and ``irbuilderref``. The thread-related types are
``threadref`` and ``stackref``.
Also note that while Level 3 persistence can, in principle, save the value of
an instance of almost any type, whether the value is _useful_ after a stoppage
depends on other factors. For example, an open file handle is probably not
useful after a system stoppage and recovery.
If a Mu implementation supports Level N persistence, a Mu client may choose to
use any level of persistence M such that M does not exceed N. The
implementation will ignore ``persistent`` and ``transient`` labels on
non-persistable types and treat the indicated cells as transient. A Mu client
may also choose whether, for types not specifically marked ``persistent`` or
``transient`` what the default should be. Furthermore, the client can
indicate (a) the default for most types and (b) the default for functions,
threads, and thread stacks (the default for all three must be the same) when
working with Level 3 persistence.
``transient`` (as described below) what the default should be. Furthermore,
the client can indicate (a) the default for most types and (b) the default for
functions, threads, and thread stacks (the default for all three must be the
same) when working with Level 3 persistence.
In the persistence extension, each type argument of a ``struct``, ``array``,
``vec``, or ``hybrid`` type may optionally be prefixed with the label
``transient``. The type in a ``.global`` may optionally be prefixed with one
of the labels ``persistent`` or ``transient``. In accordance with the level
of support for persistence in a given Mu implementation, the client's choice
among the available levels, and the client's selection of defaults, a given
memory cell may be **persistent**. Specifically, a cell is persistent if it
is a ``.global`` cell whose type is persistent (by label or default), or if
its containing object is referred to by a persistent cell with a persistable
reference type.
A persistent cell's contents are preserved across system stoppages while other
cells' contents are not. The value preserved is that stored by most recent
committed **transaction** that updated the cell.
Primitive Non-reference Types
=============================
......
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