Module layout

Module layout 

Source

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.