@@ -92,10 +92,7 @@ fn type_of_fn(cx: @crate_ctxt, sp: span, proto: ast::proto,
92
92
let out_ty = T_ptr ( type_of_inner ( cx, sp, output) ) ;
93
93
atys += [ ret_ref ? T_ptr ( out_ty) : out_ty] ;
94
94
95
- // Arg 1: task pointer.
96
- atys += [ T_taskptr ( * cx) ] ;
97
-
98
- // Arg 2: Env (closure-bindings / self-obj)
95
+ // Arg 1: Env (closure-bindings / self-obj)
99
96
if is_method {
100
97
atys += [ T_ptr ( cx. rust_object_type ) ] ;
101
98
} else {
@@ -109,7 +106,7 @@ fn type_of_fn(cx: @crate_ctxt, sp: span, proto: ast::proto,
109
106
}
110
107
}
111
108
112
- // Args >3 : ty params, if not acquired via capture...
109
+ // Args >2 : ty params, if not acquired via capture...
113
110
if !is_method {
114
111
let i = 0 u;
115
112
while i < ty_param_count { atys += [ T_ptr ( cx. tydesc_type ) ] ; i += 1 u; }
@@ -349,10 +346,6 @@ fn decl_internal_cdecl_fn(llmod: ModuleRef, name: str, llty: TypeRef) ->
349
346
ret llfn;
350
347
}
351
348
352
- fn decl_glue ( llmod : ModuleRef , cx : crate_ctxt , s : str ) -> ValueRef {
353
- ret decl_cdecl_fn ( llmod, s, T_fn ( [ T_taskptr ( cx) ] , T_void ( ) ) ) ;
354
- }
355
-
356
349
fn get_extern_fn ( externs : hashmap < str , ValueRef > , llmod : ModuleRef , name : str ,
357
350
cc : uint , ty : TypeRef ) -> ValueRef {
358
351
if externs. contains_key ( name) { ret externs. get ( name) ; }
@@ -1217,7 +1210,7 @@ fn make_generic_glue_inner(cx: @local_ctxt, sp: span, t: ty::t,
1217
1210
} else { T_ptr ( T_i8 ( ) ) } ;
1218
1211
1219
1212
let ty_param_count = std:: vec:: len :: < uint > ( ty_params) ;
1220
- let lltyparams = llvm:: LLVMGetParam ( llfn, 3 u ) ;
1213
+ let lltyparams = llvm:: LLVMGetParam ( llfn, 2 u ) ;
1221
1214
let load_env_bcx = new_raw_block_ctxt ( fcx, fcx. llloadenv ) ;
1222
1215
let lltydescs = [ mutable] ;
1223
1216
let p = 0 u;
@@ -1235,12 +1228,12 @@ fn make_generic_glue_inner(cx: @local_ctxt, sp: span, t: ty::t,
1235
1228
1236
1229
let bcx = new_top_block_ctxt ( fcx) ;
1237
1230
let lltop = bcx. llbb ;
1238
- let llrawptr0 = llvm:: LLVMGetParam ( llfn, 4 u ) ;
1231
+ let llrawptr0 = llvm:: LLVMGetParam ( llfn, 3 u ) ;
1239
1232
let llval0 = BitCast ( bcx, llrawptr0, llty) ;
1240
1233
alt helper {
1241
1234
default_helper( helper) { helper ( bcx, llval0, t) ; }
1242
1235
copy_helper ( helper) {
1243
- let llrawptr1 = llvm:: LLVMGetParam ( llfn, 5 u ) ;
1236
+ let llrawptr1 = llvm:: LLVMGetParam ( llfn, 4 u ) ;
1244
1237
let llval1 = BitCast ( bcx, llrawptr1, llty) ;
1245
1238
helper ( bcx, llval0, llval1, t) ;
1246
1239
}
@@ -1463,7 +1456,7 @@ fn trans_res_drop(cx: @block_ctxt, rs: ValueRef, did: ast::def_id,
1463
1456
cx = val. bcx ;
1464
1457
// Find and call the actual destructor.
1465
1458
let dtor_addr = trans_common:: get_res_dtor ( ccx, cx. sp , did, inner_t) ;
1466
- let args = [ cx. fcx . llretptr , cx . fcx . lltaskptr , null_env_ptr ( cx) ] ;
1459
+ let args = [ cx. fcx . llretptr , null_env_ptr ( cx) ] ;
1467
1460
for tp: ty:: t in tps {
1468
1461
let ti: option:: t < @tydesc_info > = none;
1469
1462
let td = get_tydesc ( cx, tp, false , tps_normal, ti) . result ;
@@ -1888,9 +1881,8 @@ fn call_tydesc_glue_full(cx: @block_ctxt, v: ValueRef, tydesc: ValueRef,
1888
1881
some ( sgf) { llfn = sgf; }
1889
1882
}
1890
1883
1891
- Call ( cx, llfn,
1892
- [ C_null ( T_ptr ( T_nil ( ) ) ) , cx. fcx . lltaskptr , C_null ( T_ptr ( T_nil ( ) ) ) ,
1893
- lltydescs, llrawptr] ) ;
1884
+ Call ( cx, llfn, [ C_null ( T_ptr ( T_nil ( ) ) ) , C_null ( T_ptr ( T_nil ( ) ) ) ,
1885
+ lltydescs, llrawptr] ) ;
1894
1886
}
1895
1887
1896
1888
fn call_tydesc_glue ( cx : @block_ctxt , v : ValueRef , t : ty:: t , field : int ) ->
@@ -1937,7 +1929,7 @@ fn call_cmp_glue(cx: @block_ctxt, lhs: ValueRef, rhs: ValueRef, t: ty::t,
1937
1929
}
1938
1930
1939
1931
let llcmpresultptr = alloca ( bcx, T_i1 ( ) ) ;
1940
- Call ( bcx, llfn, [ llcmpresultptr, bcx . fcx . lltaskptr , lltydesc, lltydescs,
1932
+ Call ( bcx, llfn, [ llcmpresultptr, lltydesc, lltydescs,
1941
1933
llrawlhsptr, llrawrhsptr, llop] ) ;
1942
1934
ret rslt( bcx, Load ( bcx, llcmpresultptr) ) ;
1943
1935
}
@@ -2921,7 +2913,7 @@ fn trans_for_each(cx: @block_ctxt, local: @ast::local, seq: @ast::expr,
2921
2913
let bcx = new_top_block_ctxt ( fcx) ;
2922
2914
// Add bindings for the loop variable alias.
2923
2915
bcx = trans_alt:: bind_irrefutable_pat ( bcx, local. node . pat ,
2924
- llvm:: LLVMGetParam ( fcx. llfn , 3 u ) ,
2916
+ llvm:: LLVMGetParam ( fcx. llfn , 2 u ) ,
2925
2917
false ) ;
2926
2918
let lltop = bcx. llbb ;
2927
2919
bcx = trans_block ( bcx, body) ;
@@ -3560,10 +3552,10 @@ fn trans_bind_thunk(cx: @local_ctxt, sp: span, incoming_fty: ty::t,
3560
3552
let llargs: [ ValueRef ] = alt ty:: ty_fn_proto ( ccx. tcx , outgoing_fty) {
3561
3553
ast:: proto_bare. {
3562
3554
// Bare functions don't take an environment
3563
- [ llretptr, fcx . lltaskptr ]
3555
+ [ llretptr]
3564
3556
}
3565
3557
_ {
3566
- [ llretptr, fcx . lltaskptr , lltargetenv]
3558
+ [ llretptr, lltargetenv]
3567
3559
}
3568
3560
} ;
3569
3561
@@ -3583,7 +3575,7 @@ fn trans_bind_thunk(cx: @local_ctxt, sp: span, incoming_fty: ty::t,
3583
3575
i += 1 u;
3584
3576
}
3585
3577
3586
- let a: uint = 3 u ; // retptr, task ptr , env come first
3578
+ let a: uint = 2 u ; // retptr, env come first
3587
3579
let b: int = starting_idx;
3588
3580
let outgoing_arg_index: uint = 0 u;
3589
3581
let llout_arg_tys: [ TypeRef ] =
@@ -3847,18 +3839,15 @@ fn trans_args(cx: @block_ctxt, outer_cx: @block_ctxt, llenv: ValueRef,
3847
3839
llargs += [ PointerCast ( cx, llretslot, llretty) ] ;
3848
3840
} else { llargs += [ llretslot] ; }
3849
3841
3850
- // Arg 1: task pointer.
3851
- llargs += [ bcx. fcx . lltaskptr ] ;
3852
-
3853
- // Arg 2: Env (closure-bindings / self-obj)
3842
+ // Arg 1: Env (closure-bindings / self-obj)
3854
3843
alt ty:: ty_fn_proto ( tcx, fn_ty) {
3855
3844
ast:: proto_bare. { }
3856
3845
_ {
3857
3846
llargs += [ llenv] ;
3858
3847
}
3859
3848
}
3860
3849
3861
- // Args >3 : ty_params ...
3850
+ // Args >2 : ty_params ...
3862
3851
llargs += lltydescs;
3863
3852
3864
3853
// ... then possibly an lliterbody argument.
@@ -4639,7 +4628,7 @@ fn trans_put(in_cx: @block_ctxt, e: option::t<@ast::expr>) -> @block_ctxt {
4639
4628
}
4640
4629
let bcx = cx;
4641
4630
let dummy_retslot = alloca ( bcx, T_nil ( ) ) ;
4642
- let llargs: [ ValueRef ] = [ dummy_retslot, cx . fcx . lltaskptr , llenv] ;
4631
+ let llargs: [ ValueRef ] = [ dummy_retslot, llenv] ;
4643
4632
alt e {
4644
4633
none. {
4645
4634
llargs += [ C_null ( T_ptr ( T_nil ( ) ) ) ] ;
@@ -5110,8 +5099,7 @@ fn new_fn_ctxt_w_id(cx: @local_ctxt, sp: span, llfndecl: ValueRef,
5110
5099
let llbbs = mk_standard_basic_blocks ( llfndecl) ;
5111
5100
// FIXME: llenv is not correct for bare functions
5112
5101
ret @{ llfn : llfndecl,
5113
- lltaskptr : llvm:: LLVMGetParam ( llfndecl, 1 u) ,
5114
- llenv : llvm:: LLVMGetParam ( llfndecl, 2 u) ,
5102
+ llenv : llvm:: LLVMGetParam ( llfndecl, 1 u) ,
5115
5103
llretptr : llvm:: LLVMGetParam ( llfndecl, 0 u) ,
5116
5104
mutable llstaticallocas : llbbs. sa ,
5117
5105
mutable llloadenv : llbbs. ca ,
@@ -5141,8 +5129,8 @@ fn new_fn_ctxt(cx: @local_ctxt, sp: span, llfndecl: ValueRef) -> @fn_ctxt {
5141
5129
5142
5130
fn implicit_args_for_fn ( proto : ast:: proto ) -> uint {
5143
5131
alt proto {
5144
- ast : : proto_bare. { 2 u }
5145
- _ { 3 u }
5132
+ ast : : proto_bare. { 1 u }
5133
+ _ { 2 u }
5146
5134
}
5147
5135
}
5148
5136
@@ -5666,10 +5654,9 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
5666
5654
let lltop = bcx. llbb ;
5667
5655
5668
5656
let lloutputarg = llvm:: LLVMGetParam ( llfdecl, 0 u) ;
5669
- let lltaskarg = llvm:: LLVMGetParam ( llfdecl, 1 u) ;
5670
- let llenvarg = llvm:: LLVMGetParam ( llfdecl, 2 u) ;
5671
- let args = [ lloutputarg, lltaskarg, llenvarg] ;
5672
- if takes_argv { args += [ llvm:: LLVMGetParam ( llfdecl, 3 u) ] ; }
5657
+ let llenvarg = llvm:: LLVMGetParam ( llfdecl, 1 u) ;
5658
+ let args = [ lloutputarg, llenvarg] ;
5659
+ if takes_argv { args += [ llvm:: LLVMGetParam ( llfdecl, 2 u) ] ; }
5673
5660
Call ( bcx, main_llfn, args) ;
5674
5661
build_return ( bcx) ;
5675
5662
@@ -5825,16 +5812,11 @@ fn register_native_fn(ccx: @crate_ctxt, sp: span, path: [str], name: str,
5825
5812
let rty = ty:: ty_fn_ret ( ccx. tcx , fn_type) ;
5826
5813
let rty_is_nil = ty:: type_is_nil ( ccx. tcx , rty) ;
5827
5814
5828
- let lltaskptr;
5829
- if cast_to_i32 {
5830
- lltaskptr = vp2i ( bcx, fcx. lltaskptr ) ;
5831
- } else { lltaskptr = fcx. lltaskptr ; }
5832
-
5833
5815
let call_args: [ ValueRef ] = [ ] ;
5834
- if pass_task { call_args += [ lltaskptr ] ; }
5816
+ if pass_task { call_args += [ C_null ( T_ptr ( ccx . task_type ) ) ] ; }
5835
5817
if uses_retptr { call_args += [ bcx. fcx . llretptr ] ; }
5836
5818
5837
- let arg_n = 3 u ;
5819
+ let arg_n = 2 u ;
5838
5820
for each i: uint in uint:: range ( 0 u, num_ty_param) {
5839
5821
let llarg = llvm:: LLVMGetParam ( fcx. llfn , arg_n) ;
5840
5822
fcx. lltydescs += [ llarg] ;
@@ -6144,11 +6126,6 @@ fn trap(bcx: @block_ctxt) {
6144
6126
}
6145
6127
}
6146
6128
6147
- fn decl_no_op_type_glue ( llmod : ModuleRef , taskptr_type : TypeRef ) -> ValueRef {
6148
- let ty = T_fn ( [ taskptr_type, T_ptr ( T_i8 ( ) ) ] , T_void ( ) ) ;
6149
- ret decl_cdecl_fn ( llmod, abi:: no_op_type_glue_name ( ) , ty) ;
6150
- }
6151
-
6152
6129
fn create_module_map ( ccx : @crate_ctxt ) -> ValueRef {
6153
6130
let elttype = T_struct ( [ T_int ( ) , T_int ( ) ] ) ;
6154
6131
let maptype = T_array ( elttype, ccx. module_data . size ( ) + 1 u) ;
@@ -6255,9 +6232,7 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
6255
6232
let tn = mk_type_names ( ) ;
6256
6233
let intrinsics = declare_intrinsics ( llmod) ;
6257
6234
let task_type = T_task ( ) ;
6258
- let taskptr_type = T_ptr ( task_type) ;
6259
- tn. associate ( "taskptr" , taskptr_type) ;
6260
- let tydesc_type = T_tydesc ( taskptr_type) ;
6235
+ let tydesc_type = T_tydesc ( ) ;
6261
6236
tn. associate ( "tydesc" , tydesc_type) ;
6262
6237
let hasher = ty:: hash_ty;
6263
6238
let eqer = ty:: eq_ty;
@@ -6302,7 +6277,7 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
6302
6277
mutable n_real_glues : 0 u,
6303
6278
fn_times : @mutable [ ] } ,
6304
6279
upcalls:
6305
- upcall:: declare_upcalls ( tn, tydesc_type, taskptr_type , llmod) ,
6280
+ upcall:: declare_upcalls ( tn, tydesc_type, llmod) ,
6306
6281
rust_object_type: T_rust_object ( ) ,
6307
6282
tydesc_type: tydesc_type,
6308
6283
task_type: task_type,
0 commit comments