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 7 pull requests #61178

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 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
e396f99
Don't arena-allocate static symbols.
nnethercote May 23, 2019
fd19989
Fix spelling in release notes
aristocles-deploy May 25, 2019
72145ea
MaybeUninit doctest: remove unnecessary type ascription
RalfJung May 25, 2019
a5e9d82
Auto-derive Encode and Decode implementations
fabric-and-ink May 25, 2019
d5f7181
Changes the type `mir::Mir` into `mir::Body`
May 17, 2019
4761a82
Rollup merge of #60928 - TheSirC:fix/60229, r=eddyb
Centril May 25, 2019
994fc4d
Rollup merge of #61036 - michaelwoerister:pgo-xlto-test, r=alexcrichton
Centril May 25, 2019
2b82444
Rollup merge of #61077 - nnethercote:tweak-prefill, r=petrochenkov
Centril May 25, 2019
94b29f3
Rollup merge of #61080 - mati865:mingw_pgo, r=sanxiyn
Centril May 25, 2019
f0e8c52
Rollup merge of #61149 - vishalsodani:master, r=Centril
Centril May 25, 2019
7e8fb82
Rollup merge of #61161 - RalfJung:maybe-uninit, r=Centril
Centril May 25, 2019
d19f11d
Rollup merge of #61173 - fabric-and-ink:minor-cleanup, r=varkor
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
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
4 changes: 2 additions & 2 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
/// out.write(vec![1, 2, 3]);
/// }
///
/// let mut v: MaybeUninit<Vec<i32>> = MaybeUninit::uninit();
/// let mut v = MaybeUninit::uninit();
/// unsafe { make_vec(v.as_mut_ptr()); }
/// // Now we know `v` is initialized! This also makes sure the vector gets
/// // properly dropped.
Expand Down Expand Up @@ -1071,7 +1071,7 @@ impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
/// optimizations, potentially resulting in a larger size:
///
/// ```rust
/// # use std::mem::{MaybeUninit, size_of, align_of};
/// # use std::mem::{MaybeUninit, size_of};
/// assert_eq!(size_of::<Option<bool>>(), 1);
/// assert_eq!(size_of::<Option<MaybeUninit<bool>>>(), 2);
/// ```
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
26 changes: 1 addition & 25 deletions src/librustc/hir/map/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use crate::ich::Fingerprint;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::indexed_vec::{IndexVec};
use rustc_data_structures::stable_hasher::StableHasher;
use serialize::{Encodable, Decodable, Encoder, Decoder};
use crate::session::CrateDisambiguator;
use std::borrow::Borrow;
use std::fmt::Write;
Expand All @@ -25,14 +24,13 @@ use crate::util::nodemap::NodeMap;
/// Internally the DefPathTable holds a tree of DefKeys, where each DefKey
/// stores the DefIndex of its parent.
/// There is one DefPathTable for each crate.
#[derive(Clone, Default)]
#[derive(Clone, Default, RustcDecodable, RustcEncodable)]
pub struct DefPathTable {
index_to_key: Vec<DefKey>,
def_path_hashes: Vec<DefPathHash>,
}

impl DefPathTable {

fn allocate(&mut self,
key: DefKey,
def_path_hash: DefPathHash)
Expand Down Expand Up @@ -86,28 +84,6 @@ impl DefPathTable {
}
}


impl Encodable for DefPathTable {
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
// Index to key
self.index_to_key.encode(s)?;

// DefPath hashes
self.def_path_hashes.encode(s)?;

Ok(())
}
}

impl Decodable for DefPathTable {
fn decode<D: Decoder>(d: &mut D) -> Result<DefPathTable, D::Error> {
Ok(DefPathTable {
index_to_key: Decodable::decode(d)?,
def_path_hashes : Decodable::decode(d)?,
})
}
}

/// The definition table containing node definitions.
/// It holds the `DefPathTable` for local `DefId`s/`DefPath`s and it also stores a
/// mapping from `NodeId`s to local `DefId`s.
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/mir/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc_data_structures::sync::{RwLock, MappedReadGuard, ReadGuard};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
StableHasherResult};
use crate::ich::StableHashingContext;
use crate::mir::{Mir, BasicBlock};
use crate::mir::{Body, BasicBlock};

use crate::rustc_serialize as serialize;

Expand Down Expand Up @@ -47,7 +47,7 @@ impl Cache {

pub fn predecessors(
&self,
mir: &Mir<'_>
mir: &Body<'_>
) -> MappedReadGuard<'_, IndexVec<BasicBlock, Vec<BasicBlock>>> {
if self.predecessors.borrow().is_none() {
*self.predecessors.borrow_mut() = Some(calculate_predecessors(mir));
Expand All @@ -57,7 +57,7 @@ impl Cache {
}
}

fn calculate_predecessors(mir: &Mir<'_>) -> IndexVec<BasicBlock, Vec<BasicBlock>> {
fn calculate_predecessors(mir: &Body<'_>) -> IndexVec<BasicBlock, Vec<BasicBlock>> {
let mut result = IndexVec::from_elem(vec![], mir.basic_blocks());
for (bb, data) in mir.basic_blocks().iter_enumerated() {
if let Some(ref term) = data.terminator {
Expand Down
42 changes: 21 additions & 21 deletions src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl<'tcx> HasLocalDecls<'tcx> for LocalDecls<'tcx> {
}
}

impl<'tcx> HasLocalDecls<'tcx> for Mir<'tcx> {
impl<'tcx> HasLocalDecls<'tcx> for Body<'tcx> {
fn local_decls(&self) -> &LocalDecls<'tcx> {
&self.local_decls
}
Expand All @@ -88,7 +88,7 @@ impl MirPhase {

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

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

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

/// Generator drop glue
pub generator_drop: Option<Box<Mir<'tcx>>>,
pub generator_drop: Option<Box<Body<'tcx>>>,

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

impl<'tcx> Mir<'tcx> {
impl<'tcx> Body<'tcx> {
pub fn new(
basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
source_scopes: IndexVec<SourceScope, SourceScopeData>,
source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>,
promoted: IndexVec<Promoted, Mir<'tcx>>,
promoted: IndexVec<Promoted, Body<'tcx>>,
yield_ty: Option<Ty<'tcx>>,
local_decls: LocalDecls<'tcx>,
user_type_annotations: CanonicalUserTypeAnnotations<'tcx>,
Expand All @@ -191,7 +191,7 @@ impl<'tcx> Mir<'tcx> {
local_decls.len()
);

Mir {
Body {
phase: MirPhase::Build,
basic_blocks,
source_scopes,
Expand Down Expand Up @@ -425,7 +425,7 @@ pub enum Safety {
ExplicitUnsafe(hir::HirId),
}

impl_stable_hash_for!(struct Mir<'tcx> {
impl_stable_hash_for!(struct Body<'tcx> {
phase,
basic_blocks,
source_scopes,
Expand All @@ -444,7 +444,7 @@ impl_stable_hash_for!(struct Mir<'tcx> {
cache
});

impl<'tcx> Index<BasicBlock> for Mir<'tcx> {
impl<'tcx> Index<BasicBlock> for Body<'tcx> {
type Output = BasicBlockData<'tcx>;

#[inline]
Expand All @@ -453,7 +453,7 @@ impl<'tcx> Index<BasicBlock> for Mir<'tcx> {
}
}

impl<'tcx> IndexMut<BasicBlock> for Mir<'tcx> {
impl<'tcx> IndexMut<BasicBlock> for Body<'tcx> {
#[inline]
fn index_mut(&mut self, index: BasicBlock) -> &mut BasicBlockData<'tcx> {
&mut self.basic_blocks_mut()[index]
Expand Down Expand Up @@ -601,7 +601,7 @@ newtype_index! {
}
}

/// Classifies locals into categories. See `Mir::local_kind`.
/// Classifies locals into categories. See `Body::local_kind`.
#[derive(PartialEq, Eq, Debug, HashStable)]
pub enum LocalKind {
/// User-declared variable binding
Expand Down Expand Up @@ -2890,23 +2890,23 @@ fn def_path_str(def_id: DefId) -> String {
ty::tls::with(|tcx| tcx.def_path_str(def_id))
}

impl<'tcx> graph::DirectedGraph for Mir<'tcx> {
impl<'tcx> graph::DirectedGraph for Body<'tcx> {
type Node = BasicBlock;
}

impl<'tcx> graph::WithNumNodes for Mir<'tcx> {
impl<'tcx> graph::WithNumNodes for Body<'tcx> {
fn num_nodes(&self) -> usize {
self.basic_blocks.len()
}
}

impl<'tcx> graph::WithStartNode for Mir<'tcx> {
impl<'tcx> graph::WithStartNode for Body<'tcx> {
fn start_node(&self) -> Self::Node {
START_BLOCK
}
}

impl<'tcx> graph::WithPredecessors for Mir<'tcx> {
impl<'tcx> graph::WithPredecessors for Body<'tcx> {
fn predecessors<'graph>(
&'graph self,
node: Self::Node,
Expand All @@ -2915,7 +2915,7 @@ impl<'tcx> graph::WithPredecessors for Mir<'tcx> {
}
}

impl<'tcx> graph::WithSuccessors for Mir<'tcx> {
impl<'tcx> graph::WithSuccessors for Body<'tcx> {
fn successors<'graph>(
&'graph self,
node: Self::Node,
Expand All @@ -2924,12 +2924,12 @@ impl<'tcx> graph::WithSuccessors for Mir<'tcx> {
}
}

impl<'a, 'b> graph::GraphPredecessors<'b> for Mir<'a> {
impl<'a, 'b> graph::GraphPredecessors<'b> for Body<'a> {
type Item = BasicBlock;
type Iter = IntoIter<BasicBlock>;
}

impl<'a, 'b> graph::GraphSuccessors<'b> for Mir<'a> {
impl<'a, 'b> graph::GraphSuccessors<'b> for Body<'a> {
type Item = BasicBlock;
type Iter = iter::Cloned<Successors<'b>>;
}
Expand Down Expand Up @@ -2968,7 +2968,7 @@ impl Location {
}

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

BraceStructTypeFoldableImpl! {
impl<'tcx> TypeFoldable<'tcx> for Mir<'tcx> {
impl<'tcx> TypeFoldable<'tcx> for Body<'tcx> {
phase,
basic_blocks,
source_scopes,
Expand Down
18 changes: 9 additions & 9 deletions src/librustc/mir/traversal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ use super::*;
/// A preorder traversal of this graph is either `A B D C` or `A C D B`
#[derive(Clone)]
pub struct Preorder<'a, 'tcx: 'a> {
mir: &'a Mir<'tcx>,
mir: &'a Body<'tcx>,
visited: BitSet<BasicBlock>,
worklist: Vec<BasicBlock>,
root_is_start_block: bool,
}

impl<'a, 'tcx> Preorder<'a, 'tcx> {
pub fn new(mir: &'a Mir<'tcx>, root: BasicBlock) -> Preorder<'a, 'tcx> {
pub fn new(mir: &'a Body<'tcx>, root: BasicBlock) -> Preorder<'a, 'tcx> {
let worklist = vec![root];

Preorder {
Expand All @@ -40,7 +40,7 @@ impl<'a, 'tcx> Preorder<'a, 'tcx> {
}
}

pub fn preorder<'a, 'tcx>(mir: &'a Mir<'tcx>) -> Preorder<'a, 'tcx> {
pub fn preorder<'a, 'tcx>(mir: &'a Body<'tcx>) -> Preorder<'a, 'tcx> {
Preorder::new(mir, START_BLOCK)
}

Expand Down Expand Up @@ -99,14 +99,14 @@ impl<'a, 'tcx> Iterator for Preorder<'a, 'tcx> {
///
/// A Postorder traversal of this graph is `D B C A` or `D C B A`
pub struct Postorder<'a, 'tcx: 'a> {
mir: &'a Mir<'tcx>,
mir: &'a Body<'tcx>,
visited: BitSet<BasicBlock>,
visit_stack: Vec<(BasicBlock, Successors<'a>)>,
root_is_start_block: bool,
}

impl<'a, 'tcx> Postorder<'a, 'tcx> {
pub fn new(mir: &'a Mir<'tcx>, root: BasicBlock) -> Postorder<'a, 'tcx> {
pub fn new(mir: &'a Body<'tcx>, root: BasicBlock) -> Postorder<'a, 'tcx> {
let mut po = Postorder {
mir,
visited: BitSet::new_empty(mir.basic_blocks().len()),
Expand Down Expand Up @@ -194,7 +194,7 @@ impl<'a, 'tcx> Postorder<'a, 'tcx> {
}
}

pub fn postorder<'a, 'tcx>(mir: &'a Mir<'tcx>) -> Postorder<'a, 'tcx> {
pub fn postorder<'a, 'tcx>(mir: &'a Body<'tcx>) -> Postorder<'a, 'tcx> {
Postorder::new(mir, START_BLOCK)
}

Expand Down Expand Up @@ -252,13 +252,13 @@ impl<'a, 'tcx> Iterator for Postorder<'a, 'tcx> {
/// to re-use the traversal
#[derive(Clone)]
pub struct ReversePostorder<'a, 'tcx: 'a> {
mir: &'a Mir<'tcx>,
mir: &'a Body<'tcx>,
blocks: Vec<BasicBlock>,
idx: usize
}

impl<'a, 'tcx> ReversePostorder<'a, 'tcx> {
pub fn new(mir: &'a Mir<'tcx>, root: BasicBlock) -> ReversePostorder<'a, 'tcx> {
pub fn new(mir: &'a Body<'tcx>, root: BasicBlock) -> ReversePostorder<'a, 'tcx> {
let blocks : Vec<_> = Postorder::new(mir, root).map(|(bb, _)| bb).collect();

let len = blocks.len();
Expand All @@ -276,7 +276,7 @@ impl<'a, 'tcx> ReversePostorder<'a, 'tcx> {
}


pub fn reverse_postorder<'a, 'tcx>(mir: &'a Mir<'tcx>) -> ReversePostorder<'a, 'tcx> {
pub fn reverse_postorder<'a, 'tcx>(mir: &'a Body<'tcx>) -> ReversePostorder<'a, 'tcx> {
ReversePostorder::new(mir, START_BLOCK)
}

Expand Down
Loading