@@ -331,7 +331,7 @@ fn T_glue_fn(type_names tn) -> TypeRef {
331
331
_vec. buf [ TypeRef ] ( tydesc_elts) ) ;
332
332
auto t =
333
333
llvm. LLVMGetElementType
334
- ( tydesc_elts. ( abi. tydesc_field_drop_glue_off ) ) ;
334
+ ( tydesc_elts. ( abi. tydesc_field_drop_glue ) ) ;
335
335
tn. associate ( s, t) ;
336
336
ret t;
337
337
}
@@ -355,12 +355,12 @@ fn T_tydesc(type_names tn) -> TypeRef {
355
355
auto tydesc = T_struct ( vec ( tydescpp, // first_param
356
356
T_int ( ) , // size
357
357
T_int ( ) , // align
358
- glue_fn_ty, // take_glue_off
359
- glue_fn_ty, // drop_glue_off
360
- glue_fn_ty, // free_glue_off
361
- glue_fn_ty, // sever_glue_off
362
- glue_fn_ty, // mark_glue_off
363
- glue_fn_ty, // obj_drop_glue_off
358
+ glue_fn_ty, // take_glue
359
+ glue_fn_ty, // drop_glue
360
+ glue_fn_ty, // free_glue
361
+ glue_fn_ty, // sever_glue
362
+ glue_fn_ty, // mark_glue
363
+ glue_fn_ty, // obj_drop_glue
364
364
glue_fn_ty) ) ; // is_stateful
365
365
366
366
llvm. LLVMRefineType ( abs_tydesc, tydesc) ;
@@ -414,11 +414,11 @@ fn T_crate(type_names tn) -> TypeRef {
414
414
T_int ( ) , // size_t debug_abbrev_sz
415
415
T_int ( ) , // ptrdiff_t debug_info_off
416
416
T_int ( ) , // size_t debug_info_sz
417
- T_int ( ) , // size_t activate_glue_off
418
- T_int ( ) , // size_t yield_glue_off
419
- T_int ( ) , // size_t unwind_glue_off
420
- T_int ( ) , // size_t gc_glue_off
421
- T_int ( ) , // size_t main_exit_task_glue_off
417
+ T_int ( ) , // size_t activate_glue
418
+ T_int ( ) , // size_t yield_glue
419
+ T_int ( ) , // size_t unwind_glue
420
+ T_int ( ) , // size_t gc_glue
421
+ T_int ( ) , // size_t main_exit_task_glue
422
422
T_int ( ) , // int n_rust_syms
423
423
T_int ( ) , // int n_c_syms
424
424
T_int ( ) , // int n_libs
@@ -1576,29 +1576,19 @@ fn declare_tydesc(@crate_ctxt cx, @ty.t t) {
1576
1576
}
1577
1577
1578
1578
auto glue_fn_ty = T_ptr ( T_glue_fn ( cx. tn) ) ;
1579
-
1580
- // FIXME: this adjustment has to do with the ridiculous encoding of
1581
- // glue-pointer-constants in the tydesc records: They are tydesc-relative
1582
- // displacements. This is purely for compatibility with rustboot and
1583
- // should go when it is discarded.
1584
- fn off( ValueRef tydescp,
1585
- ValueRef gluefn) -> ValueRef {
1586
- ret i2p( llvm. LLVMConstSub ( p2i( gluefn) , p2i( tydescp) ) ,
1587
- val_ty( gluefn) ) ;
1588
- }
1589
-
1579
+
1590
1580
auto name = sanitize( cx. names. next( "tydesc_" + ty. ty_to_str( t) ) ) ;
1591
1581
auto gvar = llvm. LLVMAddGlobal ( cx. llmod, T_tydesc ( cx. tn) ,
1592
1582
_str. buf( name) ) ;
1593
1583
auto tydesc = C_struct ( vec( C_null ( T_ptr ( T_ptr ( T_tydesc ( cx. tn) ) ) ) ,
1594
1584
llsize,
1595
1585
llalign,
1596
- off ( gvar , take_glue) , // take_glue_off
1597
- off ( gvar , drop_glue) , // drop_glue_off
1598
- C_null ( glue_fn_ty) , // free_glue_off
1599
- C_null ( glue_fn_ty) , // sever_glue_off
1600
- C_null ( glue_fn_ty) , // mark_glue_off
1601
- C_null ( glue_fn_ty) , // obj_drop_glue_off
1586
+ take_glue, // take_glue
1587
+ drop_glue, // drop_glue
1588
+ C_null ( glue_fn_ty) , // free_glue
1589
+ C_null ( glue_fn_ty) , // sever_glue
1590
+ C_null ( glue_fn_ty) , // mark_glue
1591
+ C_null ( glue_fn_ty) , // obj_drop_glue
1602
1592
C_null ( glue_fn_ty) ) ) ; // is_stateful
1603
1593
1604
1594
llvm. LLVMSetInitializer ( gvar, tydesc) ;
@@ -1789,7 +1779,7 @@ fn make_drop_glue(@block_ctxt cx, ValueRef v, @ty.t t) -> result {
1789
1779
C_int ( abi. obj_body_elt_tydesc) ) ) ;
1790
1780
1791
1781
call_tydesc_glue_full( cx, body, cx. build. Load ( tydescptr) ,
1792
- abi. tydesc_field_drop_glue_off ) ;
1782
+ abi. tydesc_field_drop_glue ) ;
1793
1783
1794
1784
// Then free the body.
1795
1785
// FIXME: switch gc/non-gc on layer of the type.
@@ -1827,7 +1817,7 @@ fn make_drop_glue(@block_ctxt cx, ValueRef v, @ty.t t) -> result {
1827
1817
C_int ( abi. closure_elt_tydesc) ) ) ;
1828
1818
1829
1819
call_tydesc_glue_full( cx, bindings, cx. build. Load ( tydescptr) ,
1830
- abi. tydesc_field_drop_glue_off ) ;
1820
+ abi. tydesc_field_drop_glue ) ;
1831
1821
1832
1822
1833
1823
// Then free the body.
@@ -2316,14 +2306,6 @@ fn call_tydesc_glue_full(@block_ctxt cx, ValueRef v,
2316
2306
auto llfnptr = cx. build. GEP ( tydesc, vec( C_int ( 0 ) , C_int ( field) ) ) ;
2317
2307
auto llfn = cx. build. Load ( llfnptr) ;
2318
2308
2319
- // FIXME: this adjustment has to do with the ridiculous encoding of
2320
- // glue-pointer-constants in the tydesc records: They are tydesc-relative
2321
- // displacements. This is purely for compatibility with rustboot and
2322
- // should go when it is discarded.
2323
- llfn = vi2p( cx, cx. build. Add ( vp2i( cx, llfn) ,
2324
- vp2i( cx, tydesc) ) ,
2325
- val_ty( llfn) ) ;
2326
-
2327
2309
cx. build. FastCall ( llfn, vec( C_null ( T_ptr ( T_nil ( ) ) ) ,
2328
2310
cx. fcx. lltaskptr,
2329
2311
C_null ( T_ptr ( T_nil ( ) ) ) ,
@@ -2340,7 +2322,7 @@ fn take_ty(@block_ctxt cx,
2340
2322
ValueRef v,
2341
2323
@ty. t t) -> result {
2342
2324
if ( !ty. type_is_scalar( t) ) {
2343
- call_tydesc_glue( cx, v, t, abi. tydesc_field_take_glue_off ) ;
2325
+ call_tydesc_glue( cx, v, t, abi. tydesc_field_take_glue ) ;
2344
2326
}
2345
2327
ret res( cx, C_nil ( ) ) ;
2346
2328
}
@@ -2362,7 +2344,7 @@ fn drop_ty(@block_ctxt cx,
2362
2344
@ty. t t) -> result {
2363
2345
2364
2346
if ( !ty. type_is_scalar( t) ) {
2365
- call_tydesc_glue( cx, v, t, abi. tydesc_field_drop_glue_off ) ;
2347
+ call_tydesc_glue( cx, v, t, abi. tydesc_field_drop_glue ) ;
2366
2348
}
2367
2349
ret res( cx, C_nil ( ) ) ;
2368
2350
}
@@ -6939,7 +6921,7 @@ fn trans_vec_append_glue(@crate_ctxt cx) {
6939
6921
ValueRef dst, ValueRef src) -> result {
6940
6922
call_tydesc_glue_full ( cx, src,
6941
6923
elt_tydesc,
6942
- abi. tydesc_field_take_glue_off ) ;
6924
+ abi. tydesc_field_take_glue ) ;
6943
6925
ret res( cx, src) ;
6944
6926
}
6945
6927
0 commit comments