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

Rollup of 5 pull requests #61155

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e349f8f
Use a PathBuf instead of String for representing the pgo-use path int…
michaelwoerister May 22, 2019
01a59a3
PGO: Check that pgo-use file actually exists. LLVM seems to only emit…
michaelwoerister May 22, 2019
b1f27fa
rustbuild: Also build compiler-rt when building LLDB. This allows cla…
michaelwoerister May 22, 2019
51463d0
Add a smoketest for combining PGO with xLTO.
michaelwoerister May 20, 2019
b3c5cdd
Fix unit test after pgo-use change.
michaelwoerister May 22, 2019
1a35a1c
Ship profiler with windows-gnu
mati865 May 23, 2019
45e9d8e
Avoid interning in `resolve_place_op`.
nnethercote May 22, 2019
f9c4a90
Avoid unnecessary internings.
nnethercote May 22, 2019
2fab5d6
Pass symbols to `ExtCtxt::std_path` instead of strings.
nnethercote May 22, 2019
c040b3b
Pre-intern "0", "1", ..., "9", and use where appropriate.
nnethercote May 22, 2019
eb962c2
Add `ty_to_symbol` methods.
nnethercote May 23, 2019
babd1a1
Avoid some re-interning in `to_lit_token`.
nnethercote May 23, 2019
54c8725
Use `Symbol` equality in `is_ident_named`.
nnethercote May 23, 2019
c389116
Use `Symbol` equality in `check_ident_token`.
nnethercote May 23, 2019
71920d3
Use `Symbol` equality in `may_begin_with` and `parse_nt`.
nnethercote May 23, 2019
e396f99
Don't arena-allocate static symbols.
nnethercote May 23, 2019
fd19989
Fix spelling in release notes
aristocles-deploy May 25, 2019
ad0d136
Rollup merge of #61035 - nnethercote:avoid-more-symbol-interning, r=p…
Centril May 25, 2019
04f81f2
Rollup merge of #61036 - michaelwoerister:pgo-xlto-test, r=alexcrichton
Centril May 25, 2019
bc235ee
Rollup merge of #61077 - nnethercote:tweak-prefill, r=petrochenkov
Centril May 25, 2019
e6eaff6
Rollup merge of #61080 - mati865:mingw_pgo, r=sanxiyn
Centril May 25, 2019
5c60c50
Rollup merge of #61149 - vishalsodani:master, r=Centril
Centril May 25, 2019
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
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2996,6 +2996,7 @@ dependencies = [
"rustc_cratesio_shim 0.0.0",
"rustc_data_structures 0.0.0",
"serialize 0.0.0",
"syntax_pos 0.0.0",
]

[[package]]
Expand Down
2 changes: 1 addition & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Libraries
produce a warning if their returning type is unused.
- [The methods `checked_pow`, `saturating_pow`, `wrapping_pow`, and
`overflowing_pow` are now available for all numeric types.][57873] These are
equivalvent to methods such as `wrapping_add` for the `pow` operation.
equivalent to methods such as `wrapping_add` for the `pow` operation.


Stabilized APIs
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ environment:
DEPLOY: 1
- CI_JOB_NAME: dist-i686-mingw
MSYS_BITS: 32
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
SCRIPT: python x.py dist
MINGW_URL: https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror
MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
Expand All @@ -114,7 +114,7 @@ environment:
- CI_JOB_NAME: dist-x86_64-mingw
MSYS_BITS: 64
SCRIPT: python x.py dist
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
MINGW_URL: https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror
MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
MINGW_DIR: mingw64
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl Step for Llvm {
}

if want_lldb {
cfg.define("LLVM_ENABLE_PROJECTS", "clang;lldb");
cfg.define("LLVM_ENABLE_PROJECTS", "clang;lldb;compiler-rt");
// For the time being, disable code signing.
cfg.define("LLDB_CODESIGN_IDENTITY", "");
cfg.define("LLDB_NO_DEBUGSERVER", "ON");
Expand Down
6 changes: 5 additions & 1 deletion src/libprofiler_builtins/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ fn main() {
cfg.flag("-fomit-frame-pointer");
cfg.flag("-ffreestanding");
cfg.define("VISIBILITY_HIDDEN", None);
cfg.define("COMPILER_RT_HAS_UNAME", Some("1"));
if !target.contains("windows") {
cfg.define("COMPILER_RT_HAS_UNAME", Some("1"));
} else {
profile_sources.push("WindowsMMap.c");
}
}

// Assume that the Unixes we are building this for have fnctl() available
Expand Down
10 changes: 3 additions & 7 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1145,9 +1145,7 @@ impl<'a> LoweringContext<'a> {
let unstable_span = self.sess.source_map().mark_span_with_reason(
CompilerDesugaringKind::Async,
span,
Some(vec![
Symbol::intern("gen_future"),
].into()),
Some(vec![sym::gen_future].into()),
);
let gen_future = self.expr_std_path(
unstable_span, &[sym::future, sym::from_generator], None, ThinVec::new());
Expand Down Expand Up @@ -2958,7 +2956,7 @@ impl<'a> LoweringContext<'a> {
ident: match f.ident {
Some(ident) => ident,
// FIXME(jseyfried): positional field hygiene
None => Ident::new(Symbol::intern(&index.to_string()), f.span),
None => Ident::new(sym::integer(index), f.span),
},
vis: self.lower_visibility(&f.vis, None),
ty: self.lower_ty(&f.ty, ImplTraitContext::disallowed()),
Expand Down Expand Up @@ -4177,9 +4175,7 @@ impl<'a> LoweringContext<'a> {
let unstable_span = this.sess.source_map().mark_span_with_reason(
CompilerDesugaringKind::TryBlock,
body.span,
Some(vec![
Symbol::intern("try_trait"),
].into()),
Some(vec![sym::try_trait].into()),
);
let mut block = this.lower_block(body, true).into_inner();
let tail = block.expr.take().map_or_else(
Expand Down
5 changes: 2 additions & 3 deletions src/librustc/hir/map/def_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ use crate::session::CrateDisambiguator;
use syntax::ast::*;
use syntax::ext::hygiene::Mark;
use syntax::visit;
use syntax::symbol::kw;
use syntax::symbol::Symbol;
use syntax::symbol::{kw, sym};
use syntax::parse::token::{self, Token};
use syntax_pos::Span;

Expand Down Expand Up @@ -221,7 +220,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
_: &'a Generics, _: NodeId, _: Span) {
for (index, field) in data.fields().iter().enumerate() {
let name = field.ident.map(|ident| ident.name)
.unwrap_or_else(|| Symbol::intern(&index.to_string()));
.unwrap_or_else(|| sym::integer(index));
let def = self.create_def(field.id,
DefPathData::ValueNs(name.as_interned_str()),
field.span);
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> {
pub fn extract(attrs: &[ast::Attribute]) -> Option<(Symbol, Span)> {
attrs.iter().find_map(|attr| Some(match attr {
_ if attr.check_name(sym::lang) => (attr.value_str()?, attr.span),
_ if attr.check_name(sym::panic_handler) => (Symbol::intern("panic_impl"), attr.span),
_ if attr.check_name(sym::alloc_error_handler) => (Symbol::intern("oom"), attr.span),
_ if attr.check_name(sym::panic_handler) => (sym::panic_impl, attr.span),
_ if attr.check_name(sym::alloc_error_handler) => (sym::oom, attr.span),
_ => return None,
}))
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/mem_categorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {

for (i, subpat) in subpats.iter().enumerate_and_adjust(expected_len, ddpos) {
let subpat_ty = self.pat_ty_adjusted(&subpat)?; // see (*2)
let interior = InteriorField(FieldIndex(i, Name::intern(&i.to_string())));
let interior = InteriorField(FieldIndex(i, sym::integer(i)));
let subcmt = Rc::new(
self.cat_imm_interior(pat, cmt.clone(), subpat_ty, interior));
self.cat_pattern_(subcmt, &subpat, op)?;
Expand Down Expand Up @@ -1363,7 +1363,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
};
for (i, subpat) in subpats.iter().enumerate_and_adjust(expected_len, ddpos) {
let subpat_ty = self.pat_ty_adjusted(&subpat)?; // see (*2)
let interior = InteriorField(FieldIndex(i, Name::intern(&i.to_string())));
let interior = InteriorField(FieldIndex(i, sym::integer(i)));
let subcmt = Rc::new(
self.cat_imm_interior(pat, cmt.clone(), subpat_ty, interior));
self.cat_pattern_(subcmt, &subpat, op)?;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ impl<'a, 'tcx> Index<'tcx> {
reason: Some(Symbol::intern(reason)),
issue: 27812,
},
feature: Symbol::intern("rustc_private"),
feature: sym::rustc_private,
rustc_depr: None,
const_stability: None,
promotable: false,
Expand Down Expand Up @@ -880,7 +880,7 @@ pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
// FIXME: only remove `libc` when `stdbuild` is active.
// FIXME: remove special casing for `test`.
remaining_lib_features.remove(&Symbol::intern("libc"));
remaining_lib_features.remove(&Symbol::intern("test"));
remaining_lib_features.remove(&sym::test);

let check_features =
|remaining_lib_features: &mut FxHashMap<_, _>, defined_features: &[_]| {
Expand Down
25 changes: 12 additions & 13 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use syntax::source_map::{FileName, FilePathMapping};
use syntax::edition::{Edition, EDITION_NAME_LIST, DEFAULT_EDITION};
use syntax::parse::token;
use syntax::parse;
use syntax::symbol::Symbol;
use syntax::symbol::{sym, Symbol};
use syntax::feature_gate::UnstableFeatures;
use errors::emitter::HumanReadableErrorType;

Expand Down Expand Up @@ -1381,7 +1381,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"insert profiling code"),
pgo_gen: PgoGenerate = (PgoGenerate::Disabled, parse_pgo_generate, [TRACKED],
"Generate PGO profile data, to a given file, or to the default location if it's empty."),
pgo_use: String = (String::new(), parse_string, [TRACKED],
pgo_use: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED],
"Use PGO profile data from the given profile file."),
disable_instrumentation_preinliner: bool = (false, parse_bool, [TRACKED],
"Disable the instrumentation pre-inliner, useful for profiling / PGO."),
Expand Down Expand Up @@ -1503,31 +1503,31 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
Some(Symbol::intern(vendor)),
));
if sess.target.target.options.has_elf_tls {
ret.insert((Symbol::intern("target_thread_local"), None));
ret.insert((sym::target_thread_local, None));
}
for &i in &[8, 16, 32, 64, 128] {
if i >= min_atomic_width && i <= max_atomic_width {
let s = i.to_string();
ret.insert((
Symbol::intern("target_has_atomic"),
sym::target_has_atomic,
Some(Symbol::intern(&s)),
));
if &s == wordsz {
ret.insert((
Symbol::intern("target_has_atomic"),
sym::target_has_atomic,
Some(Symbol::intern("ptr")),
));
}
}
}
if atomic_cas {
ret.insert((Symbol::intern("target_has_atomic"), Some(Symbol::intern("cas"))));
ret.insert((sym::target_has_atomic, Some(Symbol::intern("cas"))));
}
if sess.opts.debug_assertions {
ret.insert((Symbol::intern("debug_assertions"), None));
}
if sess.opts.crate_types.contains(&CrateType::ProcMacro) {
ret.insert((Symbol::intern("proc_macro"), None));
ret.insert((sym::proc_macro, None));
}
ret
}
Expand All @@ -1547,7 +1547,7 @@ pub fn build_configuration(sess: &Session, mut user_cfg: ast::CrateConfig) -> as
let default_cfg = default_configuration(sess);
// If the user wants a test runner, then add the test cfg
if sess.opts.test {
user_cfg.insert((Symbol::intern("test"), None));
user_cfg.insert((sym::test, None));
}
user_cfg.extend(default_cfg.iter().cloned());
user_cfg
Expand Down Expand Up @@ -2021,7 +2021,7 @@ pub fn build_session_options_and_crate_config(
}
}

if debugging_opts.pgo_gen.enabled() && !debugging_opts.pgo_use.is_empty() {
if debugging_opts.pgo_gen.enabled() && debugging_opts.pgo_use.is_some() {
early_error(
error_format,
"options `-Z pgo-gen` and `-Z pgo-use` are exclusive",
Expand Down Expand Up @@ -2702,7 +2702,7 @@ mod tests {
use std::path::PathBuf;
use super::{Externs, OutputType, OutputTypes};
use rustc_target::spec::{MergeFunctions, PanicStrategy, RelroLevel};
use syntax::symbol::Symbol;
use syntax::symbol::sym;
use syntax::edition::{Edition, DEFAULT_EDITION};
use syntax;
use super::Options;
Expand Down Expand Up @@ -2744,15 +2744,14 @@ mod tests {
let (sessopts, cfg) = build_session_options_and_crate_config(matches);
let sess = build_session(sessopts, None, registry);
let cfg = build_configuration(&sess, to_crate_config(cfg));
assert!(cfg.contains(&(Symbol::intern("test"), None)));
assert!(cfg.contains(&(sym::test, None)));
});
}

// When the user supplies --test and --cfg test, don't implicitly add
// another --cfg test
#[test]
fn test_switch_implies_cfg_test_unless_cfg_test() {
use syntax::symbol::sym;
syntax::with_default_globals(|| {
let matches = &match optgroups().parse(&["--test".to_string(),
"--cfg=test".to_string()]) {
Expand Down Expand Up @@ -3212,7 +3211,7 @@ mod tests {
assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());

opts = reference.clone();
opts.debugging_opts.pgo_use = String::from("abc");
opts.debugging_opts.pgo_use = Some(PathBuf::from("abc"));
assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());

opts = reference.clone();
Expand Down
9 changes: 9 additions & 0 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,15 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
sess.err("Linker plugin based LTO is not supported together with \
`-C prefer-dynamic` when targeting MSVC");
}

// Make sure that any given profiling data actually exists so LLVM can't
// decide to silently skip PGO.
if let Some(ref path) = sess.opts.debugging_opts.pgo_use {
if !path.exists() {
sess.err(&format!("File `{}` passed to `-Zpgo-use` does not exist.",
path.display()));
}
}
}

/// Hash value constructed out of all the `-C metadata` arguments passed to the
Expand Down
6 changes: 2 additions & 4 deletions src/librustc_allocator/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ impl MutVisitor for ExpandAllocatorDirectives<'_> {
call_site: item.span, // use the call site of the static
def_site: None,
format: MacroAttribute(Symbol::intern(name)),
allow_internal_unstable: Some(vec![
Symbol::intern("rustc_attrs"),
].into()),
allow_internal_unstable: Some(vec![sym::rustc_attrs].into()),
allow_internal_unsafe: false,
local_inner_macros: false,
edition: self.sess.edition,
Expand Down Expand Up @@ -223,7 +221,7 @@ impl AllocFnFactory<'_> {
}

fn attrs(&self) -> Vec<Attribute> {
let special = Symbol::intern("rustc_std_internal_symbol");
let special = sym::rustc_std_internal_symbol;
let special = self.cx.meta_word(self.span, special);
vec![self.cx.attribute(self.span, special)]
}
Expand Down
8 changes: 3 additions & 5 deletions src/librustc_codegen_llvm/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,11 +721,9 @@ pub unsafe fn with_llvm_pmb(llmod: &llvm::Module,
}
};

let pgo_use_path = if config.pgo_use.is_empty() {
None
} else {
Some(CString::new(config.pgo_use.as_bytes()).unwrap())
};
let pgo_use_path = config.pgo_use.as_ref().map(|path_buf| {
CString::new(path_buf.to_string_lossy().as_bytes()).unwrap()
});

llvm::LLVMRustConfigurePassManagerBuilder(
builder,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_ssa/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub struct ModuleConfig {
pub opt_size: Option<config::OptLevel>,

pub pgo_gen: PgoGenerate,
pub pgo_use: String,
pub pgo_use: Option<PathBuf>,

// Flags indicating which outputs to produce.
pub emit_pre_lto_bc: bool,
Expand Down Expand Up @@ -95,7 +95,7 @@ impl ModuleConfig {
opt_size: None,

pgo_gen: PgoGenerate::Disabled,
pgo_use: String::new(),
pgo_use: None,

emit_no_opt_bc: false,
emit_pre_lto_bc: false,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_interface/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub fn add_configuration(
sess: &Session,
codegen_backend: &dyn CodegenBackend,
) {
let tf = Symbol::intern("target_feature");
let tf = sym::target_feature;

cfg.extend(
codegen_backend
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1439,8 +1439,8 @@ impl KeywordIdents {
{
let next_edition = match cx.sess.edition() {
Edition::Edition2015 => {
match &ident.as_str()[..] {
"async" | "await" | "try" => Edition::Edition2018,
match ident.name {
kw::Async | kw::Await | kw::Try => Edition::Edition2018,

// rust-lang/rust#56327: Conservatively do not
// attempt to report occurrences of `dyn` within
Expand All @@ -1454,7 +1454,7 @@ impl KeywordIdents {
// its precise role in the parsed AST and thus are
// assured this is truly an attempt to use it as
// an identifier.
"dyn" if !under_macro => Edition::Edition2018,
kw::Dyn if !under_macro => Edition::Edition2018,

_ => return,
}
Expand Down
Loading