Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Less globals #46193

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
aa93401
Add sync module to rustc_data_structures
Zoxc Dec 3, 2017
629a2d2
Make arenas thread safe
Zoxc Dec 3, 2017
68e2109
Combine GlobalArenas and DroplessArena into AllArenas
Zoxc Dec 3, 2017
059db7d
A SameThread type is introduced in src/librustc_trans/metadata.rs whi…
Zoxc Dec 3, 2017
cab774d
Make mk_attr_id thread safe
Zoxc Dec 3, 2017
e266fbf
Make err_count thread safe
Zoxc Dec 3, 2017
359f890
Refactor code so the call to codemap.files() does not deadlock
Zoxc Dec 3, 2017
ca2e0e2
Convert IGNORED_ATTR_NAMES into a global variable and initialize it o…
Zoxc Dec 3, 2017
35e2afc
Add a -Z query_threads compiler option
Zoxc Dec 3, 2017
991262b
Assert that GlobalCtxt is Sync
Zoxc Dec 3, 2017
dafdbe6
Make PROFQ_CHAN a global
Zoxc Dec 3, 2017
fb6631a
Make IndexVec implement Send and Sync
Zoxc Dec 3, 2017
e6d2320
Make TransitiveRelation thread safe. Avoid locking by using get_mut i…
Zoxc Dec 3, 2017
bdf5391
Remove useless Rc
Zoxc Dec 3, 2017
d1d1c72
Use rustc_erase_owner! which produces a Send + Sync erased owner if c…
Zoxc Dec 3, 2017
7427bfa
Add Encodable and Decodable impls for Arc<[T]>
Zoxc Dec 3, 2017
b626fc4
Make USED_ATTRS and KNOWN_ATTRS into globals
Zoxc Dec 3, 2017
d64651f
Make REGISTERED_DIAGNOSTICS a global
Zoxc Dec 3, 2017
b81bd03
FIXME note + thread safety
Zoxc Dec 3, 2017
60bf355
Make HYGIENE_DATA a global
Zoxc Dec 3, 2017
f3cf981
Make Span and Symbol implement Send and Sync
Zoxc Dec 3, 2017
a87758f
Make InternedString Send
Zoxc Dec 3, 2017
29af473
Make syntax_pos interners globals
Zoxc Dec 3, 2017
aee48c3
Mechanical translation which results in GlobalCtxt being Sync
Zoxc Dec 3, 2017
844c812
Remove IGNORED_ATTR_NAMES and make PROFQ_CHAN a scoped thread local.
Zoxc Nov 21, 2017
a46f81e
Remove syntax and syntax_pos thread locals
Zoxc Nov 25, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 81 additions & 17 deletions src/Cargo.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ fn main() {
}
}

if env::var_os("RUSTC_PARALLEL_QUERIES").is_some() {
cmd.arg("--cfg").arg("parallel_queries");
}

let color = match env::var("RUSTC_COLOR") {
Ok(s) => usize::from_str(&s).expect("RUSTC_COLOR should be an integer"),
Err(_) => 0,
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,9 @@ pub fn rustc_cargo(build: &Build,
if let Some(ref s) = build.config.rustc_default_linker {
cargo.env("CFG_DEFAULT_LINKER", s);
}
if build.config.rustc_parallel_queries {
cargo.env("RUSTC_PARALLEL_QUERIES", "1");
}
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ pub struct Config {
pub rust_debuginfo_lines: bool,
pub rust_debuginfo_only_std: bool,
pub rust_rpath: bool,
pub rustc_parallel_queries: bool,
pub rustc_default_linker: Option<String>,
pub rust_optimize_tests: bool,
pub rust_debuginfo_tests: bool,
Expand Down Expand Up @@ -266,6 +267,7 @@ struct Rust {
debuginfo: Option<bool>,
debuginfo_lines: Option<bool>,
debuginfo_only_std: Option<bool>,
experimental_parallel_queries: Option<bool>,
debug_jemalloc: Option<bool>,
use_jemalloc: Option<bool>,
backtrace: Option<bool>,
Expand Down Expand Up @@ -474,6 +476,7 @@ impl Config {
set(&mut config.rust_dist_src, rust.dist_src);
set(&mut config.quiet_tests, rust.quiet_tests);
set(&mut config.test_miri, rust.test_miri);
config.rustc_parallel_queries = rust.experimental_parallel_queries.unwrap_or(false);
config.rustc_default_linker = rust.default_linker.clone();
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);
Expand Down
3 changes: 3 additions & 0 deletions src/libarena/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ version = "0.0.0"
name = "arena"
path = "lib.rs"
crate-type = ["dylib"]

[dependencies]
rustc_data_structures = { path = "../librustc_data_structures" }
Loading