mmtk 0.32.0

MMTk is a framework for the design and implementation of high-performance and portable memory managers.
Documentation
// GITHUB-CI: MMTK_PLAN=all

use super::mock_test_prelude::*;
use crate::util::heap::vm_layout::VMLayout;

pub fn test_with_vm_layout(layout: Option<VMLayout>) {
    use crate::plan::AllocationSemantics;

    let mut fixture = MutatorFixture::create_with_builder(|builder| {
        // 1MB
        builder
            .options
            .gc_trigger
            .set(crate::util::options::GCTriggerSelector::FixedHeapSize(
                1024 * 1024,
            ));
        // Set layout
        if let Some(layout) = layout {
            builder.set_vm_layout(layout);
        }
    });

    // Test allocation
    let addr = memory_manager::alloc(&mut fixture.mutator, 8, 8, 0, AllocationSemantics::Default);
    let obj = MockVM::object_start_to_ref(addr);
    // Test SFT
    assert!(memory_manager::is_in_mmtk_spaces(obj));
    // Test mmapper
    assert!(memory_manager::is_mapped_address(addr));
}

#[test]
fn test_vm_layout_default() {
    with_mockvm(
        default_setup,
        || {
            test_with_vm_layout(None);
        },
        no_cleanup,
    )
}