Skip to content

Commit a99a75c

Browse files
committed
---
yaml --- r: 147583 b: refs/heads/try2 c: 7b71ca3 h: refs/heads/master i: 147581: 221734a 147579: 806fd2a 147575: e26152c 147567: ae1d187 147551: 10f90f9 147519: 29a5a43 147455: 5fb3c26 v: v3
1 parent 3b9046c commit a99a75c

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
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 2fb33285e6169552e58d10197c11cd2f8702291f
8+
refs/heads/try2: 7b71ca3ef7d30814d72f9e41752c6c24f4168cde
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/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)