mmtk-core icon indicating copy to clipboard operation
mmtk-core copied to clipboard

Allocation Semantics

Open qinsoon opened this issue 4 years ago • 3 comments

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.

qinsoon avatar Oct 07 '20 02:10 qinsoon

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.

qinsoon avatar Oct 08 '20 02:10 qinsoon

PR #161 renamed enum Allocator to AllocationSemantics. More refactoring will be done in 0.2.

qinsoon avatar Nov 03 '20 23:11 qinsoon

We need to remove LOS from AllocationSemantic: https://github.com/mmtk/mmtk-core/issues/596

qinsoon avatar Jan 03 '24 02:01 qinsoon