Skip to content

Commit 84fe11e

Browse files
committed
---
yaml --- r: 88967 b: refs/heads/snap-stage3 c: 7b71ca3 h: refs/heads/master i: 88965: 1c6f370 88963: 941c65f 88959: fa97590 v: v3
1 parent 68f617c commit 84fe11e

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: deeca5d586bfaa4aa60246f671a8d611d38f6248
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 2fb33285e6169552e58d10197c11cd2f8702291f
4+
refs/heads/snap-stage3: 7b71ca3ef7d30814d72f9e41752c6c24f4168cde
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/liveness.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ use middle::typeck;
110110
use middle::moves;
111111

112112
use std::cast::transmute;
113+
use std::cell::RefCell;
113114
use std::hashmap::HashMap;
114115
use std::io;
115116
use std::str;
@@ -577,7 +578,7 @@ static ACC_READ: uint = 1u;
577578
static ACC_WRITE: uint = 2u;
578579
static ACC_USE: uint = 4u;
579580

580-
type LiveNodeMap = @mut HashMap<NodeId, LiveNode>;
581+
type LiveNodeMap = @RefCell<HashMap<NodeId, LiveNode>>;
581582

582583
pub struct Liveness {
583584
tcx: ty::ctxt,
@@ -604,8 +605,8 @@ fn Liveness(ir: @mut IrMaps, specials: Specials) -> Liveness {
604605
users: @mut vec::from_elem(ir.num_live_nodes * ir.num_vars,
605606
invalid_users()),
606607
loop_scope: @mut ~[],
607-
break_ln: @mut HashMap::new(),
608-
cont_ln: @mut HashMap::new()
608+
break_ln: @RefCell::new(HashMap::new()),
609+
cont_ln: @RefCell::new(HashMap::new()),
609610
}
610611
}
611612

@@ -1091,7 +1092,8 @@ impl Liveness {
10911092
// Now that we know the label we're going to,
10921093
// look it up in the break loop nodes table
10931094

1094-
match self.break_ln.find(&sc) {
1095+
let break_ln = self.break_ln.borrow();
1096+
match break_ln.get().find(&sc) {
10951097
Some(&b) => b,
10961098
None => self.tcx.sess.span_bug(expr.span,
10971099
"Break to unknown label")
@@ -1105,7 +1107,8 @@ impl Liveness {
11051107
// Now that we know the label we're going to,
11061108
// look it up in the continue loop nodes table
11071109

1108-
match self.cont_ln.find(&sc) {
1110+
let cont_ln = self.cont_ln.borrow();
1111+
match cont_ln.get().find(&sc) {
11091112
Some(&b) => b,
11101113
None => self.tcx.sess.span_bug(expr.span,
11111114
"Loop to unknown label")
@@ -1383,8 +1386,12 @@ impl Liveness {
13831386
-> R {
13841387
debug!("with_loop_nodes: {} {}", loop_node_id, *break_ln);
13851388
self.loop_scope.push(loop_node_id);
1386-
self.break_ln.insert(loop_node_id, break_ln);
1387-
self.cont_ln.insert(loop_node_id, cont_ln);
1389+
{
1390+
let mut this_break_ln = self.break_ln.borrow_mut();
1391+
let mut this_cont_ln = self.cont_ln.borrow_mut();
1392+
this_break_ln.get().insert(loop_node_id, break_ln);
1393+
this_cont_ln.get().insert(loop_node_id, cont_ln);
1394+
}
13881395
let r = f();
13891396
self.loop_scope.pop();
13901397
r

0 commit comments

Comments
 (0)