Skip to content

Commit

Permalink
Ask from binding if GC is disabled (#126)
Browse files Browse the repository at this point in the history
Upstream PR: mmtk/mmtk-core#1075
Julia PR: mmtk/julia#35

---------

Co-authored-by: mmtkgc-bot <[email protected]>
(cherry picked from commit eac7e88)

# Conflicts:
#	mmtk/Cargo.lock
#	mmtk/Cargo.toml
#	mmtk/src/collection.rs
  • Loading branch information
udesou authored and mergify[bot] committed Feb 7, 2024
1 parent b0695a9 commit 9385919
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mmtk/Cargo.lock

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

8 changes: 8 additions & 0 deletions mmtk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ edition = "2018"
[package.metadata.julia]
# Our CI matches the following line and extract mmtk/julia. If this line is updated, please check ci yaml files and make sure it works.
julia_repo = "https://github.com/mmtk/julia.git"
<<<<<<< HEAD
julia_version = "874179eed2d259d60947a61144e9c9f36a7db698"
=======
julia_version = "22524a81f9920a8ecc70f195d53b145761de2fa0"
>>>>>>> eac7e88 (Ask from binding if GC is disabled (#126))

[lib]
crate-type = ["cdylib"]
Expand All @@ -31,7 +35,11 @@ lazy_static = "1.1"
# - change branch
# - change repo name
# But other changes including adding/removing whitespaces in commented lines may break the CI
<<<<<<< HEAD
mmtk = { git = "https://github.com/udesou/mmtk-core.git", rev="9da979de09a24f4524011e0d9086e1bba43fa9d7" }
=======
mmtk = { git = "https://github.com/mmtk/mmtk-core.git", rev="7cafe560139211c0e3a74815d2e288278506099d" }
>>>>>>> eac7e88 (Ask from binding if GC is disabled (#126))
# Uncomment the following to build locally
# mmtk = { path = "../../mmtk-core" }
log = {version = "0.4", features = ["max_level_trace", "release_max_level_off"] }
Expand Down
9 changes: 9 additions & 0 deletions mmtk/src/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ use mmtk::util::opaque_pointer::*;
use mmtk::vm::ActivePlan;
use mmtk::vm::{Collection, GCThreadContext};
use mmtk::Mutator;
<<<<<<< HEAD
use std::sync::atomic::{AtomicBool, AtomicU32, AtomicU64, Ordering};
=======
use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicU32, AtomicU64, Ordering};
>>>>>>> eac7e88 (Ask from binding if GC is disabled (#126))

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

Expand Down Expand Up @@ -111,6 +115,7 @@ impl Collection<JuliaVM> for VMCollection {
crate::api::JULIA_MALLOC_BYTES.load(Ordering::SeqCst)
}

<<<<<<< HEAD
#[inline(always)]
fn is_collection_disabled() -> bool {
unsafe {
Expand All @@ -121,6 +126,10 @@ impl Collection<JuliaVM> for VMCollection {
Ordering::SeqCst,
) > 0
}
=======
fn is_collection_enabled() -> bool {
unsafe { AtomicU32::load(&jl_gc_disable_counter, Ordering::SeqCst) <= 0 }
>>>>>>> eac7e88 (Ask from binding if GC is disabled (#126))
}
}

Expand Down

0 comments on commit 9385919

Please sign in to comment.