Skip to content

Commit 221734a

Browse files
committed
---
yaml --- r: 147581 b: refs/heads/try2 c: 82f5a38 h: refs/heads/master i: 147579: 806fd2a v: v3
1 parent 87d4d82 commit 221734a

File tree

6 files changed

+57
-32
lines changed

6 files changed

+57
-32
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: a5f4a40f24109f94b4c1e568bf312105f07b1734
8+
refs/heads/try2: 82f5a380a48262e10e2d7c53e679351c5aedbf5a
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/trans/_match.rs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,8 +1358,6 @@ fn insert_lllocals(bcx: @Block,
13581358
* the bindings.
13591359
*/
13601360

1361-
let llmap = bcx.fcx.lllocals;
1362-
13631361
for (&ident, &binding_info) in bindings_map.iter() {
13641362
let llval = match binding_info.trmode {
13651363
// By value bindings: use the stack slot that we
@@ -1378,8 +1376,13 @@ fn insert_lllocals(bcx: @Block,
13781376
}
13791377
};
13801378

1381-
debug!("binding {:?} to {}", binding_info.id, bcx.val_to_str(llval));
1382-
llmap.insert(binding_info.id, llval);
1379+
{
1380+
debug!("binding {:?} to {}",
1381+
binding_info.id,
1382+
bcx.val_to_str(llval));
1383+
let mut llmap = bcx.fcx.lllocals.borrow_mut();
1384+
llmap.get().insert(binding_info.id, llval);
1385+
}
13831386

13841387
if bcx.sess().opts.extra_debuginfo {
13851388
debuginfo::create_match_binding_metadata(bcx,
@@ -1442,7 +1445,8 @@ fn compile_guard(bcx: @Block,
14421445
}
14431446
TrByRef => {}
14441447
}
1445-
bcx.fcx.lllocals.remove(&binding_info.id);
1448+
let mut lllocals = bcx.fcx.lllocals.borrow_mut();
1449+
lllocals.get().remove(&binding_info.id);
14461450
}
14471451
return bcx;
14481452
}
@@ -2057,7 +2061,8 @@ pub fn store_arg(mut bcx: @Block,
20572061
// Optimized path for `x: T` case. This just adopts
20582062
// `llval` wholesale as the pointer for `x`, avoiding the
20592063
// general logic which may copy out of `llval`.
2060-
bcx.fcx.llargs.insert(pat.id, llval);
2064+
let mut llargs = bcx.fcx.llargs.borrow_mut();
2065+
llargs.get().insert(pat.id, llval);
20612066
} else {
20622067
// General path. Copy out the values that are used in the
20632068
// pattern.
@@ -2077,11 +2082,11 @@ fn mk_binding_alloca(mut bcx: @Block,
20772082
let ident = ast_util::path_to_ident(path);
20782083
let llval = alloc_ty(bcx, var_ty, bcx.ident(ident));
20792084
bcx = populate(bcx, var_ty, llval);
2080-
let llmap = match binding_mode {
2081-
BindLocal => bcx.fcx.lllocals,
2082-
BindArgument => bcx.fcx.llargs
2085+
let mut llmap = match binding_mode {
2086+
BindLocal => bcx.fcx.lllocals.borrow_mut(),
2087+
BindArgument => bcx.fcx.llargs.borrow_mut(),
20832088
};
2084-
llmap.insert(p_id, llval);
2089+
llmap.get().insert(p_id, llval);
20852090
add_clean(bcx, llval, var_ty);
20862091
return bcx;
20872092
}

branches/try2/src/librustc/middle/trans/base.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,8 +1692,8 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
16921692
llself: None,
16931693
personality: None,
16941694
caller_expects_out_pointer: uses_outptr,
1695-
llargs: @mut HashMap::new(),
1696-
lllocals: @mut HashMap::new(),
1695+
llargs: RefCell::new(HashMap::new()),
1696+
lllocals: RefCell::new(HashMap::new()),
16971697
llupvars: RefCell::new(HashMap::new()),
16981698
id: id,
16991699
param_substs: param_substs,
@@ -2146,7 +2146,10 @@ pub fn trans_enum_variant_or_tuple_like_struct<A:IdAndTy>(
21462146
fcx.llretptr.unwrap(),
21472147
disr,
21482148
i);
2149-
let llarg = fcx.llargs.get_copy(&fn_arg.pat.id);
2149+
let llarg = {
2150+
let llargs = fcx.llargs.borrow();
2151+
llargs.get().get_copy(&fn_arg.pat.id)
2152+
};
21502153
let arg_ty = arg_tys[i];
21512154
memcpy_ty(bcx, lldestptr, llarg, arg_ty);
21522155
}

branches/try2/src/librustc/middle/trans/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,10 @@ pub struct FunctionContext {
240240
caller_expects_out_pointer: bool,
241241

242242
// Maps arguments to allocas created for them in llallocas.
243-
llargs: @mut HashMap<ast::NodeId, ValueRef>,
243+
llargs: RefCell<HashMap<ast::NodeId, ValueRef>>,
244244
// Maps the def_ids for local variables to the allocas created for
245245
// them in llallocas.
246-
lllocals: @mut HashMap<ast::NodeId, ValueRef>,
246+
lllocals: RefCell<HashMap<ast::NodeId, ValueRef>>,
247247
// Same as above, but for closure upvars
248248
llupvars: RefCell<HashMap<ast::NodeId, ValueRef>>,
249249

branches/try2/src/librustc/middle/trans/debuginfo.rs

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,15 @@ pub fn create_local_var_metadata(bcx: @Block,
298298
let var_ident = ast_util::path_to_ident(path_ref);
299299
let var_type = node_id_type(bcx, node_id);
300300

301-
let llptr = match bcx.fcx.lllocals.find_copy(&node_id) {
302-
Some(v) => v,
303-
None => {
304-
bcx.tcx().sess.span_bug(span,
305-
format!("No entry in lllocals table for {:?}", node_id));
301+
let llptr = {
302+
let lllocals = bcx.fcx.lllocals.borrow();
303+
match lllocals.get().find_copy(&node_id) {
304+
Some(v) => v,
305+
None => {
306+
bcx.tcx().sess.span_bug(span,
307+
format!("No entry in lllocals table for {:?}",
308+
node_id));
309+
}
306310
}
307311
};
308312

@@ -397,10 +401,17 @@ pub fn create_match_binding_metadata(bcx: @Block,
397401
return;
398402
}
399403

400-
let llptr = match bcx.fcx.lllocals.find_copy(&node_id) {
401-
Some(v) => v,
402-
None => {
403-
bcx.tcx().sess.span_bug(span, format!("No entry in lllocals table for {:?}", node_id));
404+
let llptr = {
405+
let lllocals = bcx.fcx.lllocals.borrow();
406+
match lllocals.get().find_copy(&node_id) {
407+
Some(v) => v,
408+
None => {
409+
bcx.tcx()
410+
.sess
411+
.span_bug(span,
412+
format!("No entry in lllocals table for {:?}",
413+
node_id));
414+
}
404415
}
405416
};
406417

@@ -506,11 +517,15 @@ pub fn create_argument_metadata(bcx: @Block,
506517
let scope_metadata = bcx.fcx.debug_context.get_ref(cx, arg.pat.span).fn_metadata;
507518

508519
pat_util::pat_bindings(def_map, arg.pat, |_, node_id, span, path_ref| {
509-
let llptr = match bcx.fcx.llargs.find_copy(&node_id) {
510-
Some(v) => v,
511-
None => {
512-
bcx.tcx().sess.span_bug(span,
513-
format!("No entry in llargs table for {:?}", node_id));
520+
let llptr = {
521+
let llargs = bcx.fcx.llargs.borrow();
522+
match llargs.get().find_copy(&node_id) {
523+
Some(v) => v,
524+
None => {
525+
bcx.tcx().sess.span_bug(span,
526+
format!("No entry in llargs table for {:?}",
527+
node_id));
528+
}
514529
}
515530
};
516531

branches/try2/src/librustc/middle/trans/expr.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,10 +1100,12 @@ pub fn trans_local_var(bcx: @Block, def: ast::Def) -> Datum {
11001100
}
11011101
}
11021102
ast::DefArg(nid, _) => {
1103-
take_local(bcx, bcx.fcx.llargs, nid)
1103+
let llargs = bcx.fcx.llargs.borrow();
1104+
take_local(bcx, llargs.get(), nid)
11041105
}
11051106
ast::DefLocal(nid, _) | ast::DefBinding(nid, _) => {
1106-
take_local(bcx, bcx.fcx.lllocals, nid)
1107+
let lllocals = bcx.fcx.lllocals.borrow();
1108+
take_local(bcx, lllocals.get(), nid)
11071109
}
11081110
ast::DefSelf(nid, _) => {
11091111
let self_info: ValSelfData = match bcx.fcx.llself {

0 commit comments

Comments
 (0)