01.12.2012 Views

Architecture of Computing Systems (Lecture Notes in Computer ...

Architecture of Computing Systems (Lecture Notes in Computer ...

Architecture of Computing Systems (Lecture Notes in Computer ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

An Embedded GC Module with Support for Multiple Mutators 31<br />

3.3 Exact Garbage Collection<br />

Targett<strong>in</strong>g the employment <strong>in</strong> constra<strong>in</strong>t embedded devices, it is essential to provide<br />

an exact GC. A conservative collection is simply no option as its impreciseness<br />

would have to be paid for with additional usually spare memory resources.<br />

The exact garbage collection must be capable <strong>of</strong> a clear dist<strong>in</strong>ction between<br />

references and primitive data. This may be achieved either by the direct tagg<strong>in</strong>g<br />

<strong>of</strong> data words or by adm<strong>in</strong>istrative metadata. The latter option is the more<br />

economical on the heap where only <strong>in</strong>stances <strong>of</strong> well-def<strong>in</strong>ed class layouts reside.<br />

Adopt<strong>in</strong>g the bidirectional class layout <strong>of</strong> the SableVM [18] further allows to<br />

reduce the required metadata to the sizes <strong>of</strong> the primitive storage grow<strong>in</strong>g with<br />

positive <strong>of</strong>fsets and <strong>of</strong> the reference storage grow<strong>in</strong>g with negative <strong>of</strong>fsets from<br />

the object’s base address.<br />

Our GC architecture features distributed tapp<strong>in</strong>g modules to collect the root<br />

set <strong>of</strong> references from the mutators. These must also be able to identify references<br />

precisely with<strong>in</strong> the tapped storage elements. In our adaptation for SHAP,<br />

we chose the tagg<strong>in</strong>g approach for the <strong>in</strong>ternal stack and registers as the data<br />

conta<strong>in</strong>ed there<strong>in</strong> does not follow a only handful <strong>of</strong> structural bluepr<strong>in</strong>ts.<br />

3.4 Object Graph Mark<strong>in</strong>g<br />

Our architecture builds upon a decentralized collection <strong>of</strong> the root set. Each<br />

mutator core is extended by its own root scan unit, which collects the references<br />

conta<strong>in</strong>ed <strong>in</strong> the local registers and stack <strong>in</strong>to a mark table. As shown <strong>in</strong> Fig. 1,<br />

all mutator cores are arranged <strong>in</strong> a r<strong>in</strong>g on a GC bus, which is mastered by the<br />

MMU. This unit issues commands onto the r<strong>in</strong>g and receives their acknowledgements<br />

as they return on the other end. This r<strong>in</strong>g also serves the gradual merger<br />

<strong>of</strong> the contents <strong>of</strong> the <strong>in</strong>dividual root tables <strong>in</strong>to the global root set. While the<br />

MMU transmits an empty table, each core ORs the received table with its own<br />

table contents before forward<strong>in</strong>g it along the r<strong>in</strong>g. The f<strong>in</strong>al result is entered <strong>in</strong>to<br />

the central mark table <strong>in</strong>side the MMU.<br />

The local root scans operate concurrently to their associated mutator core.<br />

Once f<strong>in</strong>ished, they are deactivated for the rema<strong>in</strong>der <strong>of</strong> the GC cycle so that further<br />

modifications <strong>of</strong> the local root sets are not logged. This is safe as the mutators<br />

only ga<strong>in</strong> access to other references by load<strong>in</strong>g them from objects – which were,<br />

thus, reachable from the orig<strong>in</strong>al root set – or by creat<strong>in</strong>g new ones. Objects allocated<br />

dur<strong>in</strong>g the GC cycle are already implicitly marked by the allocation eng<strong>in</strong>e.<br />

After the completion <strong>of</strong> all root scans, the actual computation <strong>of</strong> the reachable<br />

subgraph is performed by the heap scan. Our optimized variant <strong>of</strong> the wellestablished<br />

tri-color mark<strong>in</strong>g uses the mark table to tell reached from unreached<br />

objects. The colors red and green further dist<strong>in</strong>guish the reachable objects <strong>in</strong>to<br />

scanned and unscanned ones. The mean<strong>in</strong>g <strong>of</strong> these colors alternates and is determ<strong>in</strong>ed<br />

by the color <strong>of</strong> the active GC cycle. Initially, all references are unscanned<br />

and have the color opposite to the current cycle. Upon be<strong>in</strong>g scanned, a reference<br />

assumes the cycle color. References to newly-allocated objects are immediately<br />

assigned the active color as they do not conta<strong>in</strong> valid references and need not be

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!