@@ -457,7 +457,6 @@ fn T_tydesc(&type_names tn) -> TypeRef {
457
457
}
458
458
459
459
fn T_array ( TypeRef t, uint n) -> TypeRef {
460
- assert ( n != 0 u) ;
461
460
ret llvm:: LLVMArrayType ( t, n) ;
462
461
}
463
462
@@ -466,7 +465,7 @@ fn T_vec(TypeRef t) -> TypeRef {
466
465
T_int ( ) , // Alloc
467
466
T_int ( ) , // Fill
468
467
T_int ( ) , // Pad
469
- T_array ( t, 1 u ) // Body elements
468
+ T_array ( t, 0 u ) // Body elements
470
469
] ) ;
471
470
}
472
471
@@ -568,13 +567,7 @@ fn T_tag(&type_names tn, uint size) -> TypeRef {
568
567
if ( tn. name_has_type ( s) ) {
569
568
ret tn. get_type ( s) ;
570
569
}
571
-
572
- auto t;
573
- if ( size == 0 u) {
574
- t = T_struct ( [ T_int ( ) ] ) ;
575
- } else {
576
- t = T_struct ( [ T_int ( ) , T_array ( T_i8 ( ) , size) ] ) ;
577
- }
570
+ auto t = T_struct ( [ T_int ( ) , T_array ( T_i8 ( ) , size) ] ) ;
578
571
579
572
tn. associate ( s, t) ;
580
573
ret t;
@@ -1648,7 +1641,7 @@ fn linearize_ty_params(&@block_ctxt cx, &ty::t t) ->
1648
1641
fn trans_stack_local_derived_tydesc ( & @block_ctxt cx , ValueRef llsz,
1649
1642
ValueRef llalign,
1650
1643
ValueRef llroottydesc ,
1651
- & option :: t [ ValueRef ] llparamtydescs )
1644
+ ValueRef llparamtydescs )
1652
1645
-> ValueRef {
1653
1646
auto llmyroottydesc = alloca ( cx, T_tydesc ( cx. fcx . lcx . ccx . tn ) ) ;
1654
1647
@@ -1657,19 +1650,8 @@ fn trans_stack_local_derived_tydesc(&@block_ctxt cx, ValueRef llsz,
1657
1650
cx. build . Store ( llroottydesc, llmyroottydesc) ;
1658
1651
1659
1652
// Store a pointer to the rest of the descriptors.
1660
- auto llrootfirstparam = cx. build . GEP ( llmyroottydesc,
1661
- [ C_int ( 0 ) , C_int ( 0 ) ] ) ;
1653
+ auto llfirstparam = cx. build . GEP ( llparamtydescs, [ C_int ( 0 ) , C_int ( 0 ) ] ) ;
1662
1654
1663
- auto llfirstparam;
1664
- alt ( llparamtydescs) {
1665
- case ( none[ ValueRef ] ) {
1666
- llfirstparam = C_null ( val_ty ( llrootfirstparam) ) ;
1667
- }
1668
- case ( some[ ValueRef ] ( ?llparamtydescs) ) {
1669
- llfirstparam = cx. build . GEP ( llparamtydescs,
1670
- [ C_int ( 0 ) , C_int ( 0 ) ] ) ;
1671
- }
1672
- }
1673
1655
cx. build . Store ( llfirstparam,
1674
1656
cx. build . GEP ( llmyroottydesc, [ C_int ( 0 ) , C_int ( 0 ) ] ) ) ;
1675
1657
@@ -1739,26 +1721,19 @@ fn get_derived_tydesc(&@block_ctxt cx, &ty::t t, bool escapes,
1739
1721
lltydescsptr] ) ;
1740
1722
v = td_val;
1741
1723
} else {
1742
- auto llparamtydescs_opt;
1743
- if ( n_params == 0 u) {
1744
- llparamtydescs_opt = none[ ValueRef ] ;
1745
- } else {
1746
- auto llparamtydescs = alloca( bcx,
1747
- T_array ( T_ptr ( T_tydesc ( bcx. fcx. lcx. ccx. tn) ) , n_params) ) ;
1724
+ auto llparamtydescs = alloca( bcx,
1725
+ T_array ( T_ptr ( T_tydesc ( bcx. fcx. lcx. ccx. tn) ) , n_params) ) ;
1748
1726
1749
- auto i = 0 ;
1750
- for ( ValueRef td in tys. _1) {
1751
- auto tdp = bcx. build. GEP ( llparamtydescs,
1752
- [ C_int ( 0 ) , C_int ( i) ] ) ;
1753
- bcx. build. Store ( td, tdp) ;
1754
- i += 1 ;
1755
- }
1756
-
1757
- llparamtydescs_opt = some[ ValueRef ] ( llparamtydescs) ;
1727
+ auto i = 0 ;
1728
+ for ( ValueRef td in tys. _1) {
1729
+ auto tdp = bcx. build. GEP ( llparamtydescs,
1730
+ [ C_int ( 0 ) , C_int ( i) ] ) ;
1731
+ bcx. build. Store ( td, tdp) ;
1732
+ i += 1 ;
1758
1733
}
1759
1734
1760
1735
v = trans_stack_local_derived_tydesc( bcx, sz. val, align. val, root,
1761
- llparamtydescs_opt ) ;
1736
+ llparamtydescs ) ;
1762
1737
}
1763
1738
1764
1739
bcx. fcx. derived_tydescs. insert( t, rec( lltydesc=v, escapes=escapes) ) ;
@@ -4539,7 +4514,7 @@ fn trans_index(&@block_ctxt cx, &ast::span sp, &@ast::expr base,
4539
4514
auto body = next_cx. build . GEP ( v, [ C_int ( 0 ) , C_int ( abi:: vec_elt_data) ] ) ;
4540
4515
auto elt;
4541
4516
if ( ty:: type_has_dynamic_size ( cx. fcx . lcx . ccx . tcx , unit_ty) ) {
4542
- body = next_cx. build . PointerCast ( body, T_ptr ( T_array ( T_i8 ( ) , 1 u ) ) ) ;
4517
+ body = next_cx. build . PointerCast ( body, T_ptr ( T_array ( T_i8 ( ) , 0 u ) ) ) ;
4543
4518
elt = next_cx. build . GEP ( body, [ C_int ( 0 ) , scaled_ix] ) ;
4544
4519
} else {
4545
4520
elt = next_cx. build . GEP ( body, [ C_int ( 0 ) , ix_val] ) ;
0 commit comments