@@ -1228,7 +1228,7 @@ fn dynamic_size_of(@block_ctxt cx, ty.t t) -> result {
1228
1228
auto elt_size = size_of( bcx, e) ;
1229
1229
bcx = elt_size. bcx;
1230
1230
auto aligned_off = align_to( bcx, off, elt_align. val) ;
1231
- off = bcx . build. Add ( aligned_off, elt_size. val) ;
1231
+ off = cx . build. Add ( aligned_off, elt_size. val) ;
1232
1232
max_align = umax( bcx, max_align, elt_align. val) ;
1233
1233
}
1234
1234
off = align_to( bcx, off, max_align) ;
@@ -1488,7 +1488,7 @@ fn trans_raw_malloc(@block_ctxt cx, TypeRef llptr_ty, ValueRef llsize)
1488
1488
// FIXME: need a table to collect tydesc globals.
1489
1489
auto tydesc = C_int ( 0 ) ;
1490
1490
auto rslt = trans_upcall( cx, "upcall_malloc" , vec( llsize, tydesc) ) ;
1491
- rslt = res( rslt. bcx, vi2p( rslt . bcx , rslt. val, llptr_ty) ) ;
1491
+ rslt = res( rslt. bcx, vi2p( cx , rslt. val, llptr_ty) ) ;
1492
1492
ret rslt;
1493
1493
}
1494
1494
@@ -1949,8 +1949,6 @@ fn make_drop_glue(@block_ctxt cx, ValueRef v0, ty.t t) {
1949
1949
ty. type_is_native ( cx. fcx . lcx . ccx . tcx , t) ||
1950
1950
ty. type_is_nil ( cx. fcx . lcx . ccx . tcx , t) ) {
1951
1951
rslt = res ( cx, C_nil ( ) ) ;
1952
- } else {
1953
- rslt = res ( cx, C_nil ( ) ) ;
1954
1952
}
1955
1953
}
1956
1954
}
@@ -2358,7 +2356,7 @@ fn iter_structural_ty_full(@block_ctxt cx,
2358
2356
2359
2357
auto r = f ( inner_cx, box_a_ptr, box_b_ptr, tbox) ;
2360
2358
r. bcx . build . Br ( next_cx. llbb ) ;
2361
- ret res ( next_cx, C_nil ( ) ) ;
2359
+ ret res ( next_cx, r . val ) ;
2362
2360
}
2363
2361
2364
2362
alt ( ty. struct ( cx. fcx . lcx . ccx . tcx , t) ) {
@@ -2628,7 +2626,7 @@ fn iter_sequence(@block_ctxt cx,
2628
2626
auto p1 = vi2p( bcx, bcx. build. Add ( vp2i( bcx, p0) , len) ,
2629
2627
T_ptr ( llunit_ty) ) ;
2630
2628
2631
- ret iter_sequence_inner( bcx , p0, p1, elt_ty, f) ;
2629
+ ret iter_sequence_inner( cx , p0, p1, elt_ty, f) ;
2632
2630
}
2633
2631
2634
2632
alt ( ty. struct ( cx. fcx. lcx. ccx. tcx, t) ) {
@@ -2662,13 +2660,11 @@ fn call_tydesc_glue_full(@block_ctxt cx, ValueRef v,
2662
2660
llrawptr) ) ;
2663
2661
}
2664
2662
2665
- fn call_tydesc_glue( @block_ctxt cx, ValueRef v,
2666
- ty. t t, int field) -> result {
2663
+ fn call_tydesc_glue( @block_ctxt cx, ValueRef v, ty. t t, int field) {
2667
2664
auto td = get_tydesc( cx, t) ;
2668
2665
call_tydesc_glue_full( td. bcx,
2669
2666
spill_if_immediate( td. bcx, v, t) ,
2670
2667
td. val, field) ;
2671
- ret res( td. bcx, C_nil ( ) ) ;
2672
2668
}
2673
2669
2674
2670
fn call_cmp_glue( @block_ctxt cx, ValueRef lhs, ValueRef rhs, ty. t t,
@@ -2709,7 +2705,7 @@ fn call_cmp_glue(@block_ctxt cx, ValueRef lhs, ValueRef rhs, ty.t t,
2709
2705
2710
2706
fn take_ty( @block_ctxt cx, ValueRef v, ty. t t) -> result {
2711
2707
if ( !ty. type_is_scalar( cx. fcx. lcx. ccx. tcx, t) ) {
2712
- ret call_tydesc_glue( cx, v, t, abi. tydesc_field_take_glue) ;
2708
+ call_tydesc_glue( cx, v, t, abi. tydesc_field_take_glue) ;
2713
2709
}
2714
2710
ret res( cx, C_nil ( ) ) ;
2715
2711
}
@@ -2731,7 +2727,7 @@ fn drop_ty(@block_ctxt cx,
2731
2727
ty. t t) -> result {
2732
2728
2733
2729
if ( !ty. type_is_scalar( cx. fcx. lcx. ccx. tcx, t) ) {
2734
- ret call_tydesc_glue( cx, v, t, abi. tydesc_field_drop_glue) ;
2730
+ call_tydesc_glue( cx, v, t, abi. tydesc_field_drop_glue) ;
2735
2731
}
2736
2732
ret res( cx, C_nil ( ) ) ;
2737
2733
}
@@ -3533,7 +3529,7 @@ fn trans_for_each(@block_ctxt cx,
3533
3529
auto lltydescsptr = cx. build. GEP ( llenvptr,
3534
3530
vec( C_int ( 0 ) ,
3535
3531
C_int ( abi. box_rc_field_body) ,
3536
- C_int ( abi . closure_elt_ty_params ) ) ) ;
3532
+ C_int ( 3 ) ) ) ;
3537
3533
auto i = 0 u;
3538
3534
while ( i < tydesc_count) {
3539
3535
auto lltydescptr = cx. build. GEP ( lltydescsptr,
@@ -3567,10 +3563,8 @@ fn trans_for_each(@block_ctxt cx,
3567
3563
3568
3564
// Populate the upvars from the environment.
3569
3565
auto llremoteenvptr = bcx. build. PointerCast ( fcx. llenv, llenvptrty) ;
3570
- auto llremotebindingsptrptr =
3571
- bcx. build. GEP ( llremoteenvptr, vec( C_int ( 0 ) ,
3572
- C_int ( abi. box_rc_field_body) ,
3573
- C_int ( abi. closure_elt_bindings) ) ) ;
3566
+ auto llremotebindingsptrptr = bcx. build. GEP ( llremoteenvptr,
3567
+ vec( C_int ( 0 ) , C_int ( abi. box_rc_field_body) , C_int ( 2 ) ) ) ;
3574
3568
auto llremotebindingsptr = bcx. build. Load ( llremotebindingsptrptr) ;
3575
3569
3576
3570
i = 0 u;
@@ -3585,11 +3579,10 @@ fn trans_for_each(@block_ctxt cx,
3585
3579
}
3586
3580
3587
3581
// Populate the type parameters from the environment.
3588
- auto llremotetydescsptr =
3589
- bcx. build. GEP ( llremoteenvptr,
3590
- vec( C_int ( 0 ) ,
3591
- C_int ( abi. box_rc_field_body) ,
3592
- C_int ( abi. closure_elt_ty_params) ) ) ;
3582
+ auto llremotetydescsptr = bcx. build. GEP ( llremoteenvptr,
3583
+ vec( C_int ( 0 ) ,
3584
+ C_int ( abi. box_rc_field_body) ,
3585
+ C_int ( 3 ) ) ) ;
3593
3586
3594
3587
i = 0 u;
3595
3588
while ( i < tydesc_count) {
@@ -3910,7 +3903,7 @@ fn lval_generic_fn(@block_ctxt cx,
3910
3903
}
3911
3904
3912
3905
if ( _vec. len[ ty. t] ( tys) != 0 u) {
3913
- auto bcx = lv . res . bcx ;
3906
+ auto bcx = cx ;
3914
3907
let vec[ ValueRef ] tydescs = vec( ) ;
3915
3908
for ( ty. t t in tys) {
3916
3909
auto td = get_tydesc( bcx, t) ;
@@ -4504,7 +4497,7 @@ fn trans_bind(@block_ctxt cx, @ast.expr f,
4504
4497
for ( ValueRef v in bound_vals) {
4505
4498
auto bound = bcx. build. GEP ( bindings,
4506
4499
vec( C_int ( 0 ) , C_int ( i as int) ) ) ;
4507
- bcx = copy_ty( bcx, INIT , bound, v, bound_tys. ( i) ) . bcx;
4500
+ bcx = copy_ty( r . bcx, INIT , bound, v, bound_tys. ( i) ) . bcx;
4508
4501
i += 1 u;
4509
4502
}
4510
4503
@@ -5331,7 +5324,7 @@ fn trans_break_cont(@block_ctxt cx, bool to_end) -> result {
5331
5324
}
5332
5325
}
5333
5326
}
5334
- ret res( bcx , C_nil ( ) ) ;
5327
+ ret res( new_sub_block_ctxt ( cx , "unreachable" ) , C_nil ( ) ) ;
5335
5328
}
5336
5329
case ( _) {
5337
5330
alt ( cleanup_cx. parent) {
@@ -5340,7 +5333,7 @@ fn trans_break_cont(@block_ctxt cx, bool to_end) -> result {
5340
5333
}
5341
5334
}
5342
5335
}
5343
- fail ;
5336
+ ret res ( cx , C_nil ( ) ) ; // Never reached. Won't compile otherwise.
5344
5337
}
5345
5338
5346
5339
fn trans_break( @block_ctxt cx) -> result {
@@ -5364,11 +5357,7 @@ fn trans_ret(@block_ctxt cx, &option.t[@ast.expr] e) -> result {
5364
5357
val = r. val;
5365
5358
bcx = copy_ty( bcx, INIT , cx. fcx. llretptr, val, t) . bcx;
5366
5359
}
5367
- case ( _) {
5368
- auto t = llvm. LLVMGetElementType ( val_ty( cx. fcx. llretptr) ) ;
5369
- auto null = lib. llvm. llvm. LLVMConstNull ( t) ;
5370
- bcx. build. Store ( null, cx. fcx. llretptr) ;
5371
- }
5360
+ case ( _) { /* fall through */ }
5372
5361
}
5373
5362
5374
5363
// Run all cleanups and back out.
@@ -6063,7 +6052,7 @@ fn trans_fn(@local_ctxt cx, &ast._fn f, ast.def_id fid,
6063
6052
new_builder( fcx. llallocas) . Br ( lltop) ;
6064
6053
}
6065
6054
6066
- fn trans_vtbl( @local_ctxt cx,
6055
+ fn trans_vtbl( @local_ctxt cx,
6067
6056
TypeRef llself_ty,
6068
6057
ty. t self_ty,
6069
6058
& ast. _obj ob,
@@ -6096,7 +6085,7 @@ fn trans_vtbl(@local_ctxt cx,
6096
6085
cx. ccx. item_ids. insert( m. node. id, llfn) ;
6097
6086
cx. ccx. item_symbols. insert( m. node. id, s) ;
6098
6087
6099
- trans_fn( mcx, m. node. meth, m. node. id,
6088
+ trans_fn( mcx, m. node. meth, m. node. id,
6100
6089
some[ tup( TypeRef , ty. t) ] ( tup( llself_ty, self_ty) ) ,
6101
6090
ty_params, m. node. ann) ;
6102
6091
methods += vec( llfn) ;
@@ -6157,7 +6146,7 @@ fn trans_obj(@local_ctxt cx, &ast._obj ob, ast.def_id oid,
6157
6146
6158
6147
auto fcx = new_fn_ctxt( cx, llctor_decl) ;
6159
6148
create_llargs_for_fn_args( fcx, ast. proto_fn,
6160
- none[ tup( TypeRef , ty. t) ] ,
6149
+ none[ tup( TypeRef , ty. t) ] ,
6161
6150
ret_ty_of_fn( cx. ccx, ann) ,
6162
6151
fn_args, ty_params) ;
6163
6152
@@ -6300,7 +6289,7 @@ fn trans_tag_variant(@local_ctxt cx, ast.def_id tag_id,
6300
6289
auto fcx = new_fn_ctxt( cx, llfndecl) ;
6301
6290
6302
6291
create_llargs_for_fn_args( fcx, ast. proto_fn,
6303
- none[ tup( TypeRef , ty. t) ] ,
6292
+ none[ tup( TypeRef , ty. t) ] ,
6304
6293
ret_ty_of_fn( cx. ccx, variant. node. ann) ,
6305
6294
fn_args, ty_params) ;
6306
6295
@@ -6729,7 +6718,7 @@ fn collect_item_2(@crate_ctxt ccx, @walk_ctxt wcx, @ast.item i) {
6729
6718
fn collect_items ( @crate_ctxt ccx , @ast. crate crate) {
6730
6719
auto wcx = new_walk_ctxt ( ) ;
6731
6720
auto visitor0 = walk. default_visitor ( ) ;
6732
- auto visitor1 = rec ( visit_native_item_pre =
6721
+ auto visitor1 = rec ( visit_native_item_pre =
6733
6722
bind collect_native_item ( ccx, wcx, _) ,
6734
6723
visit_item_pre = bind collect_item_1 ( ccx, wcx, _) ,
6735
6724
visit_item_post = bind leave_item ( wcx, _)
@@ -6771,7 +6760,7 @@ fn collect_tag_ctors(@crate_ctxt ccx, @ast.crate crate) {
6771
6760
6772
6761
fn trans_constant ( @crate_ctxt ccx , @walk_ctxt wcx , @ast. item it ) {
6773
6762
enter_item ( wcx, it) ;
6774
-
6763
+
6775
6764
alt ( it. node ) {
6776
6765
case ( ast. item_tag ( ?ident, ?variants, _, ?tag_id, _) ) {
6777
6766
auto i = 0 u;
0 commit comments