提交 032be94d 编写于 作者: D Dylan MacKenzie

Rename `live_locals` -> `live_locals_at_any_suspension_point`

上级 d0086166
...@@ -467,12 +467,13 @@ fn locals_live_across_suspend_points( ...@@ -467,12 +467,13 @@ fn locals_live_across_suspend_points(
dataflow::ResultsCursor::new(body_ref, &requires_storage_results); dataflow::ResultsCursor::new(body_ref, &requires_storage_results);
// Calculate the liveness of MIR locals ignoring borrows. // Calculate the liveness of MIR locals ignoring borrows.
let mut live_locals = liveness::LiveVarSet::new_empty(body.local_decls.len());
let mut liveness = liveness::liveness_of_locals(body); let mut liveness = liveness::liveness_of_locals(body);
liveness::dump_mir(tcx, "generator_liveness", source, body_ref, &liveness); liveness::dump_mir(tcx, "generator_liveness", source, body_ref, &liveness);
let mut storage_liveness_map = IndexVec::from_elem(None, body.basic_blocks()); let mut storage_liveness_map = IndexVec::from_elem(None, body.basic_blocks());
let mut live_locals_at_suspension_points = Vec::new(); let mut live_locals_at_suspension_points = Vec::new();
let mut live_locals_at_any_suspension_point =
liveness::LiveVarSet::new_empty(body.local_decls.len());
for (block, data) in body.basic_blocks().iter_enumerated() { for (block, data) in body.basic_blocks().iter_enumerated() {
if let TerminatorKind::Yield { .. } = data.terminator().kind { if let TerminatorKind::Yield { .. } = data.terminator().kind {
...@@ -509,39 +510,39 @@ fn locals_live_across_suspend_points( ...@@ -509,39 +510,39 @@ fn locals_live_across_suspend_points(
// Locals live are live at this point only if they are used across // Locals live are live at this point only if they are used across
// suspension points (the `liveness` variable) // suspension points (the `liveness` variable)
// and their storage is required (the `storage_required` variable) // and their storage is required (the `storage_required` variable)
let mut live_locals_here = storage_required; let mut live_locals = storage_required;
live_locals_here.intersect(&liveness.outs[block]); live_locals.intersect(&liveness.outs[block]);
// The generator argument is ignored. // The generator argument is ignored.
live_locals_here.remove(SELF_ARG); live_locals.remove(SELF_ARG);
debug!("loc = {:?}, live_locals_here = {:?}", loc, live_locals_here); debug!("loc = {:?}, live_locals = {:?}", loc, live_locals);
// Add the locals live at this suspension point to the set of locals which live across // Add the locals live at this suspension point to the set of locals which live across
// any suspension points // any suspension points
live_locals.union(&live_locals_here); live_locals_at_any_suspension_point.union(&live_locals);
live_locals_at_suspension_points.push(live_locals_here); live_locals_at_suspension_points.push(live_locals);
} }
} }
debug!("live_locals = {:?}", live_locals); debug!("live_locals_anywhere = {:?}", live_locals_at_any_suspension_point);
// Renumber our liveness_map bitsets to include only the locals we are // Renumber our liveness_map bitsets to include only the locals we are
// saving. // saving.
let live_locals_at_suspension_points = live_locals_at_suspension_points let live_locals_at_suspension_points = live_locals_at_suspension_points
.iter() .iter()
.map(|live_here| renumber_bitset(&live_here, &live_locals)) .map(|live_here| renumber_bitset(&live_here, &live_locals_at_any_suspension_point))
.collect(); .collect();
let storage_conflicts = compute_storage_conflicts( let storage_conflicts = compute_storage_conflicts(
body_ref, body_ref,
&live_locals, &live_locals_at_any_suspension_point,
always_live_locals.clone(), always_live_locals.clone(),
requires_storage_results, requires_storage_results,
); );
LivenessInfo { LivenessInfo {
live_locals, live_locals: live_locals_at_any_suspension_point,
live_locals_at_suspension_points, live_locals_at_suspension_points,
storage_conflicts, storage_conflicts,
storage_liveness: storage_liveness_map, storage_liveness: storage_liveness_map,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册