Skip to content

Commit bee536e

Browse files
committed
Remove remaining alloc_jemalloc-related code
1 parent 116e2df commit bee536e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+20
-244
lines changed

COPYRIGHT

-32
Original file line numberDiff line numberDiff line change
@@ -229,35 +229,3 @@ their own copyright notices and license terms:
229229
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
230230
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
231231
OF SUCH DAMAGE. */
232-
233-
* jemalloc, under src/jemalloc:
234-
235-
Copyright (C) 2002-2014 Jason Evans
236-
<[email protected]>. All rights reserved.
237-
Copyright (C) 2007-2012 Mozilla Foundation.
238-
All rights reserved.
239-
Copyright (C) 2009-2014 Facebook, Inc.
240-
All rights reserved.
241-
242-
Redistribution and use in source and binary forms, with or without
243-
modification, are permitted provided that the following conditions are met:
244-
1. Redistributions of source code must retain the above copyright notice(s),
245-
this list of conditions and the following disclaimer.
246-
2. Redistributions in binary form must reproduce the above copyright notice(s),
247-
this list of conditions and the following disclaimer in the documentation
248-
and/or other materials provided with the distribution.
249-
250-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S)
251-
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
252-
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
253-
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
254-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S)
255-
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
256-
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
257-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
258-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
259-
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
260-
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
261-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
262-
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
263-
OF SUCH DAMAGE.

config.toml.example

-10
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,6 @@
270270
# Adding debuginfo makes them several times larger.
271271
#debuginfo-tools = false
272272

273-
# Whether or not jemalloc is built and enabled
274-
#use-jemalloc = true
275-
276-
# Whether or not jemalloc is built with its debug option set
277-
#debug-jemalloc = false
278-
279273
# Whether or not `panic!`s generate backtraces (RUST_BACKTRACE)
280274
#backtrace = true
281275

@@ -391,10 +385,6 @@
391385
# target.
392386
#llvm-config = "../path/to/llvm/root/bin/llvm-config"
393387

394-
# Path to the custom jemalloc static library to link into the standard library
395-
# by default. This is only used if jemalloc is still enabled above
396-
#jemalloc = "/path/to/jemalloc/libjemalloc_pic.a"
397-
398388
# If this target is for Android, this option will be required to specify where
399389
# the NDK for the target lives. This is used to find the C compiler to link and
400390
# build native code.

src/bootstrap/bootstrap.py

-5
Original file line numberDiff line numberDiff line change
@@ -696,11 +696,6 @@ def update_submodules(self):
696696
backends = self.get_toml('codegen-backends')
697697
if backends is None or not 'emscripten' in backends:
698698
continue
699-
if module.endswith("jemalloc"):
700-
if self.get_toml('use-jemalloc') == 'false':
701-
continue
702-
if self.get_toml('jemalloc'):
703-
continue
704699
if module.endswith("lld"):
705700
config = self.get_toml('lld')
706701
if config is None or config == 'false':

src/bootstrap/compile.rs

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

166157
if compiler.stage != 0 && builder.config.sanitizers {
167158
// This variable is used by the sanitizer runtime crates, e.g.
@@ -182,11 +173,6 @@ pub fn std_cargo(builder: &Builder,
182173
.arg("--manifest-path")
183174
.arg(builder.src.join("src/libstd/Cargo.toml"));
184175

185-
if let Some(target) = builder.config.target_config.get(&target) {
186-
if let Some(ref jemalloc) = target.jemalloc {
187-
cargo.env("JEMALLOC_OVERRIDE", jemalloc);
188-
}
189-
}
190176
if target.contains("musl") {
191177
if let Some(p) = builder.musl_root(target) {
192178
cargo.env("MUSL_ROOT", p);

src/bootstrap/config.rs

-14
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ pub struct Config {
118118
pub dist_gpg_password_file: Option<PathBuf>,
119119

120120
// libstd features
121-
pub debug_jemalloc: bool,
122-
pub use_jemalloc: bool,
123121
pub backtrace: bool, // support for RUST_BACKTRACE
124122
pub wasm_syscall: bool,
125123

@@ -158,7 +156,6 @@ pub struct Config {
158156
pub struct Target {
159157
/// Some(path to llvm-config) if using an external LLVM.
160158
pub llvm_config: Option<PathBuf>,
161-
pub jemalloc: Option<PathBuf>,
162159
pub cc: Option<PathBuf>,
163160
pub cxx: Option<PathBuf>,
164161
pub ar: Option<PathBuf>,
@@ -289,8 +286,6 @@ struct Rust {
289286
debuginfo_only_std: Option<bool>,
290287
debuginfo_tools: Option<bool>,
291288
experimental_parallel_queries: Option<bool>,
292-
debug_jemalloc: Option<bool>,
293-
use_jemalloc: Option<bool>,
294289
backtrace: Option<bool>,
295290
default_linker: Option<String>,
296291
channel: Option<String>,
@@ -320,7 +315,6 @@ struct Rust {
320315
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
321316
struct TomlTarget {
322317
llvm_config: Option<String>,
323-
jemalloc: Option<String>,
324318
cc: Option<String>,
325319
cxx: Option<String>,
326320
ar: Option<String>,
@@ -345,7 +339,6 @@ impl Config {
345339
config.llvm_enabled = true;
346340
config.llvm_optimize = true;
347341
config.llvm_version_check = true;
348-
config.use_jemalloc = true;
349342
config.backtrace = true;
350343
config.rust_optimize = true;
351344
config.rust_optimize_tests = true;
@@ -481,7 +474,6 @@ impl Config {
481474
let mut debuginfo_only_std = None;
482475
let mut debuginfo_tools = None;
483476
let mut debug = None;
484-
let mut debug_jemalloc = None;
485477
let mut debuginfo = None;
486478
let mut debug_assertions = None;
487479
let mut optimize = None;
@@ -521,12 +513,10 @@ impl Config {
521513
debuginfo_tools = rust.debuginfo_tools;
522514
optimize = rust.optimize;
523515
ignore_git = rust.ignore_git;
524-
debug_jemalloc = rust.debug_jemalloc;
525516
set(&mut config.rust_optimize_tests, rust.optimize_tests);
526517
set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
527518
set(&mut config.codegen_tests, rust.codegen_tests);
528519
set(&mut config.rust_rpath, rust.rpath);
529-
set(&mut config.use_jemalloc, rust.use_jemalloc);
530520
set(&mut config.backtrace, rust.backtrace);
531521
set(&mut config.channel, rust.channel.clone());
532522
set(&mut config.rust_dist_src, rust.dist_src);
@@ -568,9 +558,6 @@ impl Config {
568558
if let Some(ref s) = cfg.llvm_config {
569559
target.llvm_config = Some(config.src.join(s));
570560
}
571-
if let Some(ref s) = cfg.jemalloc {
572-
target.jemalloc = Some(config.src.join(s));
573-
}
574561
if let Some(ref s) = cfg.android_ndk {
575562
target.ndk = Some(config.src.join(s));
576563
}
@@ -611,7 +598,6 @@ impl Config {
611598
config.rust_debuginfo_tools = debuginfo_tools.unwrap_or(false);
612599

613600
let default = debug == Some(true);
614-
config.debug_jemalloc = debug_jemalloc.unwrap_or(default);
615601
config.rust_debuginfo = debuginfo.unwrap_or(default);
616602
config.rust_debug_assertions = debug_assertions.unwrap_or(default);
617603
config.rust_optimize = optimize.unwrap_or(!default);

src/bootstrap/configure.py

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

8685
v("prefix", "install.prefix", "set installation prefix")
@@ -95,7 +94,6 @@ def v(*args):
9594

9695
v("llvm-root", None, "set LLVM root")
9796
v("python", "build.python", "set path to python")
98-
v("jemalloc-root", None, "set directory where libjemalloc_pic.a is located")
9997
v("android-cross-path", "target.arm-linux-androideabi.android-ndk",
10098
"Android NDK standalone path (deprecated)")
10199
v("i686-linux-android-ndk", "target.i686-linux-android.android-ndk",
@@ -144,7 +142,6 @@ def v(*args):
144142
# Many of these are saved below during the "writing configuration" step
145143
# (others are conditionally saved).
146144
o("manage-submodules", "build.submodules", "let the build manage the git submodules")
147-
o("jemalloc", "rust.use-jemalloc", "build liballoc with jemalloc")
148145
o("full-bootstrap", "build.full-bootstrap", "build three compilers instead of two")
149146
o("extended", "build.extended", "build an extended rust tool set")
150147

@@ -322,8 +319,6 @@ def set(key, value):
322319
set('build.cargo', value + '/bin/cargo')
323320
elif option.name == 'llvm-root':
324321
set('target.{}.llvm-config'.format(build()), value + '/bin/llvm-config')
325-
elif option.name == 'jemalloc-root':
326-
set('target.{}.jemalloc'.format(build()), value + '/libjemalloc_pic.a')
327322
elif option.name == 'tools':
328323
set('build.tools', value.split(','))
329324
elif option.name == 'host':

src/bootstrap/dist.rs

-3
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,6 @@ impl Step for Src {
834834
"src/build_helper",
835835
"src/dlmalloc",
836836
"src/liballoc",
837-
"src/liballoc_jemalloc",
838837
"src/liballoc_system",
839838
"src/libbacktrace",
840839
"src/libcompiler_builtins",
@@ -854,13 +853,11 @@ impl Step for Src {
854853
"src/rustc/dlmalloc_shim",
855854
"src/libtest",
856855
"src/libterm",
857-
"src/jemalloc",
858856
"src/libprofiler_builtins",
859857
"src/stdsimd",
860858
];
861859
let std_src_dirs_exclude = [
862860
"src/libcompiler_builtins/compiler-rt/test",
863-
"src/jemalloc/test/unit",
864861
];
865862

866863
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
@@ -498,12 +498,6 @@ impl Build {
498498
fn std_features(&self) -> String {
499499
let mut features = "panic-unwind".to_string();
500500

501-
if self.config.debug_jemalloc {
502-
features.push_str(" debug-jemalloc");
503-
}
504-
if self.config.use_jemalloc {
505-
features.push_str(" jemalloc");
506-
}
507501
if self.config.backtrace {
508502
features.push_str(" backtrace");
509503
}
@@ -518,11 +512,7 @@ impl Build {
518512

519513
/// Get the space-separated set of activated features for the compiler.
520514
fn rustc_features(&self) -> String {
521-
let mut features = String::new();
522-
if self.config.use_jemalloc {
523-
features.push_str(" jemalloc");
524-
}
525-
features
515+
String::new()
526516
}
527517

528518
/// Component directory that Cargo will produce output into (e.g.
@@ -732,7 +722,7 @@ impl Build {
732722
// If we're compiling on macOS then we add a few unconditional flags
733723
// indicating that we want libc++ (more filled out than libstdc++) and
734724
// we want to compile for 10.7. This way we can ensure that
735-
// LLVM/jemalloc/etc are all properly compiled.
725+
// LLVM/etc are all properly compiled.
736726
if target.contains("apple-darwin") {
737727
base.push("-stdlib=libc++".into());
738728
}

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
@@ -1468,8 +1468,7 @@ impl Step for CrateNotDefault {
14681468
type Output = ();
14691469

14701470
fn should_run(run: ShouldRun) -> ShouldRun {
1471-
run.path("src/liballoc_jemalloc")
1472-
.path("src/librustc_asan")
1471+
run.path("src/librustc_asan")
14731472
.path("src/librustc_lsan")
14741473
.path("src/librustc_msan")
14751474
.path("src/librustc_tsan")
@@ -1486,7 +1485,6 @@ impl Step for CrateNotDefault {
14861485
target: run.target,
14871486
test_kind,
14881487
krate: match run.path {
1489-
_ if run.path.ends_with("src/liballoc_jemalloc") => "alloc_jemalloc",
14901488
_ if run.path.ends_with("src/librustc_asan") => "rustc_asan",
14911489
_ if run.path.ends_with("src/librustc_lsan") => "rustc_lsan",
14921490
_ if run.path.ends_with("src/librustc_msan") => "rustc_msan",
@@ -1525,7 +1523,6 @@ impl Step for Crate {
15251523
run = run.krate("test");
15261524
for krate in run.builder.in_tree_crates("std") {
15271525
if krate.is_local(&run.builder)
1528-
&& !krate.name.contains("jemalloc")
15291526
&& !(krate.name.starts_with("rustc_") && krate.name.ends_with("san"))
15301527
&& krate.name != "dlmalloc"
15311528
{

src/ci/docker/disabled/dist-x86_64-haiku/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ RUN sh /scripts/sccache.sh
4242
ENV HOST=x86_64-unknown-haiku
4343
ENV TARGET=target.$HOST
4444

45-
ENV RUST_CONFIGURE_ARGS --disable-jemalloc \
45+
ENV RUST_CONFIGURE_ARGS \
4646
--set=$TARGET.cc=x86_64-unknown-haiku-gcc \
4747
--set=$TARGET.cxx=x86_64-unknown-haiku-g++ \
4848
--set=$TARGET.llvm-config=/bin/llvm-config-haiku

src/liballoc/tests/heap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::alloc::{Global, Alloc, Layout};
1414
/// https://github.com/rust-lang/rust/issues/45955
1515
///
1616
/// Note that `#[global_allocator]` is not used,
17-
/// so `liballoc_jemalloc` is linked (on some platforms).
17+
/// so `System` and `Global` might be backed by different allocators.
1818
#[test]
1919
fn alloc_system_overaligned_request() {
2020
check_overalign_requests(System)

src/librustc/middle/allocator.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@
1111
#[derive(Clone, Copy)]
1212
pub enum AllocatorKind {
1313
Global,
14-
DefaultLib,
15-
DefaultExe,
14+
Default,
1615
}
1716

1817
impl AllocatorKind {
1918
pub fn fn_name(&self, base: &str) -> String {
2019
match *self {
2120
AllocatorKind::Global => format!("__rg_{}", base),
22-
AllocatorKind::DefaultLib => format!("__rdl_{}", base),
23-
AllocatorKind::DefaultExe => format!("__rde_{}", base),
21+
AllocatorKind::Default => format!("__rdl_{}", base),
2422
}
2523
}
2624
}

src/librustc/middle/dependency_format.rs

-15
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
6464
use hir::def_id::CrateNum;
6565

66-
use session;
6766
use session::config;
6867
use ty::TyCtxt;
6968
use middle::cstore::{self, DepKind};
@@ -225,7 +224,6 @@ fn calculate_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
225224
// quite yet, so do so here.
226225
activate_injected_dep(*sess.injected_panic_runtime.get(), &mut ret,
227226
&|cnum| tcx.is_panic_runtime(cnum));
228-
activate_injected_allocator(sess, &mut ret);
229227

230228
// When dylib B links to dylib A, then when using B we must also link to A.
231229
// It could be the case, however, that the rlib for A is present (hence we
@@ -304,7 +302,6 @@ fn attempt_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<DependencyLis
304302
// that here and activate them.
305303
activate_injected_dep(*sess.injected_panic_runtime.get(), &mut ret,
306304
&|cnum| tcx.is_panic_runtime(cnum));
307-
activate_injected_allocator(sess, &mut ret);
308305

309306
Some(ret)
310307
}
@@ -337,18 +334,6 @@ fn activate_injected_dep(injected: Option<CrateNum>,
337334
}
338335
}
339336

340-
fn activate_injected_allocator(sess: &session::Session,
341-
list: &mut DependencyList) {
342-
let cnum = match sess.injected_allocator.get() {
343-
Some(cnum) => cnum,
344-
None => return,
345-
};
346-
let idx = cnum.as_usize() - 1;
347-
if list[idx] == Linkage::NotLinked {
348-
list[idx] = Linkage::Static;
349-
}
350-
}
351-
352337
// After the linkage for a crate has been determined we need to verify that
353338
// there's only going to be one allocator in the output.
354339
fn verify_ok<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, list: &[Linkage]) {

0 commit comments

Comments
 (0)