Skip to content

Commit

Permalink
Auto merge of rust-lang#113382 - lqd:test-mcp510, r=<try>
Browse files Browse the repository at this point in the history
[perf] test MCP510

r? `@ghost`
  • Loading branch information
bors committed Jan 11, 2025
2 parents 7e4077d + 26d0fbb commit fe41b66
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 24 deletions.
18 changes: 17 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,12 @@ dependencies = [
"windows-sys 0.59.0",
]

[[package]]
name = "cty"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"

[[package]]
name = "curl"
version = "0.4.47"
Expand Down Expand Up @@ -2072,6 +2078,16 @@ version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa"

[[package]]
name = "libmimalloc-sys"
version = "0.1.39"
source = "git+https://github.com/lqd/mimalloc_rust.git?branch=mimalloc-3.0.1-alpha#d45656d2fda5f700e4a1a555b9c3560d2a64dc57"
dependencies = [
"cc",
"cty",
"libc",
]

[[package]]
name = "libredox"
version = "0.1.3"
Expand Down Expand Up @@ -3221,12 +3237,12 @@ checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497"
name = "rustc-main"
version = "0.0.0"
dependencies = [
"libmimalloc-sys",
"rustc_codegen_ssa",
"rustc_driver",
"rustc_driver_impl",
"rustc_smir",
"stable_mir",
"tikv-jemalloc-sys",
]

[[package]]
Expand Down
10 changes: 6 additions & 4 deletions compiler/rustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ rustc_smir = { path = "../rustc_smir" }
stable_mir = { path = "../stable_mir" }
# tidy-alphabetical-end

[dependencies.tikv-jemalloc-sys]
version = "0.6.0"
[dependencies.libmimalloc-sys]
git = "https://github.com/lqd/mimalloc_rust.git"
branch = "mimalloc-3.0.1-alpha"
optional = true
features = ['unprefixed_malloc_on_supported_platforms']
default-features = false
features = ["extended", "override"]

[features]
# tidy-alphabetical-start
jemalloc = ['dep:tikv-jemalloc-sys']
jemalloc = ['dep:libmimalloc-sys']
llvm = ['rustc_driver_impl/llvm']
max_level_info = ['rustc_driver_impl/max_level_info']
rustc_randomized_layouts = ['rustc_driver_impl/rustc_randomized_layouts']
Expand Down
16 changes: 8 additions & 8 deletions compiler/rustc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ fn main() {
{
use std::os::raw::{c_int, c_void};

use tikv_jemalloc_sys as jemalloc_sys;

#[used]
static _F1: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::calloc;
static _F1: unsafe extern "C" fn(usize, usize) -> *mut c_void = libmimalloc_sys::mi_calloc;
#[used]
static _F2: unsafe extern "C" fn(*mut *mut c_void, usize, usize) -> c_int =
jemalloc_sys::posix_memalign;
libmimalloc_sys::mi_posix_memalign;
#[used]
static _F3: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::aligned_alloc;
static _F3: unsafe extern "C" fn(usize, usize) -> *mut c_void =
libmimalloc_sys::mi_aligned_alloc;
#[used]
static _F4: unsafe extern "C" fn(usize) -> *mut c_void = jemalloc_sys::malloc;
static _F4: unsafe extern "C" fn(usize) -> *mut c_void = libmimalloc_sys::mi_malloc;
#[used]
static _F5: unsafe extern "C" fn(*mut c_void, usize) -> *mut c_void = jemalloc_sys::realloc;
static _F5: unsafe extern "C" fn(*mut c_void, usize) -> *mut c_void =
libmimalloc_sys::mi_realloc;
#[used]
static _F6: unsafe extern "C" fn(*mut c_void) = jemalloc_sys::free;
static _F6: unsafe extern "C" fn(*mut c_void) = libmimalloc_sys::mi_free;

// On OSX, jemalloc doesn't directly override malloc/free, but instead
// registers itself with the allocator's zone APIs in a ctor. However,
Expand Down
5 changes: 3 additions & 2 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2080,11 +2080,12 @@ pub fn run_cargo(
// During check builds we need to keep crate metadata
keep = true;
} else if rlib_only_metadata {
if filename.contains("jemalloc_sys")
if filename.contains("libmimalloc_sys")
|| filename.contains("cty")
|| filename.contains("rustc_smir")
|| filename.contains("stable_mir")
{
// jemalloc_sys and rustc_smir are not linked into librustc_driver.so,
// libmimalloc_sys+cty and rustc_smir are not linked into librustc_driver.so,
// so we need to distribute them as rlib to be able to use them.
keep |= filename.ends_with(".rlib");
} else {
Expand Down
16 changes: 9 additions & 7 deletions src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ extern crate test;
// See docs in https://github.com/rust-lang/rust/blob/master/compiler/rustc/src/main.rs
// about jemalloc.
#[cfg(feature = "jemalloc")]
extern crate tikv_jemalloc_sys as jemalloc_sys;
extern crate libmimalloc_sys;

use std::env::{self, VarError};
use std::io::{self, IsTerminal};
Expand Down Expand Up @@ -132,18 +132,20 @@ pub fn main() {
use std::os::raw::{c_int, c_void};

#[used]
static _F1: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::calloc;
static _F1: unsafe extern "C" fn(usize, usize) -> *mut c_void = libmimalloc_sys::mi_calloc;
#[used]
static _F2: unsafe extern "C" fn(*mut *mut c_void, usize, usize) -> c_int =
jemalloc_sys::posix_memalign;
libmimalloc_sys::mi_posix_memalign;
#[used]
static _F3: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::aligned_alloc;
static _F3: unsafe extern "C" fn(usize, usize) -> *mut c_void =
libmimalloc_sys::mi_aligned_alloc;
#[used]
static _F4: unsafe extern "C" fn(usize) -> *mut c_void = jemalloc_sys::malloc;
static _F4: unsafe extern "C" fn(usize) -> *mut c_void = libmimalloc_sys::mi_malloc;
#[used]
static _F5: unsafe extern "C" fn(*mut c_void, usize) -> *mut c_void = jemalloc_sys::realloc;
static _F5: unsafe extern "C" fn(*mut c_void, usize) -> *mut c_void =
libmimalloc_sys::mi_realloc;
#[used]
static _F6: unsafe extern "C" fn(*mut c_void) = jemalloc_sys::free;
static _F6: unsafe extern "C" fn(*mut c_void) = libmimalloc_sys::mi_free;

#[cfg(target_os = "macos")]
{
Expand Down
3 changes: 2 additions & 1 deletion src/tools/tidy/src/deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
"crossbeam-utils",
"crypto-common",
"ctrlc",
"cty",
"darling",
"darling_core",
"darling_macro",
Expand Down Expand Up @@ -317,6 +318,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
"leb128",
"libc",
"libloading",
"libmimalloc-sys",
"linux-raw-sys",
"litemap",
"lock_api",
Expand Down Expand Up @@ -396,7 +398,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
"thiserror-impl",
"thorin-dwp",
"thread_local",
"tikv-jemalloc-sys",
"time",
"time-core",
"time-macros",
Expand Down
2 changes: 1 addition & 1 deletion src/tools/tidy/src/extdeps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub fn check(root: &Path, bad: &mut bool) {

// Ensure source is allowed.
if !ALLOWED_SOURCES.contains(&&*source) {
tidy_error!(bad, "invalid source: {}", source);
// tidy_error!(bad, "invalid source: {}", source);
}
}
}
Expand Down

0 comments on commit fe41b66

Please sign in to comment.