Skip to content

Commit 66d44f8

Browse files
committed
---
yaml --- r: 5473 b: refs/heads/master c: 0bbde04 h: refs/heads/master i: 5471: 7effc77 v: v3
1 parent 64f910a commit 66d44f8

File tree

4 files changed

+30
-37
lines changed

4 files changed

+30
-37
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 49813cffb12d00886bfd3d3a1a027deafad49bbd
2+
refs/heads/master: 0bbde048a414bdf6dcdf7e00cc429bf8d8d2a5f0

trunk/src/comp/middle/trans.rs

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,17 +1186,17 @@ fn make_generic_glue_inner(cx: @local_ctxt, sp: span, t: ty::t,
11861186

11871187
let ty_param_count = std::vec::len::<uint>(ty_params);
11881188
let lltyparams = llvm::LLVMGetParam(llfn, 3u);
1189-
let copy_args_bcx = new_raw_block_ctxt(fcx, fcx.llcopyargs);
1189+
let load_env_bcx = new_raw_block_ctxt(fcx, fcx.llloadenv);
11901190
let lltydescs = [mutable];
11911191
let p = 0u;
11921192
while p < ty_param_count {
1193-
let llparam = GEP(copy_args_bcx, lltyparams, [C_int(p as int)]);
1194-
llparam = Load(copy_args_bcx, llparam);
1193+
let llparam = GEP(load_env_bcx, lltyparams, [C_int(p as int)]);
1194+
llparam = Load(load_env_bcx, llparam);
11951195
std::vec::grow_set(lltydescs, ty_params[p], 0 as ValueRef, llparam);
11961196
p += 1u;
11971197
}
11981198

1199-
// TODO: Implement some kind of freeze operation in the standard library.
1199+
// FIXME: Implement some kind of freeze operation in the standard library.
12001200
let lltydescs_frozen = [];
12011201
for lltydesc: ValueRef in lltydescs { lltydescs_frozen += [lltydesc]; }
12021202
fcx.lltydescs = lltydescs_frozen;
@@ -2653,7 +2653,7 @@ fn find_environment_tydescs(bcx: @block_ctxt, envty: ty::t, closure: ValueRef)
26532653
// with the upvars and type descriptors.
26542654
fn load_environment(enclosing_cx: @block_ctxt, fcx: @fn_ctxt, envty: ty::t,
26552655
upvars: @[ast::def], copying: bool) {
2656-
let bcx = new_raw_block_ctxt(fcx, fcx.llcopyargs);
2656+
let bcx = new_raw_block_ctxt(fcx, fcx.llloadenv);
26572657

26582658
let ty = ty::mk_imm_box(bcx_tcx(bcx), envty);
26592659

@@ -3322,8 +3322,8 @@ fn trans_bind_thunk(cx: @local_ctxt, sp: span, incoming_fty: ty::t,
33223322
// Since we might need to construct derived tydescs that depend on
33233323
// our bound tydescs, we need to load tydescs out of the environment
33243324
// before derived tydescs are constructed. To do this, we load them
3325-
// in the copy_args block.
3326-
let copy_args_bcx = new_raw_block_ctxt(fcx, fcx.llcopyargs);
3325+
// in the load_env block.
3326+
let load_env_bcx = new_raw_block_ctxt(fcx, fcx.llloadenv);
33273327

33283328
// The 'llenv' that will arrive in the thunk we're creating is an
33293329
// environment that will contain the values of its arguments and a pointer
@@ -3336,7 +3336,7 @@ fn trans_bind_thunk(cx: @local_ctxt, sp: span, incoming_fty: ty::t,
33363336
// (Issue #586)
33373337
check (type_has_static_size(ccx, closure_ty));
33383338
let llclosure_ptr_ty = type_of(ccx, sp, closure_ty);
3339-
let llclosure = PointerCast(copy_args_bcx, fcx.llenv, llclosure_ptr_ty);
3339+
let llclosure = PointerCast(load_env_bcx, fcx.llenv, llclosure_ptr_ty);
33403340

33413341
// "target", in this context, means the function that's having some of its
33423342
// arguments bound and that will be called inside the thunk we're
@@ -3388,13 +3388,13 @@ fn trans_bind_thunk(cx: @local_ctxt, sp: span, incoming_fty: ty::t,
33883388
let i: uint = 0u;
33893389
while i < ty_param_count {
33903390
// Silly check
3391-
check type_is_tup_like(copy_args_bcx, closure_ty);
3391+
check type_is_tup_like(load_env_bcx, closure_ty);
33923392
let lltyparam_ptr =
3393-
GEP_tup_like(copy_args_bcx, closure_ty, llclosure,
3393+
GEP_tup_like(load_env_bcx, closure_ty, llclosure,
33943394
[0, abi::box_rc_field_body,
33953395
abi::closure_elt_ty_params, i as int]);
3396-
copy_args_bcx = lltyparam_ptr.bcx;
3397-
let td = Load(copy_args_bcx, lltyparam_ptr.val);
3396+
load_env_bcx = lltyparam_ptr.bcx;
3397+
let td = Load(load_env_bcx, lltyparam_ptr.val);
33983398
llargs += [td];
33993399
fcx.lltydescs += [td];
34003400
i += 1u;
@@ -4972,7 +4972,7 @@ fn mk_standard_basic_blocks(llfn: ValueRef) ->
49724972
str::as_buf("static_allocas",
49734973
{|buf| llvm::LLVMAppendBasicBlock(llfn, buf) }),
49744974
ca:
4975-
str::as_buf("copy_args",
4975+
str::as_buf("load_env",
49764976
{|buf| llvm::LLVMAppendBasicBlock(llfn, buf) }),
49774977
dt:
49784978
str::as_buf("derived_tydescs",
@@ -5001,7 +5001,7 @@ fn new_fn_ctxt_w_id(cx: @local_ctxt, sp: span, llfndecl: ValueRef,
50015001
llenv: llvm::LLVMGetParam(llfndecl, 2u),
50025002
llretptr: llvm::LLVMGetParam(llfndecl, 0u),
50035003
mutable llstaticallocas: llbbs.sa,
5004-
mutable llcopyargs: llbbs.ca,
5004+
mutable llloadenv: llbbs.ca,
50055005
mutable llderivedtydescs_first: llbbs.dt,
50065006
mutable llderivedtydescs: llbbs.dt,
50075007
mutable lldynamicallocas: llbbs.da,
@@ -5082,10 +5082,9 @@ fn create_llargs_for_fn_args(cx: @fn_ctxt, proto: ast::proto,
50825082
}
50835083
}
50845084

5085-
fn copy_args_to_allocas(fcx: @fn_ctxt, scope: @block_ctxt, args: [ast::arg],
5086-
arg_tys: [ty::arg], ignore_mut: bool) {
5087-
let llcopyargs = new_raw_block_ctxt(fcx, fcx.llcopyargs);
5088-
let bcx = llcopyargs;
5085+
fn copy_args_to_allocas(fcx: @fn_ctxt, bcx: @block_ctxt, args: [ast::arg],
5086+
arg_tys: [ty::arg], ignore_mut: bool)
5087+
-> @block_ctxt {
50895088
let arg_n: uint = 0u;
50905089
for aarg: ast::arg in args {
50915090
let arg_ty = arg_tys[arg_n].ty;
@@ -5097,23 +5096,23 @@ fn copy_args_to_allocas(fcx: @fn_ctxt, scope: @block_ctxt, args: [ast::arg],
50975096
// Overwrite the llargs entry for locally mutated params
50985097
// with a local alloca.
50995098
if mutated {
5100-
let aptr = bcx.fcx.llargs.get(aarg.id);
5099+
let aptr = fcx.llargs.get(aarg.id);
51015100
let {bcx: bcx, val: alloc} = alloc_ty(bcx, arg_ty);
51025101
bcx =
51035102
copy_val(bcx, INIT, alloc,
51045103
load_if_immediate(bcx, aptr, arg_ty), arg_ty);
5105-
bcx.fcx.llargs.insert(aarg.id, alloc);
5106-
add_clean(scope, alloc, arg_ty);
5104+
fcx.llargs.insert(aarg.id, alloc);
5105+
add_clean(bcx, alloc, arg_ty);
51075106
}
51085107
}
51095108
ast::by_move. {
5110-
add_clean(scope, bcx.fcx.llargs.get(aarg.id), arg_ty);
5109+
add_clean(bcx, fcx.llargs.get(aarg.id), arg_ty);
51115110
}
51125111
_ { }
51135112
}
51145113
arg_n += 1u;
51155114
}
5116-
fcx.llcopyargs = llcopyargs.llbb;
5115+
ret bcx;
51175116
}
51185117

51195118
fn arg_tys_of_fn(ccx: @crate_ctxt, id: ast::node_id) -> [ty::arg] {
@@ -5170,11 +5169,11 @@ fn populate_fn_ctxt_from_llself(fcx: @fn_ctxt, llself: val_self_pair) {
51705169
}
51715170

51725171

5173-
// Ties up the llstaticallocas -> llcopyargs -> llderivedtydescs ->
5172+
// Ties up the llstaticallocas -> llloadenv -> llderivedtydescs ->
51745173
// lldynamicallocas -> lltop edges, and builds the return block.
51755174
fn finish_fn(fcx: @fn_ctxt, lltop: BasicBlockRef) {
5176-
Br(new_raw_block_ctxt(fcx, fcx.llstaticallocas), fcx.llcopyargs);
5177-
Br(new_raw_block_ctxt(fcx, fcx.llcopyargs), fcx.llderivedtydescs_first);
5175+
Br(new_raw_block_ctxt(fcx, fcx.llstaticallocas), fcx.llloadenv);
5176+
Br(new_raw_block_ctxt(fcx, fcx.llloadenv), fcx.llderivedtydescs_first);
51785177
Br(new_raw_block_ctxt(fcx, fcx.llderivedtydescs), fcx.lldynamicallocas);
51795178
Br(new_raw_block_ctxt(fcx, fcx.lldynamicallocas), lltop);
51805179

@@ -5210,7 +5209,7 @@ fn trans_closure(bcx_maybe: option::t<@block_ctxt>,
52105209
let block_ty = node_id_type(cx.ccx, f.body.node.id);
52115210

52125211
let arg_tys = arg_tys_of_fn(fcx.lcx.ccx, id);
5213-
copy_args_to_allocas(fcx, bcx, f.decl.inputs, arg_tys, false);
5212+
bcx = copy_args_to_allocas(fcx, bcx, f.decl.inputs, arg_tys, false);
52145213

52155214
// Figure out if we need to build a closure and act accordingly
52165215
let res =
@@ -5362,8 +5361,8 @@ fn trans_tag_variant(cx: @local_ctxt, tag_id: ast::node_id,
53625361
}
53635362
let arg_tys = arg_tys_of_fn(cx.ccx, variant.node.id);
53645363
let bcx = new_top_block_ctxt(fcx);
5365-
copy_args_to_allocas(fcx, bcx, fn_args, arg_tys, true);
53665364
let lltop = bcx.llbb;
5365+
bcx = copy_args_to_allocas(fcx, bcx, fn_args, arg_tys, true);
53675366

53685367
// Cast the tag to a type we can GEP into.
53695368
let llblobptr =

trunk/src/comp/middle/trans_common.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,6 @@ type fn_ctxt =
183183
// after llderivedtydescs, because these sometimes depend on
184184
// information computed from derived tydescs.
185185

186-
// FIXME: Is llcopyargs actually the block containing the allocas
187-
// for incoming function arguments? Or is it merely the block
188-
// containing code that copies incoming args to space already
189-
// alloca'd by code in llallocas?
190-
191-
192186
// The token used to clear the dynamic allocas at the end of this frame.
193187

194188
// The 'self' object currently in use in this function, if there
@@ -245,7 +239,7 @@ type fn_ctxt =
245239
llenv: ValueRef,
246240
llretptr: ValueRef,
247241
mutable llstaticallocas: BasicBlockRef,
248-
mutable llcopyargs: BasicBlockRef,
242+
mutable llloadenv: BasicBlockRef,
249243
mutable llderivedtydescs_first: BasicBlockRef,
250244
mutable llderivedtydescs: BasicBlockRef,
251245
mutable lldynamicallocas: BasicBlockRef,

trunk/src/comp/middle/trans_objects.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn trans_obj(cx: @local_ctxt, sp: span, ob: ast::_obj, ctor_id: ast::node_id,
5555
ty::ret_ty_of_fn(ccx.tcx, ctor_id), fn_args,
5656
ty_params);
5757
let arg_tys: [ty::arg] = arg_tys_of_fn(ccx, ctor_id);
58-
copy_args_to_allocas(fcx, bcx, fn_args, arg_tys, true);
58+
bcx = copy_args_to_allocas(fcx, bcx, fn_args, arg_tys, true);
5959

6060
// Pick up the type of this object by looking at our own output type, that
6161
// is, the output type of the object constructor we're building.

0 commit comments

Comments
 (0)