@@ -1658,7 +1658,7 @@ fn declare_tydesc(@local_ctxt cx, @ty.t t) {
1658
1658
}
1659
1659
1660
1660
tag make_generic_glue_helper_fn {
1661
- mgghf_single( val_and_ty_fn ) ;
1661
+ mgghf_single( fn ( @block_ctxt cx , ValueRef v , @ty . t t ) ) ;
1662
1662
mgghf_cmp;
1663
1663
}
1664
1664
@@ -1694,7 +1694,6 @@ fn make_generic_glue(@local_ctxt cx,
1694
1694
auto bcx = new_top_block_ctxt( fcx) ;
1695
1695
auto lltop = bcx. llbb;
1696
1696
1697
- auto re;
1698
1697
if ( !ty. type_is_scalar( t) ) {
1699
1698
1700
1699
// Any nontrivial glue is with values passed *by alias*; this is a
@@ -1729,39 +1728,40 @@ fn make_generic_glue(@local_ctxt cx,
1729
1728
1730
1729
alt ( helper) {
1731
1730
case ( mgghf_single( ?single_fn) ) {
1732
- re = single_fn( bcx, llval0, t) ;
1731
+ single_fn( bcx, llval0, t) ;
1733
1732
}
1734
1733
case ( mgghf_cmp) {
1735
1734
auto llrawptr1 = llvm. LLVMGetParam ( llfn, 5 u) ;
1736
1735
auto llval1 = bcx. build. BitCast ( llrawptr0, llty) ;
1737
1736
1738
1737
auto llcmpval = llvm. LLVMGetParam ( llfn, 6 u) ;
1739
1738
1740
- re = make_cmp_glue( bcx, llval0, llval1, t, llcmpval) ;
1739
+ make_cmp_glue( bcx, llval0, llval1, t, llcmpval) ;
1741
1740
}
1742
1741
}
1743
1742
} else {
1744
- re = res ( bcx, C_nil ( ) ) ;
1743
+ bcx. build . RetVoid ( ) ;
1745
1744
}
1746
1745
1747
- re. bcx. build. RetVoid ( ) ;
1748
-
1749
1746
// Tie up the llallocas -> lltop edge.
1750
1747
new_builder( fcx. llallocas) . Br ( lltop) ;
1751
1748
1752
1749
ret llfn;
1753
1750
}
1754
1751
1755
- fn make_take_glue( @block_ctxt cx, ValueRef v, @ty. t t) -> result {
1752
+ fn make_take_glue( @block_ctxt cx, ValueRef v, @ty. t t) {
1756
1753
// NB: v is an *alias* of type t here, not a direct value.
1754
+ auto bcx;
1757
1755
if ( ty. type_is_boxed( t) ) {
1758
- ret incr_refcnt_of_boxed( cx, cx. build. Load ( v) ) ;
1756
+ bcx = incr_refcnt_of_boxed( cx, cx. build. Load( v) ) . bcx ;
1759
1757
1760
1758
} else if ( ty. type_is_structural( t) ) {
1761
- ret iter_structural_ty( cx, v, t,
1762
- bind take_ty( _, _, _) ) ;
1759
+ bcx = iter_structural_ty( cx, v, t,
1760
+ bind take_ty( _, _, _) ) . bcx;
1761
+ } else {
1762
+ bcx = cx;
1763
1763
}
1764
- ret res ( cx , C_nil ( ) ) ;
1764
+ bcx . build . RetVoid ( ) ;
1765
1765
}
1766
1766
1767
1767
fn incr_refcnt_of_boxed( @block_ctxt cx, ValueRef box_ptr) -> result {
@@ -1783,12 +1783,13 @@ fn incr_refcnt_of_boxed(@block_ctxt cx, ValueRef box_ptr) -> result {
1783
1783
ret res( next_cx, C_nil ( ) ) ;
1784
1784
}
1785
1785
1786
- fn make_drop_glue( @block_ctxt cx, ValueRef v0, @ty. t t) -> result {
1786
+ fn make_drop_glue( @block_ctxt cx, ValueRef v0, @ty. t t) {
1787
1787
// NB: v0 is an *alias* of type t here, not a direct value.
1788
+ auto rslt;
1788
1789
alt ( t. struct ) {
1789
1790
case ( ty. ty_str) {
1790
1791
auto v = cx. build. Load ( v0) ;
1791
- ret decr_refcnt_and_if_zero
1792
+ rslt = decr_refcnt_and_if_zero
1792
1793
( cx, v, bind trans_non_gc_free( _, v) ,
1793
1794
"free string" ,
1794
1795
T_int ( ) , C_int ( 0 ) ) ;
@@ -1803,10 +1804,10 @@ fn make_drop_glue(@block_ctxt cx, ValueRef v0, @ty.t t) -> result {
1803
1804
ret trans_non_gc_free( res. bcx, v) ;
1804
1805
}
1805
1806
auto v = cx. build. Load ( v0) ;
1806
- ret decr_refcnt_and_if_zero( cx, v,
1807
- bind hit_zero( _, v, t) ,
1808
- "free vector" ,
1809
- T_int ( ) , C_int ( 0 ) ) ;
1807
+ rslt = decr_refcnt_and_if_zero( cx, v,
1808
+ bind hit_zero( _, v, t) ,
1809
+ "free vector" ,
1810
+ T_int ( ) , C_int ( 0 ) ) ;
1810
1811
}
1811
1812
1812
1813
case ( ty. ty_box( ?body_mt) ) {
@@ -1822,10 +1823,10 @@ fn make_drop_glue(@block_ctxt cx, ValueRef v0, @ty.t t) -> result {
1822
1823
ret trans_non_gc_free( res. bcx, v) ;
1823
1824
}
1824
1825
auto v = cx. build. Load ( v0) ;
1825
- ret decr_refcnt_and_if_zero( cx, v,
1826
- bind hit_zero( _, v, body_mt. ty) ,
1827
- "free box" ,
1828
- T_int ( ) , C_int ( 0 ) ) ;
1826
+ rslt = decr_refcnt_and_if_zero( cx, v,
1827
+ bind hit_zero( _, v, body_mt. ty) ,
1828
+ "free box" ,
1829
+ T_int ( ) , C_int ( 0 ) ) ;
1829
1830
}
1830
1831
1831
1832
case ( ty. ty_port( _) ) {
@@ -1834,10 +1835,10 @@ fn make_drop_glue(@block_ctxt cx, ValueRef v0, @ty.t t) -> result {
1834
1835
vec( vp2i( cx, v) ) ) ;
1835
1836
}
1836
1837
auto v = cx. build. Load ( v0) ;
1837
- ret decr_refcnt_and_if_zero( cx, v,
1838
- bind hit_zero( _, v) ,
1839
- "free port" ,
1840
- T_int ( ) , C_int ( 0 ) ) ;
1838
+ rslt = decr_refcnt_and_if_zero( cx, v,
1839
+ bind hit_zero( _, v) ,
1840
+ "free port" ,
1841
+ T_int ( ) , C_int ( 0 ) ) ;
1841
1842
}
1842
1843
1843
1844
case ( ty. ty_chan( _) ) {
@@ -1846,10 +1847,10 @@ fn make_drop_glue(@block_ctxt cx, ValueRef v0, @ty.t t) -> result {
1846
1847
vec( vp2i( cx, v) ) ) ;
1847
1848
}
1848
1849
auto v = cx. build. Load ( v0) ;
1849
- ret decr_refcnt_and_if_zero( cx, v,
1850
- bind hit_zero( _, v) ,
1851
- "free chan" ,
1852
- T_int ( ) , C_int ( 0 ) ) ;
1850
+ rslt = decr_refcnt_and_if_zero( cx, v,
1851
+ bind hit_zero( _, v) ,
1852
+ "free chan" ,
1853
+ T_int ( ) , C_int ( 0 ) ) ;
1853
1854
}
1854
1855
1855
1856
case ( ty. ty_obj( _) ) {
@@ -1880,10 +1881,10 @@ fn make_drop_glue(@block_ctxt cx, ValueRef v0, @ty.t t) -> result {
1880
1881
1881
1882
auto boxptr = cx. build. Load ( box_cell) ;
1882
1883
1883
- ret decr_refcnt_and_if_zero( cx, boxptr,
1884
- bind hit_zero( _, boxptr) ,
1885
- "free obj" ,
1886
- T_int ( ) , C_int ( 0 ) ) ;
1884
+ rslt = decr_refcnt_and_if_zero( cx, boxptr,
1885
+ bind hit_zero( _, boxptr) ,
1886
+ "free obj" ,
1887
+ T_int ( ) , C_int ( 0 ) ) ;
1887
1888
}
1888
1889
1889
1890
case ( ty. ty_fn( _, _, _) ) {
@@ -1919,27 +1920,26 @@ fn make_drop_glue(@block_ctxt cx, ValueRef v0, @ty.t t) -> result {
1919
1920
1920
1921
auto boxptr = cx. build. Load ( box_cell) ;
1921
1922
1922
- ret decr_refcnt_and_if_zero( cx, boxptr,
1923
- bind hit_zero( _, boxptr) ,
1924
- "free fn" ,
1925
- T_int ( ) , C_int ( 0 ) ) ;
1923
+ rslt = decr_refcnt_and_if_zero( cx, boxptr,
1924
+ bind hit_zero( _, boxptr) ,
1925
+ "free fn" ,
1926
+ T_int ( ) , C_int ( 0 ) ) ;
1926
1927
}
1927
1928
1928
1929
case ( _) {
1929
1930
if ( ty. type_is_structural( t) ) {
1930
- ret iter_structural_ty( cx, v0, t,
1931
- bind drop_ty( _, _, _) ) ;
1931
+ rslt = iter_structural_ty( cx, v0, t,
1932
+ bind drop_ty( _, _, _) ) ;
1932
1933
1933
1934
} else if ( ty. type_is_scalar( t) ||
1934
1935
ty. type_is_native( t) ||
1935
1936
ty. type_is_nil( t) ) {
1936
- ret res( cx, C_nil ( ) ) ;
1937
+ rslt = res( cx, C_nil ( ) ) ;
1937
1938
}
1938
1939
}
1939
1940
}
1940
- cx. fcx. lcx. ccx. sess. bug( "bad type in trans.make_drop_glue_inner: " +
1941
- ty. ty_to_str( t) ) ;
1942
- fail;
1941
+
1942
+ rslt. bcx. build. RetVoid ( ) ;
1943
1943
}
1944
1944
1945
1945
fn decr_refcnt_and_if_zero( @block_ctxt cx,
@@ -1986,8 +1986,8 @@ fn decr_refcnt_and_if_zero(@block_ctxt cx,
1986
1986
}
1987
1987
1988
1988
fn make_cmp_glue( @block_ctxt cx, ValueRef v0, ValueRef v1, @ty. t t,
1989
- ValueRef llop) -> result {
1990
- ret res ( cx , C_nil ( ) ) ; // TODO
1989
+ ValueRef llop) {
1990
+ cx . build . RetVoid ( ) ; // TODO
1991
1991
}
1992
1992
1993
1993
0 commit comments