mmtk-core
mmtk-core copied to clipboard
Allocation Semantics
Allocation semantics are a set of properties that an object may have. This is a replacement of the current enum Allocator
(which also helps avoid confusion of the name Allocator). Allocation semantics are like UNIX file attributes. You can or
those flags/semantics.
Each space defines the semantics for objects in it. For example, all objects in an immortal space are non-moving. Pinned objects in certain spaces are non-moving.
A plan defines how to map allocation semantics to the actual allocators (which further map to spaces). The plan implementer needs to provide a complete mapping for all the combinations of allocation semantics (though he may use fallback, or simply fail on certain allocation semantics).
Two APIs are related with this:
-
alloc(..., semantics) -> object
: uses the mapping defined by the plan to allocate object -
has_semantic(object, semantics) -> bool
: uses the semantics defined by the space to determine if the object has those semantics.
Semantics may include immortal, code, read-only, etc. However, large-object is not a semantic. A plan may choose a large object allocator based on the size of the allocation.
PR #161 renamed enum Allocator
to AllocationSemantics
. More refactoring will be done in 0.2.
We need to remove LOS from AllocationSemantic
: https://github.com/mmtk/mmtk-core/issues/596