Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/scripts/Make.user
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
FORCE_ASSERTIONS=1
LLVM_ASSERTIONS=1
USE_BINARYBUILDER_MMTK_JULIA=0
4 changes: 2 additions & 2 deletions mmtk/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mmtk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ lazy_static = "1.1"
# - change branch
# - change repo name
# But other changes including adding/removing whitespaces in commented lines may break the CI
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "ec745353a8de72b645613e0fef3ab7f5f1ad9bd1" }
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev = "051bc7470feef915c445305301e6113f86d3957b" }
# Uncomment the following to build locally
# mmtk = { path = "../repos/mmtk-core" }
log = {version = "0.4", features = ["max_level_trace", "release_max_level_off"] }
Expand Down
11 changes: 10 additions & 1 deletion mmtk/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,16 @@ pub extern "C" fn mmtk_gc_init(

// Set heap size
let success =
if min_heap_size != 0 {
// By default min and max heap size are 0, and we use the Stock GC heuristics
if min_heap_size == 0 && max_heap_size == 0 {
info!(
"Setting mmtk heap size to use Stock GC heuristics as defined in gc_trigger.rs",
);
builder
.options
.gc_trigger
.set(mmtk::util::options::GCTriggerSelector::Delegated)
} else if min_heap_size != 0 {
info!(
"Setting mmtk heap size to a variable size with min-max of {}-{} (in bytes)",
min_heap_size, max_heap_size
Expand Down
13 changes: 10 additions & 3 deletions mmtk/src/collection.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
use crate::SINGLETON;
use crate::{
jl_gc_prepare_to_collect, jl_gc_update_stats, jl_get_gc_disable_counter, jl_hrtime,
jl_throw_out_of_memory_error,
jl_gc_get_max_memory, jl_gc_prepare_to_collect, jl_gc_update_stats, jl_get_gc_disable_counter,
jl_hrtime, jl_throw_out_of_memory_error,
};
use crate::{JuliaVM, USER_TRIGGERED_GC};
use log::{info, trace};
use mmtk::util::alloc::AllocationError;
use mmtk::util::heap::GCTriggerPolicy;
use mmtk::util::opaque_pointer::*;
use mmtk::vm::{Collection, GCThreadContext};
use mmtk::Mutator;
use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicU64, Ordering};

use crate::{BLOCK_FOR_GC, STW_COND, WORLD_HAS_STOPPED};

static GC_START: AtomicU64 = AtomicU64::new(0);
pub static GC_START: AtomicU64 = AtomicU64::new(0);

pub struct VMCollection {}

Expand Down Expand Up @@ -111,6 +112,12 @@ impl Collection<JuliaVM> for VMCollection {
fn is_collection_enabled() -> bool {
unsafe { jl_get_gc_disable_counter() == 0 }
}

fn create_gc_trigger() -> Box<dyn GCTriggerPolicy<JuliaVM>> {
use crate::gc_trigger::*;
let max_memory = unsafe { jl_gc_get_max_memory() };
Box::new(JuliaGCTrigger::new(max_memory))
}
}

pub fn is_current_gc_nursery() -> bool {
Expand Down
Loading
Loading