Skip to content

Commit 9696882

Browse files
committed
Remove all jemalloc-related content
This commit removes all jemalloc related submodules, configuration, etc, from the bootstrap, from the standard library, and from the compiler. This will be followed up with a change to use jemalloc specifically as part of rustc on blessed platforms.
1 parent 554b787 commit 9696882

33 files changed

+9
-458
lines changed

.gitmodules

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
path = src/llvm
33
url = https://github.com/rust-lang/llvm.git
44
branch = master
5-
[submodule "src/jemalloc"]
6-
path = src/jemalloc
7-
url = https://github.com/rust-lang/jemalloc.git
85
[submodule "src/rust-installer"]
96
path = src/tools/rust-installer
107
url = https://github.com/rust-lang/rust-installer.git
@@ -64,4 +61,4 @@
6461
path = src/tools/clang
6562
url = https://github.com/rust-lang-nursery/clang.git
6663
branch = rust-release-80-v1
67-
64+

config.toml.example

-10
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,6 @@
296296
# Adding debuginfo makes them several times larger.
297297
#debuginfo-tools = false
298298

299-
# Whether or not jemalloc is built and enabled
300-
#use-jemalloc = true
301-
302-
# Whether or not jemalloc is built with its debug option set
303-
#debug-jemalloc = false
304-
305299
# Whether or not `panic!`s generate backtraces (RUST_BACKTRACE)
306300
#backtrace = true
307301

@@ -437,10 +431,6 @@
437431
# not, you can specify an explicit file name for it.
438432
#llvm-filecheck = "/path/to/FileCheck"
439433

440-
# Path to the custom jemalloc static library to link into the standard library
441-
# by default. This is only used if jemalloc is still enabled above
442-
#jemalloc = "/path/to/jemalloc/libjemalloc_pic.a"
443-
444434
# If this target is for Android, this option will be required to specify where
445435
# the NDK for the target lives. This is used to find the C compiler to link and
446436
# build native code.

src/Cargo.lock

-12
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,6 @@ dependencies = [
1515
"rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
1616
]
1717

18-
[[package]]
19-
name = "alloc_jemalloc"
20-
version = "0.0.0"
21-
dependencies = [
22-
"build_helper 0.1.0",
23-
"cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
24-
"compiler_builtins 0.0.0",
25-
"core 0.0.0",
26-
"libc 0.0.0",
27-
]
28-
2918
[[package]]
3019
name = "alloc_system"
3120
version = "0.0.0"
@@ -2678,7 +2667,6 @@ name = "std"
26782667
version = "0.0.0"
26792668
dependencies = [
26802669
"alloc 0.0.0",
2681-
"alloc_jemalloc 0.0.0",
26822670
"alloc_system 0.0.0",
26832671
"build_helper 0.1.0",
26842672
"cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",

src/bootstrap/bootstrap.py

-5
Original file line numberDiff line numberDiff line change
@@ -712,11 +712,6 @@ def update_submodules(self):
712712
backends = self.get_toml('codegen-backends')
713713
if backends is None or not 'emscripten' in backends:
714714
continue
715-
if module.endswith("jemalloc"):
716-
if self.get_toml('use-jemalloc') == 'false':
717-
continue
718-
if self.get_toml('jemalloc'):
719-
continue
720715
if module.endswith("lld"):
721716
config = self.get_toml('lld')
722717
if config is None or config == 'false':

src/bootstrap/compile.rs

+1-15
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,7 @@ pub fn std_cargo(builder: &Builder,
158158
.arg("--manifest-path")
159159
.arg(builder.src.join("src/rustc/compiler_builtins_shim/Cargo.toml"));
160160
} else {
161-
let mut features = builder.std_features();
162-
163-
// When doing a local rebuild we tell cargo that we're stage1 rather than
164-
// stage0. This works fine if the local rust and being-built rust have the
165-
// same view of what the default allocator is, but fails otherwise. Since
166-
// we don't have a way to express an allocator preference yet, work
167-
// around the issue in the case of a local rebuild with jemalloc disabled.
168-
if compiler.stage == 0 && builder.local_rebuild && !builder.config.use_jemalloc {
169-
features.push_str(" force_alloc_system");
170-
}
161+
let features = builder.std_features();
171162

172163
if compiler.stage != 0 && builder.config.sanitizers {
173164
// This variable is used by the sanitizer runtime crates, e.g.
@@ -188,11 +179,6 @@ pub fn std_cargo(builder: &Builder,
188179
.arg("--manifest-path")
189180
.arg(builder.src.join("src/libstd/Cargo.toml"));
190181

191-
if let Some(target) = builder.config.target_config.get(&target) {
192-
if let Some(ref jemalloc) = target.jemalloc {
193-
cargo.env("JEMALLOC_OVERRIDE", jemalloc);
194-
}
195-
}
196182
if target.contains("musl") {
197183
if let Some(p) = builder.musl_root(target) {
198184
cargo.env("MUSL_ROOT", p);

src/bootstrap/config.rs

-14
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ pub struct Config {
122122
pub dist_gpg_password_file: Option<PathBuf>,
123123

124124
// libstd features
125-
pub debug_jemalloc: bool,
126-
pub use_jemalloc: bool,
127125
pub backtrace: bool, // support for RUST_BACKTRACE
128126
pub wasm_syscall: bool,
129127

@@ -165,7 +163,6 @@ pub struct Target {
165163
pub llvm_config: Option<PathBuf>,
166164
/// Some(path to FileCheck) if one was specified.
167165
pub llvm_filecheck: Option<PathBuf>,
168-
pub jemalloc: Option<PathBuf>,
169166
pub cc: Option<PathBuf>,
170167
pub cxx: Option<PathBuf>,
171168
pub ar: Option<PathBuf>,
@@ -300,8 +297,6 @@ struct Rust {
300297
debuginfo_only_std: Option<bool>,
301298
debuginfo_tools: Option<bool>,
302299
experimental_parallel_queries: Option<bool>,
303-
debug_jemalloc: Option<bool>,
304-
use_jemalloc: Option<bool>,
305300
backtrace: Option<bool>,
306301
default_linker: Option<String>,
307302
channel: Option<String>,
@@ -335,7 +330,6 @@ struct Rust {
335330
struct TomlTarget {
336331
llvm_config: Option<String>,
337332
llvm_filecheck: Option<String>,
338-
jemalloc: Option<String>,
339333
cc: Option<String>,
340334
cxx: Option<String>,
341335
ar: Option<String>,
@@ -361,7 +355,6 @@ impl Config {
361355
config.llvm_enabled = true;
362356
config.llvm_optimize = true;
363357
config.llvm_version_check = true;
364-
config.use_jemalloc = true;
365358
config.backtrace = true;
366359
config.rust_optimize = true;
367360
config.rust_optimize_tests = true;
@@ -497,7 +490,6 @@ impl Config {
497490
let mut debuginfo_only_std = None;
498491
let mut debuginfo_tools = None;
499492
let mut debug = None;
500-
let mut debug_jemalloc = None;
501493
let mut debuginfo = None;
502494
let mut debug_assertions = None;
503495
let mut optimize = None;
@@ -539,12 +531,10 @@ impl Config {
539531
debuginfo_tools = rust.debuginfo_tools;
540532
optimize = rust.optimize;
541533
ignore_git = rust.ignore_git;
542-
debug_jemalloc = rust.debug_jemalloc;
543534
set(&mut config.rust_optimize_tests, rust.optimize_tests);
544535
set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
545536
set(&mut config.codegen_tests, rust.codegen_tests);
546537
set(&mut config.rust_rpath, rust.rpath);
547-
set(&mut config.use_jemalloc, rust.use_jemalloc);
548538
set(&mut config.backtrace, rust.backtrace);
549539
set(&mut config.channel, rust.channel.clone());
550540
set(&mut config.rust_dist_src, rust.dist_src);
@@ -592,9 +582,6 @@ impl Config {
592582
if let Some(ref s) = cfg.llvm_filecheck {
593583
target.llvm_filecheck = Some(config.src.join(s));
594584
}
595-
if let Some(ref s) = cfg.jemalloc {
596-
target.jemalloc = Some(config.src.join(s));
597-
}
598585
if let Some(ref s) = cfg.android_ndk {
599586
target.ndk = Some(config.src.join(s));
600587
}
@@ -640,7 +627,6 @@ impl Config {
640627
config.rust_debuginfo_tools = debuginfo_tools.unwrap_or(false);
641628

642629
let default = debug == Some(true);
643-
config.debug_jemalloc = debug_jemalloc.unwrap_or(default);
644630
config.rust_debuginfo = debuginfo.unwrap_or(default);
645631
config.rust_debug_assertions = debug_assertions.unwrap_or(default);
646632

src/bootstrap/configure.py

-5
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ def v(*args):
8282
o("debuginfo-lines", "rust.debuginfo-lines", "build with line number debugger metadata")
8383
o("debuginfo-only-std", "rust.debuginfo-only-std", "build only libstd with debugging information")
8484
o("debuginfo-tools", "rust.debuginfo-tools", "build extended tools with debugging information")
85-
o("debug-jemalloc", "rust.debug-jemalloc", "build jemalloc with --enable-debug --enable-fill")
8685
v("save-toolstates", "rust.save-toolstates", "save build and test status of external tools into this file")
8786

8887
v("prefix", "install.prefix", "set installation prefix")
@@ -99,7 +98,6 @@ def v(*args):
9998
v("llvm-config", None, "set path to llvm-config")
10099
v("llvm-filecheck", None, "set path to LLVM's FileCheck utility")
101100
v("python", "build.python", "set path to python")
102-
v("jemalloc-root", None, "set directory where libjemalloc_pic.a is located")
103101
v("android-cross-path", "target.arm-linux-androideabi.android-ndk",
104102
"Android NDK standalone path (deprecated)")
105103
v("i686-linux-android-ndk", "target.i686-linux-android.android-ndk",
@@ -148,7 +146,6 @@ def v(*args):
148146
# Many of these are saved below during the "writing configuration" step
149147
# (others are conditionally saved).
150148
o("manage-submodules", "build.submodules", "let the build manage the git submodules")
151-
o("jemalloc", "rust.use-jemalloc", "build liballoc with jemalloc")
152149
o("full-bootstrap", "build.full-bootstrap", "build three compilers instead of two")
153150
o("extended", "build.extended", "build an extended rust tool set")
154151

@@ -330,8 +327,6 @@ def set(key, value):
330327
set('target.{}.llvm-config'.format(build()), value)
331328
elif option.name == 'llvm-filecheck':
332329
set('target.{}.llvm-filecheck'.format(build()), value)
333-
elif option.name == 'jemalloc-root':
334-
set('target.{}.jemalloc'.format(build()), value + '/libjemalloc_pic.a')
335330
elif option.name == 'tools':
336331
set('build.tools', value.split(','))
337332
elif option.name == 'host':

src/bootstrap/dist.rs

-3
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,6 @@ impl Step for Src {
859859
"src/build_helper",
860860
"src/dlmalloc",
861861
"src/liballoc",
862-
"src/liballoc_jemalloc",
863862
"src/liballoc_system",
864863
"src/libbacktrace",
865864
"src/libcompiler_builtins",
@@ -878,13 +877,11 @@ impl Step for Src {
878877
"src/rustc/dlmalloc_shim",
879878
"src/libtest",
880879
"src/libterm",
881-
"src/jemalloc",
882880
"src/libprofiler_builtins",
883881
"src/stdsimd",
884882
];
885883
let std_src_dirs_exclude = [
886884
"src/libcompiler_builtins/compiler-rt/test",
887-
"src/jemalloc/test/unit",
888885
];
889886

890887
copy_src_dirs(builder, &std_src_dirs[..], &std_src_dirs_exclude[..], &dst_src);

src/bootstrap/lib.rs

+2-12
Original file line numberDiff line numberDiff line change
@@ -516,12 +516,6 @@ impl Build {
516516
fn std_features(&self) -> String {
517517
let mut features = "panic-unwind".to_string();
518518

519-
if self.config.debug_jemalloc {
520-
features.push_str(" debug-jemalloc");
521-
}
522-
if self.config.use_jemalloc {
523-
features.push_str(" jemalloc");
524-
}
525519
if self.config.backtrace {
526520
features.push_str(" backtrace");
527521
}
@@ -536,11 +530,7 @@ impl Build {
536530

537531
/// Get the space-separated set of activated features for the compiler.
538532
fn rustc_features(&self) -> String {
539-
let mut features = String::new();
540-
if self.config.use_jemalloc {
541-
features.push_str(" jemalloc");
542-
}
543-
features
533+
String::new()
544534
}
545535

546536
/// Component directory that Cargo will produce output into (e.g.
@@ -791,7 +781,7 @@ impl Build {
791781
// If we're compiling on macOS then we add a few unconditional flags
792782
// indicating that we want libc++ (more filled out than libstdc++) and
793783
// we want to compile for 10.7. This way we can ensure that
794-
// LLVM/jemalloc/etc are all properly compiled.
784+
// LLVM/etc are all properly compiled.
795785
if target.contains("apple-darwin") {
796786
base.push("-stdlib=libc++".into());
797787
}

src/bootstrap/sanity.rs

-6
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,6 @@ pub fn check(build: &mut Build) {
152152
if !build.config.dry_run {
153153
cmd_finder.must_have(build.cxx(*host).unwrap());
154154
}
155-
156-
// The msvc hosts don't use jemalloc, turn it off globally to
157-
// avoid packaging the dummy liballoc_jemalloc on that platform.
158-
if host.contains("msvc") {
159-
build.config.use_jemalloc = false;
160-
}
161155
}
162156

163157
// Externally configured LLVM requires FileCheck to exist

src/bootstrap/test.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1510,8 +1510,7 @@ impl Step for CrateNotDefault {
15101510
type Output = ();
15111511

15121512
fn should_run(run: ShouldRun) -> ShouldRun {
1513-
run.path("src/liballoc_jemalloc")
1514-
.path("src/librustc_asan")
1513+
run.path("src/librustc_asan")
15151514
.path("src/librustc_lsan")
15161515
.path("src/librustc_msan")
15171516
.path("src/librustc_tsan")
@@ -1528,7 +1527,6 @@ impl Step for CrateNotDefault {
15281527
target: run.target,
15291528
test_kind,
15301529
krate: match run.path {
1531-
_ if run.path.ends_with("src/liballoc_jemalloc") => "alloc_jemalloc",
15321530
_ if run.path.ends_with("src/librustc_asan") => "rustc_asan",
15331531
_ if run.path.ends_with("src/librustc_lsan") => "rustc_lsan",
15341532
_ if run.path.ends_with("src/librustc_msan") => "rustc_msan",
@@ -1567,7 +1565,6 @@ impl Step for Crate {
15671565
run = run.krate("test");
15681566
for krate in run.builder.in_tree_crates("std") {
15691567
if krate.is_local(&run.builder)
1570-
&& !krate.name.contains("jemalloc")
15711568
&& !(krate.name.starts_with("rustc_") && krate.name.ends_with("san"))
15721569
&& krate.name != "dlmalloc"
15731570
{

src/jemalloc

-1
This file was deleted.

src/liballoc/tests/heap.rs

-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ use alloc_system::System;
1212
use std::alloc::{Global, Alloc, Layout};
1313

1414
/// https://github.com/rust-lang/rust/issues/45955
15-
///
16-
/// Note that `#[global_allocator]` is not used,
17-
/// so `liballoc_jemalloc` is linked (on some platforms).
1815
#[test]
1916
fn alloc_system_overaligned_request() {
2017
check_overalign_requests(System)

src/liballoc_jemalloc/Cargo.toml

-24
This file was deleted.

0 commit comments

Comments
 (0)