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

Fixes to mir dataflow #33667

Merged
merged 48 commits into from
May 25, 2016
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
cd81b60
fix bug in `debug!` output from `rustc::middle::dataflow`
pnkfelix Apr 28, 2016
bfe789c
fixes to `librustc_borrowck::bitslice::bits_to_string`, used for grap…
pnkfelix Apr 28, 2016
306ca4c
`rustc_mir::pretty`: factor out scope entry/exit annotation computation.
pnkfelix Apr 28, 2016
90b7a86
`rustc_mir::pretty` refactoring: break `fn write_fn_intro` into two r…
pnkfelix Apr 28, 2016
4446e79
Expose pretty print routines that accept just `mir` (no need for a `N…
pnkfelix Apr 28, 2016
129b371
One-line doc clarification for representation of unit type `()`.
pnkfelix Apr 28, 2016
b4972b0
Add helper method for getting the dataflow results at exit from a bas…
pnkfelix Apr 28, 2016
79ab855
Remove `&self` parameter from `DataflowOperator::initial_value`.
pnkfelix Apr 28, 2016
d03b341
Unit struct defns for 3 dataflow analyses for `borrowck::mir::dataflow`.
pnkfelix Apr 28, 2016
6c72c5f
`borrowck::mir::gather_moves`: create MovePaths for lvalues even if u…
pnkfelix May 2, 2016
c73f351
Revised mir-dataflow.
pnkfelix May 2, 2016
3bb5984
Adding magic `rustc_peek` intrinsic that other code can repurpose to
pnkfelix May 11, 2016
5839e6b
Add ability to unit-test dataflow results via `rustc_peek` intrinsic.
pnkfelix May 11, 2016
8956789
Little unit tests for MIR dataflow analysis.
pnkfelix May 6, 2016
ee44f7e
`DefinitelyInitializedLvals` dataflow op (goal: move away from `Maybe…
pnkfelix May 13, 2016
cd71b0d
core::intrinsics: fix typo noted during review.
pnkfelix May 16, 2016
b0b1f4d
Fix comments in `mir::dataflow::sanity_check`.
pnkfelix May 17, 2016
90a6526
Escape asterix in markdown file to side-step it being interpreted as …
pnkfelix May 17, 2016
8999e87
`mir::dataflow::sanity_check`: removed hackish `tmp = val` propagatio…
pnkfelix May 17, 2016
582f060
markdown fix suggested during review.
pnkfelix May 20, 2016
aaad8a2
`mir::dataflow::sanity_check`: Factor out `fn is_rustc_peek` helper r…
pnkfelix May 20, 2016
9fcbe2a
fix comment in `impl DataflowOperator for MaybeUninitializedLvals`.
pnkfelix May 20, 2016
011c37d
`borrowck::mir`: alpha-renamed DropFlagState variant names.
pnkfelix May 20, 2016
9c468f4
Added comment pointing out somewhat subtle initialization in `fn star…
pnkfelix May 20, 2016
a7e3204
`mir::dataflow` arielb1 review feedback
pnkfelix May 20, 2016
5811950
Review feedback.
pnkfelix May 20, 2016
59008cb
review feedback: fix some index-mismatch bugs pointed out by arielb1.
pnkfelix May 20, 2016
f18bafd
Refactor `bitslice`: distinguish `usize` for indexing vs word type be…
pnkfelix May 20, 2016
0796ee7
add `indexed_set` mod for typed wrappers around bitarrays representin…
pnkfelix May 23, 2016
71af40b
revised mir-dataflow so bitvectors carry a phantom type for their ind…
pnkfelix May 23, 2016
c48650d
bug fix to `borrowck::indexed_set`: wanted bit-count not byte-count.
pnkfelix May 24, 2016
b8c6d1c
Fix comment within sanity_check.
pnkfelix May 24, 2016
ede2958
`mir::dataflow::sanity_check`: extract an `fn each_block` to simplify…
pnkfelix May 24, 2016
ae09c5e
Moved the four impls of `BitDenotation` to their own module, `mod imp…
pnkfelix May 24, 2016
221cce9
move the `tcx` and `mir` parts of associated `Ctxt` onto each `BitDen…
pnkfelix May 24, 2016
0cf5f10
Replaced use of `interpret` method in `mir::dataflow::graphviz` with …
pnkfelix May 24, 2016
fdf80bc
Removed `type Bit` and `fn interpret` items from `trait BitDenotation`.
pnkfelix May 24, 2016
ad1294d
threaded a `ty::ParameterEnvironment` for the current node id via the…
pnkfelix May 24, 2016
a82676e
placate tidy in `mir::dataflow::graphviz`.
pnkfelix May 24, 2016
ac6ea44
placate tidy in `mir::dataflow`.
pnkfelix May 24, 2016
fe49b41
placate tidy in `mir::gather_moves`.
pnkfelix May 24, 2016
4412c7a
placate tidy in compile-fail test.
pnkfelix May 24, 2016
d9680f5
Fix some comments.
pnkfelix May 25, 2016
25f37fd
Add notes that data-structures should potentially move to different c…
pnkfelix May 25, 2016
58f1a49
remove unnecessary use of `indexed_set::Indexed` trait.
pnkfelix May 25, 2016
a28771c
remove `indexed_set::Indexed` trait.
pnkfelix May 25, 2016
ad0e6ad
fixes to `indexed_set`: add comments and fix `PhantomData` def'n.
pnkfelix May 25, 2016
df5c116
Alpha rename `OwnIdxSet` to `IdxSetBuf`.
pnkfelix May 25, 2016
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
10 changes: 10 additions & 0 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,16 @@ extern "rust-intrinsic" {
pub fn atomic_singlethreadfence_rel();
pub fn atomic_singlethreadfence_acqrel();

/// Magic intrinsic that derives its meaning from attributes
/// attached to the function.
///
/// For example, dataflow uses this to inject static assertions so
/// that `rustc_oeek(potentially_uninitialized)` would actually
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: oeek.

/// double-check that dataflow did indeed compute that it is
/// uninitialized at that point in the control flow.
#[cfg(not(stage0))]
pub fn rustc_peek<T>(_: T) -> T;

/// Aborts the execution of the process.
pub fn abort() -> !;

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/dataflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,8 @@ fn set_bit(words: &mut [usize], bit: usize) -> bool {
}

fn bit_str(bit: usize) -> String {
let byte = bit >> 8;
let lobits = 1 << (bit & 0xFF);
let byte = bit >> 3;
let lobits = 1 << (bit & 0b111);
format!("[{}:{}-{:02x}]", bit, byte, lobits)
}

Expand Down
3 changes: 2 additions & 1 deletion src/librustc/mir/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ pub struct UpvarDecl {
/// list of the `Mir`.
///
/// (We use a `u32` internally just to save memory.)
#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord,
RustcEncodable, RustcDecodable)]
pub struct BasicBlock(u32);

impl BasicBlock {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use ty::TyCtxt;
use syntax::ast::NodeId;

/// Where a specific Mir comes from.
#[derive(Copy, Clone)]
#[derive(Debug, Copy, Clone)]
pub enum MirSource {
/// Functions and methods.
Fn(NodeId),
Expand Down
28 changes: 16 additions & 12 deletions src/librustc_borrowck/bitslice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,30 +73,34 @@ fn bit_lookup(bit: usize) -> BitLookup {


fn bit_str(bit: usize) -> String {
let byte = bit >> 8;
let lobits = 1 << (bit & 0xFF);
let byte = bit >> 3;
let lobits = 1 << (bit & 0b111);
format!("[{}:{}-{:02x}]", bit, byte, lobits)
}

pub fn bits_to_string(words: &[usize], bytes: usize) -> String {
pub fn bits_to_string(words: &[usize], bits: usize) -> String {
let mut result = String::new();
let mut sep = '[';

// Note: this is a little endian printout of bytes.

// i tracks how many bits we have printed so far.
let mut i = 0;
for &word in words.iter() {
let mut v = word;
for _ in 0..mem::size_of::<usize>() {
let byte = v & 0xFF;
if i >= bytes {
assert!(byte == 0);
} else {
result.push(sep);
result.push_str(&format!("{:02x}", byte));
}
loop { // for each byte in `v`:
let remain = bits - i;
// If less than a byte remains, then mask just that many bits.
let mask = if remain <= 8 { (1 << remain) - 1 } else { 0xFF };
assert!(mask <= 0xFF);
let byte = v & mask;

result.push(sep);
result.push_str(&format!("{:02x}", byte));

if remain <= 8 { break; }
v >>= 8;
i += 1;
i += 8;
sep = '-';
}
}
Expand Down
Loading