Skip to content

Commit bcae55d

Browse files
committed
WIP
1 parent 319f529 commit bcae55d

File tree

4 files changed

+41
-20
lines changed

4 files changed

+41
-20
lines changed

Cargo.lock

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,12 @@ dependencies = [
848848
"windows-sys 0.59.0",
849849
]
850850

851+
[[package]]
852+
name = "cty"
853+
version = "0.2.2"
854+
source = "registry+https://github.com/rust-lang/crates.io-index"
855+
checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
856+
851857
[[package]]
852858
name = "curl"
853859
version = "0.4.47"
@@ -2075,6 +2081,17 @@ version = "0.2.11"
20752081
source = "registry+https://github.com/rust-lang/crates.io-index"
20762082
checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa"
20772083

2084+
[[package]]
2085+
name = "libmimalloc-sys"
2086+
version = "0.1.39"
2087+
source = "registry+https://github.com/rust-lang/crates.io-index"
2088+
checksum = "23aa6811d3bd4deb8a84dde645f943476d13b248d818edcf8ce0b2f37f036b44"
2089+
dependencies = [
2090+
"cc",
2091+
"cty",
2092+
"libc",
2093+
]
2094+
20782095
[[package]]
20792096
name = "libredox"
20802097
version = "0.1.3"
@@ -3224,12 +3241,12 @@ checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497"
32243241
name = "rustc-main"
32253242
version = "0.0.0"
32263243
dependencies = [
3244+
"libmimalloc-sys",
32273245
"rustc_codegen_ssa",
32283246
"rustc_driver",
32293247
"rustc_driver_impl",
32303248
"rustc_smir",
32313249
"stable_mir",
3232-
"tikv-jemalloc-sys",
32333250
]
32343251

32353252
[[package]]

compiler/rustc/Cargo.toml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,20 @@ rustc_smir = { path = "../rustc_smir" }
2020
stable_mir = { path = "../stable_mir" }
2121
# tidy-alphabetical-end
2222

23-
[dependencies.tikv-jemalloc-sys]
24-
version = "0.6.0"
23+
#[dependencies.tikv-jemalloc-sys]
24+
#version = "0.6.0"
25+
#optional = true
26+
#features = ['unprefixed_malloc_on_supported_platforms']
27+
28+
[dependencies.libmimalloc-sys]
29+
version = "0.1.39"
2530
optional = true
26-
features = ['unprefixed_malloc_on_supported_platforms']
31+
default-features = false
32+
features = ["extended", "override"]
2733

2834
[features]
2935
# tidy-alphabetical-start
30-
jemalloc = ['dep:tikv-jemalloc-sys']
36+
jemalloc = ['dep:libmimalloc-sys']
3137
llvm = ['rustc_driver_impl/llvm']
3238
max_level_info = ['rustc_driver_impl/max_level_info']
3339
rustc_randomized_layouts = ['rustc_driver_impl/rustc_randomized_layouts']

compiler/rustc/src/main.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,19 @@ fn main() {
4343
{
4444
use std::os::raw::{c_int, c_void};
4545

46-
use tikv_jemalloc_sys as jemalloc_sys;
47-
4846
#[used]
49-
static _F1: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::calloc;
47+
static _F1: unsafe extern "C" fn(usize, usize) -> *mut c_void = libmimalloc_sys::mi_calloc;
5048
#[used]
5149
static _F2: unsafe extern "C" fn(*mut *mut c_void, usize, usize) -> c_int =
52-
jemalloc_sys::posix_memalign;
50+
libmimalloc_sys::mi_posix_memalign;
5351
#[used]
54-
static _F3: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::aligned_alloc;
52+
static _F3: unsafe extern "C" fn(usize, usize) -> *mut c_void = libmimalloc_sys::mi_aligned_alloc;
5553
#[used]
56-
static _F4: unsafe extern "C" fn(usize) -> *mut c_void = jemalloc_sys::malloc;
54+
static _F4: unsafe extern "C" fn(usize) -> *mut c_void = libmimalloc_sys::mi_malloc;
5755
#[used]
58-
static _F5: unsafe extern "C" fn(*mut c_void, usize) -> *mut c_void = jemalloc_sys::realloc;
56+
static _F5: unsafe extern "C" fn(*mut c_void, usize) -> *mut c_void = libmimalloc_sys::mi_realloc;
5957
#[used]
60-
static _F6: unsafe extern "C" fn(*mut c_void) = jemalloc_sys::free;
58+
static _F6: unsafe extern "C" fn(*mut c_void) = libmimalloc_sys::mi_free;
6159

6260
// On OSX, jemalloc doesn't directly override malloc/free, but instead
6361
// registers itself with the allocator's zone APIs in a ctor. However,

src/librustdoc/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ extern crate test;
6868
// See docs in https://github.com/rust-lang/rust/blob/master/compiler/rustc/src/main.rs
6969
// about jemalloc.
7070
#[cfg(feature = "jemalloc")]
71-
extern crate tikv_jemalloc_sys as jemalloc_sys;
71+
extern crate libmimalloc_sys;
7272

7373
use std::env::{self, VarError};
7474
use std::io::{self, IsTerminal};
@@ -132,18 +132,18 @@ pub fn main() {
132132
use std::os::raw::{c_int, c_void};
133133

134134
#[used]
135-
static _F1: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::calloc;
135+
static _F1: unsafe extern "C" fn(usize, usize) -> *mut c_void = libmimalloc_sys::mi_calloc;
136136
#[used]
137137
static _F2: unsafe extern "C" fn(*mut *mut c_void, usize, usize) -> c_int =
138-
jemalloc_sys::posix_memalign;
138+
libmimalloc_sys::mi_posix_memalign;
139139
#[used]
140-
static _F3: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::aligned_alloc;
140+
static _F3: unsafe extern "C" fn(usize, usize) -> *mut c_void = libmimalloc_sys::mi_aligned_alloc;
141141
#[used]
142-
static _F4: unsafe extern "C" fn(usize) -> *mut c_void = jemalloc_sys::malloc;
142+
static _F4: unsafe extern "C" fn(usize) -> *mut c_void = libmimalloc_sys::mi_malloc;
143143
#[used]
144-
static _F5: unsafe extern "C" fn(*mut c_void, usize) -> *mut c_void = jemalloc_sys::realloc;
144+
static _F5: unsafe extern "C" fn(*mut c_void, usize) -> *mut c_void = libmimalloc_sys::mi_realloc;
145145
#[used]
146-
static _F6: unsafe extern "C" fn(*mut c_void) = jemalloc_sys::free;
146+
static _F6: unsafe extern "C" fn(*mut c_void) = libmimalloc_sys::mi_free;
147147

148148
#[cfg(target_os = "macos")]
149149
{

0 commit comments

Comments
 (0)