diff --git a/allocator/build.rs b/allocator/build.rs index 84d26b4d89465..920657a5ffd45 100644 --- a/allocator/build.rs +++ b/allocator/build.rs @@ -12,6 +12,7 @@ compile_error!("Requires x86_64 with 64 bit pointer width."); static POINTER_MASK: &str = "-DPOINTER_MASK=0xFFFFFFFFFFFFFFF8"; static FPIC: &str = "-fPIC"; static MULTITHREADED: &str = "-DGC_ALWAYS_MULTITHREADED"; +static NO_INCREMENTAL: &str = "-DGC_DISABLE_INCREMENTAL"; fn run(name: &str, mut configure: F) where @@ -46,7 +47,10 @@ fn main() { run("./configure", |cmd| { cmd.arg("--enable-static").arg("--disable-shared").env( "CFLAGS", - format!("{} {} {}", POINTER_MASK, FPIC, MULTITHREADED), + format!( + "{} {} {} {}", + POINTER_MASK, FPIC, MULTITHREADED, NO_INCREMENTAL + ), ) }); diff --git a/allocator/src/boehm.rs b/allocator/src/boehm.rs index 8d9989177517e..65bd97435df5e 100644 --- a/allocator/src/boehm.rs +++ b/allocator/src/boehm.rs @@ -57,8 +57,6 @@ extern "C" { pub(crate) fn GC_gcollect(); - pub(crate) fn GC_start_performance_measurement(); - pub(crate) fn GC_get_full_gc_total_time() -> usize; pub(crate) fn GC_get_prof_stats(prof_stats: *mut ProfileStats, stats_size: usize) -> usize; @@ -77,4 +75,8 @@ extern "C" { pub(crate) fn GC_register_my_thread(stack_base: *mut u8) -> i32; pub(crate) fn GC_unregister_my_thread() -> i32; + + pub(crate) fn GC_allow_register_threads(); + + pub(crate) fn GC_init(); } diff --git a/allocator/src/lib.rs b/allocator/src/lib.rs index 4dbdb522acd03..26ee40e1e6a08 100644 --- a/allocator/src/lib.rs +++ b/allocator/src/lib.rs @@ -148,21 +148,25 @@ impl GcAllocator { } pub fn init() { - unsafe { boehm::GC_start_performance_measurement() }; + unsafe { boehm::GC_init() } } /// Returns true if thread was successfully registered. pub unsafe fn register_thread(stack_base: *mut u8) -> bool { - boehm::GC_register_my_thread(stack_base) != 0 + boehm::GC_register_my_thread(stack_base) == 0 } /// Returns true if thread was successfully unregistered. pub unsafe fn unregister_thread() -> bool { - boehm::GC_unregister_my_thread() != 0 + boehm::GC_unregister_my_thread() == 0 } pub fn thread_registered() -> bool { - unsafe { boehm::GC_thread_is_registered() != 0 } + unsafe { boehm::GC_thread_is_registered() == 0 } + } + + pub fn allow_register_threads() { + unsafe { boehm::GC_allow_register_threads() } } }