@@ -2893,13 +2893,38 @@ fn lazily_emit_tydesc_glue(&@block_ctxt cx, int field,
2893
2893
fn call_tydesc_glue_full( & @block_ctxt cx, ValueRef v, ValueRef tydesc,
2894
2894
int field, & option:: t[ @tydesc_info] static_ti) {
2895
2895
lazily_emit_tydesc_glue( cx, field, static_ti) ;
2896
+
2897
+ auto static_glue_fn = none;
2898
+ alt ( static_ti) {
2899
+ case ( none) { /* no-op */ }
2900
+ case ( some( ?sti) ) {
2901
+ if ( field == abi:: tydesc_field_take_glue) {
2902
+ static_glue_fn = sti. take_glue;
2903
+ } else if ( field == abi:: tydesc_field_drop_glue) {
2904
+ static_glue_fn = sti. drop_glue;
2905
+ } else if ( field == abi:: tydesc_field_free_glue) {
2906
+ static_glue_fn = sti. free_glue;
2907
+ } else if ( field == abi:: tydesc_field_cmp_glue) {
2908
+ static_glue_fn = sti. cmp_glue;
2909
+ }
2910
+ }
2911
+ }
2912
+
2896
2913
auto llrawptr = cx. build. BitCast ( v, T_ptr ( T_i8 ( ) ) ) ;
2897
2914
auto lltydescs =
2898
2915
cx. build. GEP ( tydesc,
2899
2916
[ C_int ( 0 ) , C_int ( abi:: tydesc_field_first_param) ] ) ;
2900
2917
lltydescs = cx. build. Load ( lltydescs) ;
2901
- auto llfnptr = cx. build. GEP ( tydesc, [ C_int ( 0 ) , C_int ( field) ] ) ;
2902
- auto llfn = cx. build. Load ( llfnptr) ;
2918
+
2919
+ auto llfn;
2920
+ alt ( static_glue_fn) {
2921
+ case ( none) {
2922
+ auto llfnptr = cx. build. GEP ( tydesc, [ C_int ( 0 ) , C_int ( field) ] ) ;
2923
+ llfn = cx. build. Load ( llfnptr) ;
2924
+ }
2925
+ case ( some( ?sgf) ) { llfn = sgf; }
2926
+ }
2927
+
2903
2928
cx. build. Call ( llfn,
2904
2929
[ C_null ( T_ptr ( T_nil ( ) ) ) , cx. fcx. lltaskptr,
2905
2930
C_null ( T_ptr ( T_nil ( ) ) ) , lltydescs, llrawptr] ) ;
0 commit comments