Description
Policy-specific code should not be in the Plans. The old MMTk use the plans only for dispatch to policies (eg a switch statement dispatching to various implementations of traceObject()
.
For both software engineering and performance reasons, work packets should be homogenous w.r.t. the type of work they do.
So for something like traceObject()
, there should be a separate work packet type for every space (note that there needs to be one per space, rather than one per policy since spaces can maintain space-specific state).
Then a general call to traceObject()
will place the respective object on the correct work queue according to which space the object resides in.
The dispatch can be optimized in a variety of ways, including an address-based scheme, where certain bits within the object address denote the space ID and the dispatch requires simply indexing into an array of space-specific work queues. This can be further improved by hiding the dispatch behind the syntactic sugar of a function call on the ObjectReference
type.