Constantsยง
- GLOBAL_
SIDE_ ๐METADATA_ BASE_ OFFSET - The compile-time base offset for global side metadata layout. We treat offsets as relative (starting from zero) and add the runtime base address when computing actual addresses.
- GLOBAL_
SIDE_ METADATA_ VM_ BASE_ OFFSET - The base offset for the global side metadata available to VM bindings.
- LOCAL_
SIDE_ ๐METADATA_ BASE_ OFFSET_ FOR_ LAYOUT - LOCAL_
SIDE_ METADATA_ VM_ BASE_ OFFSET - The base address for the local side metadata space available to VM bindings, to be used for the per-object metadata. VM bindings must use this to avoid overlap with core internal local side metadata.
- LOG_
GLOBAL_ ๐SIDE_ METADATA_ WORST_ CASE_ RATIO - LOG_
LOCAL_ ๐SIDE_ METADATA_ WORST_ CASE_ RATIO
Staticsยง
- SIDE_
METADATA_ ๐BASE_ ADDRESS - The run-time base address for side metadata. This is initialized at startup by mmapping necessary memory address for side metadata,
and should be used as the base when computing actual side metadata addresses.
We use OnceLock to ensure it is only initialized once. To eliminate the cost of accessing OnceLock after initialization, we can use get().unwrap_unchecked().
TODO: use
OncLock::get_unchecked()once it is stabilized. - VM_
SIDE_ ๐METADATA_ UPPER_ BOUND_ OFFSET - The upper bound for VM side metadata layout. We need to list all the VM side metadata specs, compute the upper bound, and store it here.
Functionsยง
- global_
side_ metadata_ base_ address - Get the runtime side metadata base address.
- global_
side_ ๐metadata_ bytes - Total global side metadata bytes (independent of the runtime base address).
- global_
side_ metadata_ vm_ base_ address - The base address for the global side metadata space available to VM bindings, to be used for the per-object metadata. VM bindings must use this to avoid overlap with core internal global side metadata.
- initialize_
side_ ๐metadata_ base - Initialize the side metadata base address by reserving address space with quarantine mmap.
- local_
side_ ๐metadata_ base_ address - set_
vm_ ๐side_ metadata_ specs - Record VM side metadata layout so startup reservation can cover VM specs.
This must be called before
initialize_side_metadata_base(). - side_
metadata_ ๐reserved_ bytes - Total side metadata bytes that should be reserved at startup (independent of runtime base, with alignment).
- total_
side_ ๐metadata_ bytes - Total side metadata bytes that should be reserved at startup (independent of runtime base, without alignment).
- vo_
bit_ side_ metadata_ addr - Base address of VO bit, public to VM bindings which may need to use this.