37. Root manager

37.1. Basics

.root.def: The root node of the object graph is the node which defines whether objects are accessible, and the place from which the mutator acts to change the graph. In the MPS, a root is an object which describes part of the root node. The root node is the total of all the roots attached to the space.

Note

Note that this combines two definitions of root: the accessibility is what defines a root for tracing (see analysis.tracer.root.* and the mutator action for barriers (see analysis.async-gc.root). Pekka P. Pirinen, 1998-03-20.

.root.repr: Functionally, roots are defined by their scanning functions. Roots could be represented as function closures: that is, a pointer to a C function and some auxiliary fields. The most general variant of roots is just that. However, for reasons of efficiency, some special variants are separated out.

37.2. Details

37.2.1. Creation

.create: A root becomes “active” as soon as it is created.

.create.col: The root inherits its colour from the mutator, since it can only contain references copied there by the mutator from somewhere else. If the mutator is grey for a trace when a root is created then that root will be used to determine accessibility for that trace. More specifically, the root will be scanned when that trace flips.

37.2.2. Destruction

.destroy: It’s OK to destroy a root at any time, except perhaps concurrently with scanning it, but that’s prevented by the arena lock. If a root is destroyed the references in it become invalid and unusable.

37.2.3. Invariants

.inv.white: Roots are never white for any trace, because they cannot be condemned.

.inv.rank: Roots always have a single rank. A root without ranks would be a root without references, which would be pointless. The tracer doesn’t support multiple ranks in a single colour.

37.2.4. Scanning

.method: Root scanning methods are provided by the client so that the MPS can locate and scan the root set. See protocol.mps.root for details.

Note

There are some more notes about root methods in meeting.qa.1996-10-16.