File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -756,7 +756,7 @@ checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681"
756756dependencies = [
757757 " serde" ,
758758 " termcolor" ,
759- " unicode-width 0.1.14 " ,
759+ " unicode-width 0.2.2 " ,
760760]
761761
762762[[package ]]
@@ -2216,6 +2216,15 @@ version = "0.2.15"
22162216source = " registry+https://github.com/rust-lang/crates.io-index"
22172217checksum = " f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de"
22182218
2219+ [[package ]]
2220+ name = " libmimalloc-sys"
2221+ version = " 0.1.46"
2222+ source = " registry+https://github.com/rust-lang/crates.io-index"
2223+ checksum = " bc89deee4af0429081d2a518c0431ae068222a5a262a3bc6ff4d8535ec2e02fe"
2224+ dependencies = [
2225+ " cc" ,
2226+ ]
2227+
22192228[[package ]]
22202229name = " libredox"
22212230version = " 0.1.10"
@@ -2399,6 +2408,15 @@ dependencies = [
23992408 " libc" ,
24002409]
24012410
2411+ [[package ]]
2412+ name = " mimalloc"
2413+ version = " 0.1.49"
2414+ source = " registry+https://github.com/rust-lang/crates.io-index"
2415+ checksum = " aca3c01a711f395b4257b81674c0e90e8dd1f1e62c4b7db45f684cc7a4fcb18a"
2416+ dependencies = [
2417+ " libmimalloc-sys" ,
2418+ ]
2419+
24022420[[package ]]
24032421name = " minifier"
24042422version = " 0.3.6"
@@ -3808,6 +3826,7 @@ dependencies = [
38083826 " ctrlc" ,
38093827 " jiff" ,
38103828 " libc" ,
3829+ " mimalloc" ,
38113830 " rustc_abi" ,
38123831 " rustc_ast" ,
38133832 " rustc_ast_pretty" ,
Original file line number Diff line number Diff line change @@ -26,8 +26,7 @@ rustc_public_bridge = { path = "../rustc_public_bridge" }
2626getrandom = " =0.3.3"
2727wasi = " =0.14.2"
2828
29-
30- [dependencies .tikv-jemalloc-sys ]
29+ [target .'cfg(not(target_os = "windows"))' .dependencies .tikv-jemalloc-sys ]
3130version = " 0.6.1"
3231optional = true
3332features = [' override_allocator_on_supported_platforms' ]
@@ -39,7 +38,7 @@ llvm = ['rustc_driver_impl/llvm']
3938llvm_enzyme = [' rustc_driver_impl/llvm_enzyme' ]
4039llvm_offload = [' rustc_driver_impl/llvm_offload' ]
4140max_level_info = [' rustc_driver_impl/max_level_info' ]
42- override_allocator = [' dep:tikv-jemalloc-sys' ]
41+ override_allocator = [' dep:tikv-jemalloc-sys' , ' rustc_driver_impl/override_allocator ' ]
4342rustc_randomized_layouts = [' rustc_driver_impl/rustc_randomized_layouts' ]
4443# tidy-alphabetical-end
4544
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ use std::process::ExitCode;
3737// to compare their performance, see
3838// https://github.com/rust-lang/rust/commit/b90cfc887c31c3e7a9e6d462e2464db1fe506175#diff-43914724af6e464c1da2171e4a9b6c7e607d5bc1203fa95c0ab85be4122605ef
3939// for an example of how to do so.
40- #[ cfg( feature = "override_allocator" ) ]
40+ #[ cfg( all ( feature = "override_allocator" , not ( target_os = "windows" ) ) ) ]
4141use tikv_jemalloc_sys as _;
4242
4343fn main ( ) -> ExitCode {
Original file line number Diff line number Diff line change @@ -55,13 +55,18 @@ features = [
5555ctrlc = " 3.4.4"
5656# tidy-alphabetical-end
5757
58+ [target .'cfg(target_os = "windows")' .dependencies .mimalloc ]
59+ version = " 0.1.49"
60+ optional = true
61+
5862[features ]
5963# tidy-alphabetical-start
6064check_only = [' rustc_interface/check_only' ]
6165llvm = [' rustc_interface/llvm' ]
6266llvm_enzyme = [' rustc_interface/llvm_enzyme' ]
6367llvm_offload = [' rustc_interface/llvm_offload' ]
6468max_level_info = [' rustc_log/max_level_info' ]
69+ override_allocator = [' dep:mimalloc' ]
6570rustc_randomized_layouts = [
6671 ' rustc_index/rustc_randomized_layouts' ,
6772 ' rustc_middle/rustc_randomized_layouts'
Original file line number Diff line number Diff line change @@ -63,6 +63,10 @@ use rustc_target::json::ToJson;
6363use rustc_target:: spec:: { Target , TargetTuple } ;
6464use tracing:: trace;
6565
66+ #[ cfg( all( feature = "override_allocator" , target_os = "windows" ) ) ]
67+ #[ global_allocator]
68+ static GLOBAL : mimalloc:: MiMalloc = mimalloc:: MiMalloc ;
69+
6670#[ allow( unused_macros) ]
6771macro do_not_use_print( $( $t: tt) * ) {
6872 std:: compile_error!(
Original file line number Diff line number Diff line change @@ -659,6 +659,7 @@ auto:
659659 --target=x86_64-pc-windows-msvc
660660 --enable-full-tools
661661 --enable-profiler
662+ --set rust.override-allocator
662663 --set rust.codegen-units=1
663664 SCRIPT : python x.py build --set rust.debug=true opt-dist && PGO_HOST=x86_64-pc-windows-msvc ./build/x86_64-pc-windows-msvc/stage1-tools-bin/opt-dist windows-ci -- python x.py dist bootstrap --include-default-paths
664665 DIST_REQUIRE_ALL_TOOLS : 1
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ extern crate test;
6262/// FIXME(madsmtm): This is loaded from the sysroot that was built with the other `rustc` crates
6363/// above, instead of via Cargo as you'd normally do. This is currently needed for LTO due to
6464/// https://github.com/rust-lang/cc-rs/issues/1613.
65- #[ cfg( feature = "override_allocator" ) ]
65+ #[ cfg( all ( feature = "override_allocator" , not ( target_os = "windows" ) ) ) ]
6666extern crate tikv_jemalloc_sys as _;
6767
6868use std:: env:: { self , VarError } ;
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ extern crate rustc_span;
1717/// FIXME(madsmtm): This is loaded from the sysroot that was built with the other `rustc` crates
1818/// above, instead of via Cargo as you'd normally do. This is currently needed for LTO due to
1919/// <https://github.com/rust-lang/cc-rs/issues/1613>.
20- #[ cfg( feature = "override_allocator" ) ]
20+ #[ cfg( all ( feature = "override_allocator" , not ( target_os = "windows" ) ) ) ]
2121extern crate tikv_jemalloc_sys as _;
2222
2323use clippy_utils:: sym;
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ extern crate rustc_span;
2424/// FIXME(madsmtm): This is loaded from the sysroot that was built with the other `rustc` crates
2525/// above, instead of via Cargo as you'd normally do. This is currently needed for LTO due to
2626/// https://github.com/rust-lang/cc-rs/issues/1613.
27- #[ cfg( feature = "override_allocator" ) ]
27+ #[ cfg( all ( feature = "override_allocator" , not ( target_os = "windows" ) ) ) ]
2828// Make sure `--all-features` works: only Linux and macOS actually use jemalloc, and not on arm32.
2929#[ cfg( all(
3030 any( target_os = "linux" , target_os = "macos" ) ,
Original file line number Diff line number Diff line change @@ -356,6 +356,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
356356 "leb128" ,
357357 "libc" ,
358358 "libloading" ,
359+ "libmimalloc-sys" ,
359360 "linux-raw-sys" ,
360361 "litemap" ,
361362 "lock_api" ,
@@ -365,6 +366,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
365366 "measureme" ,
366367 "memchr" ,
367368 "memmap2" ,
369+ "mimalloc" ,
368370 "miniz_oxide" ,
369371 "nix" ,
370372 "nu-ansi-term" ,
You can’t perform that action at this time.
0 commit comments