Skip to content

Commit 400d0df

Browse files
authored
Rollup merge of rust-lang#61153 - Centril:rollup-b9qpiez, r=Centril
Rollup of 5 pull requests Successful merges: - rust-lang#60928 (Changes the type `mir::Mir` into `mir::Body`) - rust-lang#61035 (Avoid more symbol interning) - rust-lang#61036 (PGO - Add a smoketest for combining PGO with cross-language LTO.) - rust-lang#61077 (Don't arena-allocate static symbols.) - rust-lang#61080 (Ship profiler with windows-gnu) Failed merges: r? @ghost
2 parents cc3d058 + c907f03 commit 400d0df

File tree

150 files changed

+899
-690
lines changed

Some content is hidden

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

150 files changed

+899
-690
lines changed

Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -2998,6 +2998,7 @@ dependencies = [
29982998
"rustc_cratesio_shim 0.0.0",
29992999
"rustc_data_structures 0.0.0",
30003000
"serialize 0.0.0",
3001+
"syntax_pos 0.0.0",
30013002
]
30023003

30033004
[[package]]

appveyor.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ environment:
104104
DEPLOY: 1
105105
- CI_JOB_NAME: dist-i686-mingw
106106
MSYS_BITS: 32
107-
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools
107+
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
108108
SCRIPT: python x.py dist
109109
MINGW_URL: https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror
110110
MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
@@ -114,7 +114,7 @@ environment:
114114
- CI_JOB_NAME: dist-x86_64-mingw
115115
MSYS_BITS: 64
116116
SCRIPT: python x.py dist
117-
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools
117+
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
118118
MINGW_URL: https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror
119119
MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
120120
MINGW_DIR: mingw64

src/bootstrap/native.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl Step for Llvm {
204204
}
205205

206206
if want_lldb {
207-
cfg.define("LLVM_ENABLE_PROJECTS", "clang;lldb");
207+
cfg.define("LLVM_ENABLE_PROJECTS", "clang;lldb;compiler-rt");
208208
// For the time being, disable code signing.
209209
cfg.define("LLDB_CODESIGN_IDENTITY", "");
210210
cfg.define("LLDB_NO_DEBUGSERVER", "ON");

src/libprofiler_builtins/build.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ fn main() {
4141
cfg.flag("-fomit-frame-pointer");
4242
cfg.flag("-ffreestanding");
4343
cfg.define("VISIBILITY_HIDDEN", None);
44-
cfg.define("COMPILER_RT_HAS_UNAME", Some("1"));
44+
if !target.contains("windows") {
45+
cfg.define("COMPILER_RT_HAS_UNAME", Some("1"));
46+
} else {
47+
profile_sources.push("WindowsMMap.c");
48+
}
4549
}
4650

4751
// Assume that the Unixes we are building this for have fnctl() available

src/librustc/hir/lowering.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -1145,9 +1145,7 @@ impl<'a> LoweringContext<'a> {
11451145
let unstable_span = self.sess.source_map().mark_span_with_reason(
11461146
CompilerDesugaringKind::Async,
11471147
span,
1148-
Some(vec![
1149-
Symbol::intern("gen_future"),
1150-
].into()),
1148+
Some(vec![sym::gen_future].into()),
11511149
);
11521150
let gen_future = self.expr_std_path(
11531151
unstable_span, &[sym::future, sym::from_generator], None, ThinVec::new());
@@ -2958,7 +2956,7 @@ impl<'a> LoweringContext<'a> {
29582956
ident: match f.ident {
29592957
Some(ident) => ident,
29602958
// FIXME(jseyfried): positional field hygiene
2961-
None => Ident::new(Symbol::intern(&index.to_string()), f.span),
2959+
None => Ident::new(sym::integer(index), f.span),
29622960
},
29632961
vis: self.lower_visibility(&f.vis, None),
29642962
ty: self.lower_ty(&f.ty, ImplTraitContext::disallowed()),
@@ -4177,9 +4175,7 @@ impl<'a> LoweringContext<'a> {
41774175
let unstable_span = this.sess.source_map().mark_span_with_reason(
41784176
CompilerDesugaringKind::TryBlock,
41794177
body.span,
4180-
Some(vec![
4181-
Symbol::intern("try_trait"),
4182-
].into()),
4178+
Some(vec![sym::try_trait].into()),
41834179
);
41844180
let mut block = this.lower_block(body, true).into_inner();
41854181
let tail = block.expr.take().map_or_else(

src/librustc/hir/map/def_collector.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use crate::session::CrateDisambiguator;
55
use syntax::ast::*;
66
use syntax::ext::hygiene::Mark;
77
use syntax::visit;
8-
use syntax::symbol::kw;
9-
use syntax::symbol::Symbol;
8+
use syntax::symbol::{kw, sym};
109
use syntax::parse::token::{self, Token};
1110
use syntax_pos::Span;
1211

@@ -221,7 +220,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
221220
_: &'a Generics, _: NodeId, _: Span) {
222221
for (index, field) in data.fields().iter().enumerate() {
223222
let name = field.ident.map(|ident| ident.name)
224-
.unwrap_or_else(|| Symbol::intern(&index.to_string()));
223+
.unwrap_or_else(|| sym::integer(index));
225224
let def = self.create_def(field.id,
226225
DefPathData::ValueNs(name.as_interned_str()),
227226
field.span);

src/librustc/middle/lang_items.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> {
210210
pub fn extract(attrs: &[ast::Attribute]) -> Option<(Symbol, Span)> {
211211
attrs.iter().find_map(|attr| Some(match attr {
212212
_ if attr.check_name(sym::lang) => (attr.value_str()?, attr.span),
213-
_ if attr.check_name(sym::panic_handler) => (Symbol::intern("panic_impl"), attr.span),
214-
_ if attr.check_name(sym::alloc_error_handler) => (Symbol::intern("oom"), attr.span),
213+
_ if attr.check_name(sym::panic_handler) => (sym::panic_impl, attr.span),
214+
_ if attr.check_name(sym::alloc_error_handler) => (sym::oom, attr.span),
215215
_ => return None,
216216
}))
217217
}

src/librustc/middle/mem_categorization.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
13161316

13171317
for (i, subpat) in subpats.iter().enumerate_and_adjust(expected_len, ddpos) {
13181318
let subpat_ty = self.pat_ty_adjusted(&subpat)?; // see (*2)
1319-
let interior = InteriorField(FieldIndex(i, Name::intern(&i.to_string())));
1319+
let interior = InteriorField(FieldIndex(i, sym::integer(i)));
13201320
let subcmt = Rc::new(
13211321
self.cat_imm_interior(pat, cmt.clone(), subpat_ty, interior));
13221322
self.cat_pattern_(subcmt, &subpat, op)?;
@@ -1363,7 +1363,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
13631363
};
13641364
for (i, subpat) in subpats.iter().enumerate_and_adjust(expected_len, ddpos) {
13651365
let subpat_ty = self.pat_ty_adjusted(&subpat)?; // see (*2)
1366-
let interior = InteriorField(FieldIndex(i, Name::intern(&i.to_string())));
1366+
let interior = InteriorField(FieldIndex(i, sym::integer(i)));
13671367
let subcmt = Rc::new(
13681368
self.cat_imm_interior(pat, cmt.clone(), subpat_ty, interior));
13691369
self.cat_pattern_(subcmt, &subpat, op)?;

src/librustc/middle/stability.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ impl<'a, 'tcx> Index<'tcx> {
437437
reason: Some(Symbol::intern(reason)),
438438
issue: 27812,
439439
},
440-
feature: Symbol::intern("rustc_private"),
440+
feature: sym::rustc_private,
441441
rustc_depr: None,
442442
const_stability: None,
443443
promotable: false,
@@ -880,7 +880,7 @@ pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
880880
// FIXME: only remove `libc` when `stdbuild` is active.
881881
// FIXME: remove special casing for `test`.
882882
remaining_lib_features.remove(&Symbol::intern("libc"));
883-
remaining_lib_features.remove(&Symbol::intern("test"));
883+
remaining_lib_features.remove(&sym::test);
884884

885885
let check_features =
886886
|remaining_lib_features: &mut FxHashMap<_, _>, defined_features: &[_]| {

src/librustc/mir/cache.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc_data_structures::sync::{RwLock, MappedReadGuard, ReadGuard};
33
use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
44
StableHasherResult};
55
use crate::ich::StableHashingContext;
6-
use crate::mir::{Mir, BasicBlock};
6+
use crate::mir::{Body, BasicBlock};
77

88
use crate::rustc_serialize as serialize;
99

@@ -47,7 +47,7 @@ impl Cache {
4747

4848
pub fn predecessors(
4949
&self,
50-
mir: &Mir<'_>
50+
mir: &Body<'_>
5151
) -> MappedReadGuard<'_, IndexVec<BasicBlock, Vec<BasicBlock>>> {
5252
if self.predecessors.borrow().is_none() {
5353
*self.predecessors.borrow_mut() = Some(calculate_predecessors(mir));
@@ -57,7 +57,7 @@ impl Cache {
5757
}
5858
}
5959

60-
fn calculate_predecessors(mir: &Mir<'_>) -> IndexVec<BasicBlock, Vec<BasicBlock>> {
60+
fn calculate_predecessors(mir: &Body<'_>) -> IndexVec<BasicBlock, Vec<BasicBlock>> {
6161
let mut result = IndexVec::from_elem(vec![], mir.basic_blocks());
6262
for (bb, data) in mir.basic_blocks().iter_enumerated() {
6363
if let Some(ref term) = data.terminator {

src/librustc/mir/mod.rs

+21-21
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl<'tcx> HasLocalDecls<'tcx> for LocalDecls<'tcx> {
6262
}
6363
}
6464

65-
impl<'tcx> HasLocalDecls<'tcx> for Mir<'tcx> {
65+
impl<'tcx> HasLocalDecls<'tcx> for Body<'tcx> {
6666
fn local_decls(&self) -> &LocalDecls<'tcx> {
6767
&self.local_decls
6868
}
@@ -88,7 +88,7 @@ impl MirPhase {
8888

8989
/// Lowered representation of a single function.
9090
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
91-
pub struct Mir<'tcx> {
91+
pub struct Body<'tcx> {
9292
/// List of basic blocks. References to basic block use a newtyped index type `BasicBlock`
9393
/// that indexes into this vector.
9494
basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
@@ -109,15 +109,15 @@ pub struct Mir<'tcx> {
109109
pub source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>,
110110

111111
/// Rvalues promoted from this function, such as borrows of constants.
112-
/// Each of them is the Mir of a constant with the fn's type parameters
112+
/// Each of them is the Body of a constant with the fn's type parameters
113113
/// in scope, but a separate set of locals.
114-
pub promoted: IndexVec<Promoted, Mir<'tcx>>,
114+
pub promoted: IndexVec<Promoted, Body<'tcx>>,
115115

116116
/// Yields type of the function, if it is a generator.
117117
pub yield_ty: Option<Ty<'tcx>>,
118118

119119
/// Generator drop glue
120-
pub generator_drop: Option<Box<Mir<'tcx>>>,
120+
pub generator_drop: Option<Box<Body<'tcx>>>,
121121

122122
/// The layout of a generator. Produced by the state transformation.
123123
pub generator_layout: Option<GeneratorLayout<'tcx>>,
@@ -169,12 +169,12 @@ pub struct Mir<'tcx> {
169169
cache: cache::Cache,
170170
}
171171

172-
impl<'tcx> Mir<'tcx> {
172+
impl<'tcx> Body<'tcx> {
173173
pub fn new(
174174
basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
175175
source_scopes: IndexVec<SourceScope, SourceScopeData>,
176176
source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>,
177-
promoted: IndexVec<Promoted, Mir<'tcx>>,
177+
promoted: IndexVec<Promoted, Body<'tcx>>,
178178
yield_ty: Option<Ty<'tcx>>,
179179
local_decls: LocalDecls<'tcx>,
180180
user_type_annotations: CanonicalUserTypeAnnotations<'tcx>,
@@ -191,7 +191,7 @@ impl<'tcx> Mir<'tcx> {
191191
local_decls.len()
192192
);
193193

194-
Mir {
194+
Body {
195195
phase: MirPhase::Build,
196196
basic_blocks,
197197
source_scopes,
@@ -425,7 +425,7 @@ pub enum Safety {
425425
ExplicitUnsafe(hir::HirId),
426426
}
427427

428-
impl_stable_hash_for!(struct Mir<'tcx> {
428+
impl_stable_hash_for!(struct Body<'tcx> {
429429
phase,
430430
basic_blocks,
431431
source_scopes,
@@ -444,7 +444,7 @@ impl_stable_hash_for!(struct Mir<'tcx> {
444444
cache
445445
});
446446

447-
impl<'tcx> Index<BasicBlock> for Mir<'tcx> {
447+
impl<'tcx> Index<BasicBlock> for Body<'tcx> {
448448
type Output = BasicBlockData<'tcx>;
449449

450450
#[inline]
@@ -453,7 +453,7 @@ impl<'tcx> Index<BasicBlock> for Mir<'tcx> {
453453
}
454454
}
455455

456-
impl<'tcx> IndexMut<BasicBlock> for Mir<'tcx> {
456+
impl<'tcx> IndexMut<BasicBlock> for Body<'tcx> {
457457
#[inline]
458458
fn index_mut(&mut self, index: BasicBlock) -> &mut BasicBlockData<'tcx> {
459459
&mut self.basic_blocks_mut()[index]
@@ -601,7 +601,7 @@ newtype_index! {
601601
}
602602
}
603603

604-
/// Classifies locals into categories. See `Mir::local_kind`.
604+
/// Classifies locals into categories. See `Body::local_kind`.
605605
#[derive(PartialEq, Eq, Debug, HashStable)]
606606
pub enum LocalKind {
607607
/// User-declared variable binding
@@ -2897,23 +2897,23 @@ fn def_path_str(def_id: DefId) -> String {
28972897
ty::tls::with(|tcx| tcx.def_path_str(def_id))
28982898
}
28992899

2900-
impl<'tcx> graph::DirectedGraph for Mir<'tcx> {
2900+
impl<'tcx> graph::DirectedGraph for Body<'tcx> {
29012901
type Node = BasicBlock;
29022902
}
29032903

2904-
impl<'tcx> graph::WithNumNodes for Mir<'tcx> {
2904+
impl<'tcx> graph::WithNumNodes for Body<'tcx> {
29052905
fn num_nodes(&self) -> usize {
29062906
self.basic_blocks.len()
29072907
}
29082908
}
29092909

2910-
impl<'tcx> graph::WithStartNode for Mir<'tcx> {
2910+
impl<'tcx> graph::WithStartNode for Body<'tcx> {
29112911
fn start_node(&self) -> Self::Node {
29122912
START_BLOCK
29132913
}
29142914
}
29152915

2916-
impl<'tcx> graph::WithPredecessors for Mir<'tcx> {
2916+
impl<'tcx> graph::WithPredecessors for Body<'tcx> {
29172917
fn predecessors<'graph>(
29182918
&'graph self,
29192919
node: Self::Node,
@@ -2922,7 +2922,7 @@ impl<'tcx> graph::WithPredecessors for Mir<'tcx> {
29222922
}
29232923
}
29242924

2925-
impl<'tcx> graph::WithSuccessors for Mir<'tcx> {
2925+
impl<'tcx> graph::WithSuccessors for Body<'tcx> {
29262926
fn successors<'graph>(
29272927
&'graph self,
29282928
node: Self::Node,
@@ -2931,12 +2931,12 @@ impl<'tcx> graph::WithSuccessors for Mir<'tcx> {
29312931
}
29322932
}
29332933

2934-
impl<'a, 'b> graph::GraphPredecessors<'b> for Mir<'a> {
2934+
impl<'a, 'b> graph::GraphPredecessors<'b> for Body<'a> {
29352935
type Item = BasicBlock;
29362936
type Iter = IntoIter<BasicBlock>;
29372937
}
29382938

2939-
impl<'a, 'b> graph::GraphSuccessors<'b> for Mir<'a> {
2939+
impl<'a, 'b> graph::GraphSuccessors<'b> for Body<'a> {
29402940
type Item = BasicBlock;
29412941
type Iter = iter::Cloned<Successors<'b>>;
29422942
}
@@ -2975,7 +2975,7 @@ impl Location {
29752975
}
29762976

29772977
/// Returns `true` if `other` is earlier in the control flow graph than `self`.
2978-
pub fn is_predecessor_of<'tcx>(&self, other: Location, mir: &Mir<'tcx>) -> bool {
2978+
pub fn is_predecessor_of<'tcx>(&self, other: Location, mir: &Body<'tcx>) -> bool {
29792979
// If we are in the same block as the other location and are an earlier statement
29802980
// then we are a predecessor of `other`.
29812981
if self.block == other.block && self.statement_index < other.statement_index {
@@ -3228,7 +3228,7 @@ CloneTypeFoldableAndLiftImpls! {
32283228
}
32293229

32303230
BraceStructTypeFoldableImpl! {
3231-
impl<'tcx> TypeFoldable<'tcx> for Mir<'tcx> {
3231+
impl<'tcx> TypeFoldable<'tcx> for Body<'tcx> {
32323232
phase,
32333233
basic_blocks,
32343234
source_scopes,

0 commit comments

Comments
 (0)