@@ -1186,17 +1186,17 @@ fn make_generic_glue_inner(cx: @local_ctxt, sp: span, t: ty::t,
1186
1186
1187
1187
let ty_param_count = std:: vec:: len :: < uint > ( ty_params) ;
1188
1188
let lltyparams = llvm:: LLVMGetParam ( llfn, 3 u) ;
1189
- let copy_args_bcx = new_raw_block_ctxt ( fcx, fcx. llcopyargs ) ;
1189
+ let load_env_bcx = new_raw_block_ctxt ( fcx, fcx. llloadenv ) ;
1190
1190
let lltydescs = [ mutable] ;
1191
1191
let p = 0 u;
1192
1192
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) ;
1195
1195
std:: vec:: grow_set ( lltydescs, ty_params[ p] , 0 as ValueRef , llparam) ;
1196
1196
p += 1 u;
1197
1197
}
1198
1198
1199
- // TODO : Implement some kind of freeze operation in the standard library.
1199
+ // FIXME : Implement some kind of freeze operation in the standard library.
1200
1200
let lltydescs_frozen = [ ] ;
1201
1201
for lltydesc: ValueRef in lltydescs { lltydescs_frozen += [ lltydesc] ; }
1202
1202
fcx. lltydescs = lltydescs_frozen;
@@ -2653,7 +2653,7 @@ fn find_environment_tydescs(bcx: @block_ctxt, envty: ty::t, closure: ValueRef)
2653
2653
// with the upvars and type descriptors.
2654
2654
fn load_environment ( enclosing_cx : @block_ctxt , fcx : @fn_ctxt , envty : ty:: t ,
2655
2655
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 ) ;
2657
2657
2658
2658
let ty = ty:: mk_imm_box ( bcx_tcx ( bcx) , envty) ;
2659
2659
@@ -3322,8 +3322,8 @@ fn trans_bind_thunk(cx: @local_ctxt, sp: span, incoming_fty: ty::t,
3322
3322
// Since we might need to construct derived tydescs that depend on
3323
3323
// our bound tydescs, we need to load tydescs out of the environment
3324
3324
// 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 ) ;
3327
3327
3328
3328
// The 'llenv' that will arrive in the thunk we're creating is an
3329
3329
// 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,
3336
3336
// (Issue #586)
3337
3337
check ( type_has_static_size ( ccx, closure_ty) ) ;
3338
3338
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) ;
3340
3340
3341
3341
// "target", in this context, means the function that's having some of its
3342
3342
// 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,
3388
3388
let i: uint = 0 u;
3389
3389
while i < ty_param_count {
3390
3390
// Silly check
3391
- check type_is_tup_like ( copy_args_bcx , closure_ty) ;
3391
+ check type_is_tup_like ( load_env_bcx , closure_ty) ;
3392
3392
let lltyparam_ptr =
3393
- GEP_tup_like ( copy_args_bcx , closure_ty, llclosure,
3393
+ GEP_tup_like ( load_env_bcx , closure_ty, llclosure,
3394
3394
[ 0 , abi:: box_rc_field_body,
3395
3395
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 ) ;
3398
3398
llargs += [ td] ;
3399
3399
fcx. lltydescs += [ td] ;
3400
3400
i += 1 u;
@@ -4972,7 +4972,7 @@ fn mk_standard_basic_blocks(llfn: ValueRef) ->
4972
4972
str:: as_buf ( "static_allocas" ,
4973
4973
{ |buf| llvm:: LLVMAppendBasicBlock ( llfn, buf) } ) ,
4974
4974
ca :
4975
- str:: as_buf ( "copy_args " ,
4975
+ str:: as_buf ( "load_env " ,
4976
4976
{ |buf| llvm:: LLVMAppendBasicBlock ( llfn, buf) } ) ,
4977
4977
dt :
4978
4978
str:: as_buf ( "derived_tydescs" ,
@@ -5001,7 +5001,7 @@ fn new_fn_ctxt_w_id(cx: @local_ctxt, sp: span, llfndecl: ValueRef,
5001
5001
llenv : llvm:: LLVMGetParam ( llfndecl, 2 u) ,
5002
5002
llretptr : llvm:: LLVMGetParam ( llfndecl, 0 u) ,
5003
5003
mutable llstaticallocas : llbbs. sa ,
5004
- mutable llcopyargs : llbbs. ca ,
5004
+ mutable llloadenv : llbbs. ca ,
5005
5005
mutable llderivedtydescs_first : llbbs. dt ,
5006
5006
mutable llderivedtydescs : llbbs. dt ,
5007
5007
mutable lldynamicallocas : llbbs. da ,
@@ -5082,10 +5082,9 @@ fn create_llargs_for_fn_args(cx: @fn_ctxt, proto: ast::proto,
5082
5082
}
5083
5083
}
5084
5084
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 {
5089
5088
let arg_n: uint = 0 u;
5090
5089
for aarg: ast:: arg in args {
5091
5090
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],
5097
5096
// Overwrite the llargs entry for locally mutated params
5098
5097
// with a local alloca.
5099
5098
if mutated {
5100
- let aptr = bcx . fcx . llargs . get ( aarg. id ) ;
5099
+ let aptr = fcx. llargs . get ( aarg. id ) ;
5101
5100
let { bcx: bcx , val : alloc } = alloc_ty ( bcx, arg_ty) ;
5102
5101
bcx =
5103
5102
copy_val ( bcx, INIT , alloc,
5104
5103
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) ;
5107
5106
}
5108
5107
}
5109
5108
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) ;
5111
5110
}
5112
5111
_ { }
5113
5112
}
5114
5113
arg_n += 1 u;
5115
5114
}
5116
- fcx . llcopyargs = llcopyargs . llbb ;
5115
+ ret bcx ;
5117
5116
}
5118
5117
5119
5118
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) {
5170
5169
}
5171
5170
5172
5171
5173
- // Ties up the llstaticallocas -> llcopyargs -> llderivedtydescs ->
5172
+ // Ties up the llstaticallocas -> llloadenv -> llderivedtydescs ->
5174
5173
// lldynamicallocas -> lltop edges, and builds the return block.
5175
5174
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 ) ;
5178
5177
Br ( new_raw_block_ctxt ( fcx, fcx. llderivedtydescs ) , fcx. lldynamicallocas ) ;
5179
5178
Br ( new_raw_block_ctxt ( fcx, fcx. lldynamicallocas ) , lltop) ;
5180
5179
@@ -5210,7 +5209,7 @@ fn trans_closure(bcx_maybe: option::t<@block_ctxt>,
5210
5209
let block_ty = node_id_type ( cx. ccx , f. body . node . id ) ;
5211
5210
5212
5211
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 ) ;
5214
5213
5215
5214
// Figure out if we need to build a closure and act accordingly
5216
5215
let res =
@@ -5362,8 +5361,8 @@ fn trans_tag_variant(cx: @local_ctxt, tag_id: ast::node_id,
5362
5361
}
5363
5362
let arg_tys = arg_tys_of_fn ( cx. ccx , variant. node . id ) ;
5364
5363
let bcx = new_top_block_ctxt ( fcx) ;
5365
- copy_args_to_allocas ( fcx, bcx, fn_args, arg_tys, true ) ;
5366
5364
let lltop = bcx. llbb ;
5365
+ bcx = copy_args_to_allocas ( fcx, bcx, fn_args, arg_tys, true ) ;
5367
5366
5368
5367
// Cast the tag to a type we can GEP into.
5369
5368
let llblobptr =
0 commit comments