Skip to content

Commit 61e8944

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 d0c869c commit 61e8944

32 files changed

+9
-446
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
@@ -300,12 +300,6 @@
300300
# Adding debuginfo makes them several times larger.
301301
#debuginfo-tools = false
302302

303-
# Whether or not jemalloc is built and enabled
304-
#use-jemalloc = true
305-
306-
# Whether or not jemalloc is built with its debug option set
307-
#debug-jemalloc = false
308-
309303
# Whether or not `panic!`s generate backtraces (RUST_BACKTRACE)
310304
#backtrace = true
311305

@@ -441,10 +435,6 @@
441435
# not, you can specify an explicit file name for it.
442436
#llvm-filecheck = "/path/to/FileCheck"
443437

444-
# Path to the custom jemalloc static library to link into the standard library
445-
# by default. This is only used if jemalloc is still enabled above
446-
#jemalloc = "/path/to/jemalloc/libjemalloc_pic.a"
447-
448438
# If this target is for Android, this option will be required to specify where
449439
# the NDK for the target lives. This is used to find the C compiler to link and
450440
# build native code.

src/bootstrap/bootstrap.py

-5
Original file line numberDiff line numberDiff line change
@@ -715,11 +715,6 @@ def update_submodules(self):
715715
backends = self.get_toml('codegen-backends')
716716
if backends is None or not 'emscripten' in backends:
717717
continue
718-
if module.endswith("jemalloc"):
719-
if self.get_toml('use-jemalloc') == 'false':
720-
continue
721-
if self.get_toml('jemalloc'):
722-
continue
723718
if module.endswith("lld"):
724719
config = self.get_toml('lld')
725720
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
@@ -123,8 +123,6 @@ pub struct Config {
123123
pub dist_gpg_password_file: Option<PathBuf>,
124124

125125
// libstd features
126-
pub debug_jemalloc: bool,
127-
pub use_jemalloc: bool,
128126
pub backtrace: bool, // support for RUST_BACKTRACE
129127
pub wasm_syscall: bool,
130128

@@ -166,7 +164,6 @@ pub struct Target {
166164
pub llvm_config: Option<PathBuf>,
167165
/// Some(path to FileCheck) if one was specified.
168166
pub llvm_filecheck: Option<PathBuf>,
169-
pub jemalloc: Option<PathBuf>,
170167
pub cc: Option<PathBuf>,
171168
pub cxx: Option<PathBuf>,
172169
pub ar: Option<PathBuf>,
@@ -302,8 +299,6 @@ struct Rust {
302299
debuginfo_only_std: Option<bool>,
303300
debuginfo_tools: Option<bool>,
304301
experimental_parallel_queries: Option<bool>,
305-
debug_jemalloc: Option<bool>,
306-
use_jemalloc: Option<bool>,
307302
backtrace: Option<bool>,
308303
default_linker: Option<String>,
309304
channel: Option<String>,
@@ -337,7 +332,6 @@ struct Rust {
337332
struct TomlTarget {
338333
llvm_config: Option<String>,
339334
llvm_filecheck: Option<String>,
340-
jemalloc: Option<String>,
341335
cc: Option<String>,
342336
cxx: Option<String>,
343337
ar: Option<String>,
@@ -363,7 +357,6 @@ impl Config {
363357
config.llvm_enabled = true;
364358
config.llvm_optimize = true;
365359
config.llvm_version_check = true;
366-
config.use_jemalloc = true;
367360
config.backtrace = true;
368361
config.rust_optimize = true;
369362
config.rust_optimize_tests = true;
@@ -499,7 +492,6 @@ impl Config {
499492
let mut debuginfo_only_std = None;
500493
let mut debuginfo_tools = None;
501494
let mut debug = None;
502-
let mut debug_jemalloc = None;
503495
let mut debuginfo = None;
504496
let mut debug_assertions = None;
505497
let mut optimize = None;
@@ -541,12 +533,10 @@ impl Config {
541533
debuginfo_tools = rust.debuginfo_tools;
542534
optimize = rust.optimize;
543535
ignore_git = rust.ignore_git;
544-
debug_jemalloc = rust.debug_jemalloc;
545536
set(&mut config.rust_optimize_tests, rust.optimize_tests);
546537
set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
547538
set(&mut config.codegen_tests, rust.codegen_tests);
548539
set(&mut config.rust_rpath, rust.rpath);
549-
set(&mut config.use_jemalloc, rust.use_jemalloc);
550540
set(&mut config.backtrace, rust.backtrace);
551541
set(&mut config.channel, rust.channel.clone());
552542
set(&mut config.rust_dist_src, rust.dist_src);
@@ -596,9 +586,6 @@ impl Config {
596586
if let Some(ref s) = cfg.llvm_filecheck {
597587
target.llvm_filecheck = Some(config.src.join(s));
598588
}
599-
if let Some(ref s) = cfg.jemalloc {
600-
target.jemalloc = Some(config.src.join(s));
601-
}
602589
if let Some(ref s) = cfg.android_ndk {
603590
target.ndk = Some(config.src.join(s));
604591
}
@@ -644,7 +631,6 @@ impl Config {
644631
config.rust_debuginfo_tools = debuginfo_tools.unwrap_or(false);
645632

646633
let default = debug == Some(true);
647-
config.debug_jemalloc = debug_jemalloc.unwrap_or(default);
648634
config.rust_debuginfo = debuginfo.unwrap_or(default);
649635
config.rust_debug_assertions = debug_assertions.unwrap_or(default);
650636

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,14 +877,12 @@ 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
"src/libproc_macro",
885883
];
886884
let std_src_dirs_exclude = [
887885
"src/libcompiler_builtins/compiler-rt/test",
888-
"src/jemalloc/test/unit",
889886
];
890887

891888
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
@@ -1504,8 +1504,7 @@ impl Step for CrateNotDefault {
15041504
type Output = ();
15051505

15061506
fn should_run(run: ShouldRun) -> ShouldRun {
1507-
run.path("src/liballoc_jemalloc")
1508-
.path("src/librustc_asan")
1507+
run.path("src/librustc_asan")
15091508
.path("src/librustc_lsan")
15101509
.path("src/librustc_msan")
15111510
.path("src/librustc_tsan")
@@ -1522,7 +1521,6 @@ impl Step for CrateNotDefault {
15221521
target: run.target,
15231522
test_kind,
15241523
krate: match run.path {
1525-
_ if run.path.ends_with("src/liballoc_jemalloc") => "alloc_jemalloc",
15261524
_ if run.path.ends_with("src/librustc_asan") => "rustc_asan",
15271525
_ if run.path.ends_with("src/librustc_lsan") => "rustc_lsan",
15281526
_ if run.path.ends_with("src/librustc_msan") => "rustc_msan",
@@ -1561,7 +1559,6 @@ impl Step for Crate {
15611559
run = run.krate("test");
15621560
for krate in run.builder.in_tree_crates("std") {
15631561
if krate.is_local(&run.builder)
1564-
&& !krate.name.contains("jemalloc")
15651562
&& !(krate.name.starts_with("rustc_") && krate.name.ends_with("san"))
15661563
&& krate.name != "dlmalloc"
15671564
{

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)