From 4797c8eaec88e755d2443ae4a74d5bb8a14ed697 Mon Sep 17 00:00:00 2001 From: Eduardo Souza Date: Mon, 29 Jan 2024 04:25:29 +0000 Subject: [PATCH] Removing references to enable_collection and disable_collection --- benches/alloc.rs | 5 ++--- docs/header/mmtk.h | 6 ------ src/memory_manager.rs | 5 ++--- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/benches/alloc.rs b/benches/alloc.rs index adf388efdd..99482e3034 100644 --- a/benches/alloc.rs +++ b/benches/alloc.rs @@ -5,9 +5,8 @@ use mmtk::util::test_util::fixtures::*; use mmtk::AllocationSemantics; pub fn bench(c: &mut Criterion) { - // Disable GC so we won't trigger GC - let mut fixture = MutatorFixture::create_with_heapsize(1 << 30); - memory_manager::disable_collection(fixture.mmtk()); + // Setting a larger heap so we won't trigger GC, but we should disable GC if we can + let mut fixture = MutatorFixture::create_with_heapsize(1 << 60); c.bench_function("alloc", |b| { b.iter(|| { let _addr = diff --git a/docs/header/mmtk.h b/docs/header/mmtk.h index 7fb6949d6b..e6fb6e2546 100644 --- a/docs/header/mmtk.h +++ b/docs/header/mmtk.h @@ -34,12 +34,6 @@ extern void mmtk_flush_mutator(MMTk_Mutator mutator); // Initialize MMTk scheduler and GC workers extern void mmtk_initialize_collection(void* tls); -// Allow MMTk to perform a GC when the heap is full -extern void mmtk_enable_collection(); - -// Disallow MMTk to perform a GC when the heap is full -extern void mmtk_disable_collection(); - // Allocate memory for an object extern void* mmtk_alloc(MMTk_Mutator mutator, size_t size, diff --git a/src/memory_manager.rs b/src/memory_manager.rs index bc18cfa67a..a1b21af238 100644 --- a/src/memory_manager.rs +++ b/src/memory_manager.rs @@ -35,9 +35,8 @@ use std::sync::atomic::Ordering; /// 2. Set command line options for MMTKBuilder by [`crate::memory_manager::process`] or [`crate::memory_manager::process_bulk`]. /// 3. Initialize MMTk by calling this function, `mmtk_init()`, and pass the builder earlier. This call will return an MMTK instance. /// Usually a binding store the MMTK instance statically as a singleton. We plan to allow multiple instances, but this is not yet fully -/// supported. Currently we assume a binding will only need one MMTk instance. -/// 4. Enable garbage collection in MMTk by [`crate::memory_manager::enable_collection`]. A binding should only call this once its -/// thread system is ready. MMTk will not trigger garbage collection before this call. +/// supported. Currently we assume a binding will only need one MMTk instance. Note that GC is enabled by default and the binding should +/// implement `VMCollection::is_collection_disabled()` if it requires that the GC should be disabled at a particular time. /// /// Note that this method will attempt to initialize a logger. If the VM would like to use its own logger, it should initialize the logger before calling this method. /// Note that, to allow MMTk to do GC properly, `initialize_collection()` needs to be called after this call when