mmtk 0.32.0

MMTk is a framework for the design and implementation of high-performance and portable memory managers.
Documentation
pub mod heap_parameters;
pub mod vm_layout;

mod mmapper;
pub use self::mmapper::Mmapper;

mod map;
pub(crate) use self::map::CreateFreeListResult;
pub use self::map::VMMap;
use self::vm_layout::vm_layout;
mod map32;
#[cfg(target_pointer_width = "64")]
mod map64;

#[cfg(target_pointer_width = "32")]
pub fn create_vm_map() -> Box<dyn VMMap + Send + Sync> {
    Box::new(map32::Map32::new())
}

#[cfg(target_pointer_width = "64")]
pub fn create_vm_map() -> Box<dyn VMMap + Send + Sync> {
    if !vm_layout().force_use_contiguous_spaces {
        Box::new(map32::Map32::new())
    } else {
        Box::new(map64::Map64::new())
    }
}

pub fn create_mmapper() -> Box<dyn Mmapper> {
    // TODO: Select a MapStateStorage based on the actuall address space size.
    // For example, choose ByteMapStateStorage for 39-bit or less virtual space.

    use crate::util::heap::layout::mmapper::csm::ChunkStateMmapper;
    Box::new(ChunkStateMmapper::new())
}

use crate::util::Address;
use std::ops::Range;

/// The heap range between HEAP_START and HEAP_END
/// Heap range include the availble range, but may include some address ranges
/// that we count as part of the heap but we do not allocate into, such as
/// VM spaces. However, currently, heap range is the same as available range.
pub fn heap_range() -> Range<Address> {
    vm_layout().heap_start..vm_layout().heap_end
}

/// The avialable heap range between AVAILABLE_START and AVAILABLE_END.
/// Available range is what MMTk may allocate into.
pub fn available_range() -> Range<Address> {
    vm_layout().available_start()..vm_layout().available_end()
}