Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

Commit

Permalink
copied_blks -> user_blks.
Browse files Browse the repository at this point in the history
  • Loading branch information
vext01 committed Jan 8, 2019
1 parent 0266f08 commit 262d33b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/librustc_mir/transform/add_yk_swt_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use rustc::hir::map::blocks::FnLikeNode;
/// The arguments to the calls (crate hash, DefId and block index) identify the position to be
/// inserted into a trace.
///
/// The transformation works by copying each block and replacing the original with a new block --
/// its "shadow" -- which calls the trace recorder function, before returning to the copy.
/// The transformation works by copying each original "user block" and replacing it with a new
/// block -- its "shadow" -- which calls the trace recorder function, before returning to the copy.
///
/// For example:
///
Expand All @@ -32,8 +32,8 @@ use rustc::hir::map::blocks::FnLikeNode;
/// +----+ +----+ +-----+ +-----+ +----+ +-----+ +-----+ +----+
///
/// Where:
/// * B0 and B1 are blocks in the MIR before transformation.
/// * B0' and B1' are replacements of B0 and B1 respectively.
/// * B0 and B1 are "user blocks" in the MIR before the transformation.
/// * B0' and B1' are "shadow blocks" of B0 and B1 respectively.
/// * B2 and B3 are copies of B0 and B1 respectively.
/// * 'Rec' is the trace recorder function.
/// * The block indices match the indices in the backing vector in the MIR.
Expand All @@ -59,7 +59,7 @@ impl MirPass for AddYkSWTCalls {
let u64_ty = tcx.types.u64;

let mut shadow_blks = Vec::new();
let mut copied_blks = Vec::new();
let mut user_blks = Vec::new(); // Copies of the blocks we started with.
let mut new_local_decls = Vec::new();

let num_orig_local_decls = mir.local_decls.len();
Expand All @@ -68,8 +68,8 @@ impl MirPass for AddYkSWTCalls {
for (bb, bb_data) in mir.basic_blocks().iter_enumerated() {
// Copy the block.
let new_blk = bb_data.clone();
let new_blk_idx = BasicBlock::new(mir.basic_blocks().len() + copied_blks.len());
copied_blks.push(new_blk);
let new_blk_idx = BasicBlock::new(mir.basic_blocks().len() + user_blks.len());
user_blks.push(new_blk);

// Prepare to call the recorder function.
let ret_val = LocalDecl::new_temp(unit_ty, DUMMY_SP);
Expand Down Expand Up @@ -123,7 +123,7 @@ impl MirPass for AddYkSWTCalls {
}

// Finally, commit our transformations.
mir.basic_blocks_mut().extend(copied_blks);
mir.basic_blocks_mut().extend(user_blks);
mir.local_decls.extend(new_local_decls);
for (bb, bb_data) in shadow_blks.drain(..).enumerate() {
mir.basic_blocks_mut()[BasicBlock::new(bb)] = bb_data;
Expand Down

0 comments on commit 262d33b

Please sign in to comment.