diff --git a/Cargo.lock b/Cargo.lock index 679a02441c486..5aeda8f6aec00 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1044,12 +1044,6 @@ dependencies = [ "winapi 0.3.6", ] -[[package]] -name = "fs_extra" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" - [[package]] name = "fst" version = "0.3.0" @@ -1491,17 +1485,6 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" -[[package]] -name = "jemalloc-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bef0d4ce37578dfd80b466e3d8324bd9de788e249f1accebb0c472ea4b52bdc" -dependencies = [ - "cc", - "fs_extra", - "libc", -] - [[package]] name = "jobserver" version = "0.1.16" @@ -1926,6 +1909,16 @@ dependencies = [ "rustc_version", ] +[[package]] +name = "mimalloc-sys" +version = "0.1.6-dev" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8943b38257eabf485d80499e273afbcbec16b1b581efc611230e3cda8c9b5e40" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "mime" version = "0.3.13" @@ -3193,7 +3186,7 @@ dependencies = [ name = "rustc-main" version = "0.0.0" dependencies = [ - "jemalloc-sys", + "mimalloc-sys", "rustc_codegen_ssa", "rustc_driver", "rustc_target", diff --git a/src/rustc/Cargo.toml b/src/rustc/Cargo.toml index 997d139383798..825e3655ac3b9 100644 --- a/src/rustc/Cargo.toml +++ b/src/rustc/Cargo.toml @@ -16,10 +16,19 @@ rustc_driver = { path = "../librustc_driver" } # crate is intended to be used by codegen backends, which may not be in-tree. rustc_codegen_ssa = { path = "../librustc_codegen_ssa" } -[dependencies.jemalloc-sys] -version = '0.3.0' +#[dependencies.jemalloc-sys] +#version = '0.3.0' +#optional = true +#features = ['unprefixed_malloc_on_supported_platforms'] + +[dependencies.mimalloc-sys] +version = '=0.1.6-dev' optional = true -features = ['unprefixed_malloc_on_supported_platforms'] [features] -jemalloc = ['jemalloc-sys'] +jemalloc = [ + 'mimalloc-sys', + 'mimalloc-sys/override', + # 'mimalloc-sys/secure', #FIXME: disable secure build + 'mimalloc-sys/check_full' +] diff --git a/src/rustc/rustc.rs b/src/rustc/rustc.rs index 4a1786f89ed55..4084c8736d74e 100644 --- a/src/rustc/rustc.rs +++ b/src/rustc/rustc.rs @@ -1,34 +1,34 @@ fn main() { - // Pull in jemalloc when enabled. + // Pull in mimalloc when enabled. // - // Note that we're pulling in a static copy of jemalloc which means that to + // Note that we're pulling in a static copy of mimalloc which means that to // pull it in we need to actually reference its symbols for it to get // linked. The two crates we link to here, std and rustc_driver, are both - // dynamic libraries. That means to pull in jemalloc we need to actually + // dynamic libraries. That means to pull in mimalloc we need to actually // reference allocation symbols one way or another (as this file is the only // object code in the rustc executable). - #[cfg(feature = "jemalloc-sys")] + #[cfg(feature = "mimalloc-sys")] { use std::os::raw::{c_void, c_int}; #[used] static _F1: unsafe extern fn(usize, usize) -> *mut c_void = - jemalloc_sys::calloc; + mimalloc_sys::calloc; #[used] static _F2: unsafe extern fn(*mut *mut c_void, usize, usize) -> c_int = - jemalloc_sys::posix_memalign; + mimalloc_sys::posix_memalign; #[used] static _F3: unsafe extern fn(usize, usize) -> *mut c_void = - jemalloc_sys::aligned_alloc; + mimalloc_sys::aligned_alloc; #[used] static _F4: unsafe extern fn(usize) -> *mut c_void = - jemalloc_sys::malloc; + mimalloc_sys::malloc; #[used] static _F5: unsafe extern fn(*mut c_void, usize) -> *mut c_void = - jemalloc_sys::realloc; + mimalloc_sys::realloc; #[used] static _F6: unsafe extern fn(*mut c_void) = - jemalloc_sys::free; + mimalloc_sys::free; } rustc_driver::set_sigpipe_handler();