...
 
Commits (11)
......@@ -16,7 +16,7 @@ memory must be allocated by the ``ALLOCA`` or ``ALLOCAHYBRID`` instructions or
using the Mu client interface.
This specification does not mandate any object layout, but it is recommended to
layout common data types as in the platform application binary interface (ABI)
lay out common data types as in the platform application binary interface (ABI)
so that the native interface is easier to implement.
Basic Concepts
......@@ -45,7 +45,7 @@ refers to a memory location in *any* part of the Mu memory.
Mu objects can be replicated.
When allocating Mu memory locations (in the heap, stack or global memory),
Mu guarantee the location can hold Mu values of a particular type and, as
Mu guarantees the location can hold Mu values of a particular type and, as
long as the type allows atomic access, the location can be accessed
atomically. The implementation must ensure all memory locations are
allocated in such a way. For example, it should not allocate an integer
......@@ -207,6 +207,30 @@ references which refers to a weakly reachable object to ``NULL``.
The garbage collector may move objects.
Persistent Memory
=================
The optional persistence extension adds support for state to persist across
system failures. The persistence extension assumes that failures are
**fail-stop**, that is, arbitrary failures are not allowed, but a Mu instance
may stop execution and then be recovered at some later time.
What Persists
-------------
We say a given value **persists** if its state is guaranteed to be available
after a stoppage.
Objects of persistent type that are strongly reachable via chains of
non-transient references from persistent roots will persist. A **persistent
root** is a global cell whose type is a persistent type.
Also, the persistence extension supports an explicitly managed **untraced
persistent heap**. ``NEW`` using a persistent ``uptr`` type will allocate an
object in this heap, and a later (unsafe) native call ``free`` will free it.
Such objects are non-moving and are not considered when determining
reachability of ordinary obejcts for persistence.
Memory Accessing
================
......
......@@ -103,8 +103,8 @@ either itself or a member of any component of T.
arbitrarily nested members.
The type parameter *T* in ``uptr<T>`` and the return type and all parameter
types of *sig* in ``ufuncptr<sig>`` must be **native-safe**. It is defined as
following:
types of *sig* in ``ufuncptr<sig>`` must be **native-safe**. The following
types are native-safe:
* ``void``, ``int<n>``, ``float`` and ``double`` are *native-safe*.
......@@ -120,6 +120,58 @@ following:
reference types* as well as ``struct``, ``array`` or ``hybrid`` that contains
them.)
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`` (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
=============================
......@@ -205,7 +257,7 @@ Pointer Types
``uptr`` and ``ufuncptr`` are (untraced) pointer types which are represented by
the integral address of the referent. They are part of the (unsafe) native
interface. The "u" in their names stand for "untraced". Their values are not
affected by the garbage collection, even if their addresses are obtained from
affected by garbage collection, even if their addresses are obtained from
pinning heap objects which are later unpinned.
``uptr`` is the data pointer type. It points to a region in the native address
......