@@ -188,7 +188,6 @@ pub use self::TransBindingMode::*;
188
188
use self :: Opt :: * ;
189
189
use self :: FailureHandler :: * ;
190
190
191
- use back:: abi;
192
191
use llvm:: { ValueRef , BasicBlockRef } ;
193
192
use middle:: check_match:: StaticInliner ;
194
193
use middle:: check_match;
@@ -678,9 +677,8 @@ fn bind_subslice_pat(bcx: Block,
678
677
let slice_ty = bcx. tcx ( ) . mk_imm_ref ( bcx. tcx ( ) . mk_region ( ty:: ReStatic ) ,
679
678
bcx. tcx ( ) . mk_slice ( unit_ty) ) ;
680
679
let scratch = rvalue_scratch_datum ( bcx, slice_ty, "" ) ;
681
- Store ( bcx, slice_begin,
682
- GEPi ( bcx, scratch. val , & [ 0 , abi:: FAT_PTR_ADDR ] ) ) ;
683
- Store ( bcx, slice_len, GEPi ( bcx, scratch. val , & [ 0 , abi:: FAT_PTR_EXTRA ] ) ) ;
680
+ store_addr ( bcx, slice_begin, scratch. val ) ;
681
+ store_extra ( bcx, slice_len, scratch. val ) ;
684
682
scratch. val
685
683
}
686
684
@@ -833,10 +831,11 @@ fn compare_values<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
833
831
None ,
834
832
& format ! ( "comparison of `{}`" , rhs_t) ,
835
833
StrEqFnLangItem ) ;
836
- let lhs_data = Load ( cx, expr:: get_dataptr ( cx, lhs) ) ;
837
- let lhs_len = Load ( cx, expr:: get_len ( cx, lhs) ) ;
838
- let rhs_data = Load ( cx, expr:: get_dataptr ( cx, rhs) ) ;
839
- let rhs_len = Load ( cx, expr:: get_len ( cx, rhs) ) ;
834
+ let str_ty = cx. tcx ( ) . mk_str ( ) ;
835
+ let lhs_data = load_addr ( cx, lhs) ;
836
+ let lhs_len = load_extra ( cx, lhs, str_ty) ;
837
+ let rhs_data = load_addr ( cx, rhs) ;
838
+ let rhs_len = load_extra ( cx, rhs, str_ty) ;
840
839
callee:: trans_lang_call ( cx, did, & [ lhs_data, lhs_len, rhs_data, rhs_len] , None , debug_loc)
841
840
}
842
841
@@ -857,15 +856,15 @@ fn compare_values<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
857
856
let ty_str_slice = cx. tcx ( ) . mk_static_str ( ) ;
858
857
859
858
let rhs_str = alloc_ty ( cx, ty_str_slice, "rhs_str" ) ;
860
- Store ( cx, GEPi ( cx, rhs, & [ 0 , 0 ] ) , expr :: get_dataptr ( cx , rhs_str) ) ;
861
- Store ( cx, C_uint ( cx. ccx ( ) , pat_len) , expr :: get_len ( cx , rhs_str) ) ;
859
+ store_addr ( cx, GEPi ( cx, rhs, & [ 0 , 0 ] ) , rhs_str) ;
860
+ store_extra ( cx, C_uint ( cx. ccx ( ) , pat_len) , rhs_str) ;
862
861
863
862
let lhs_str;
864
863
if val_ty ( lhs) == val_ty ( rhs) {
865
864
// Both the discriminant and the pattern are thin pointers
866
865
lhs_str = alloc_ty ( cx, ty_str_slice, "lhs_str" ) ;
867
- Store ( cx, GEPi ( cx, lhs, & [ 0 , 0 ] ) , expr :: get_dataptr ( cx , lhs_str) ) ;
868
- Store ( cx, C_uint ( cx. ccx ( ) , pat_len) , expr :: get_len ( cx , lhs_str) ) ;
866
+ store_addr ( cx, GEPi ( cx, lhs, & [ 0 , 0 ] ) , lhs_str) ;
867
+ store_extra ( cx, C_uint ( cx. ccx ( ) , pat_len) , lhs_str) ;
869
868
}
870
869
else {
871
870
// The discriminant is a fat pointer
@@ -1016,7 +1015,7 @@ fn compile_submatch<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
1016
1015
let binfo = * data. bindings_map . get ( ident) . unwrap ( ) ;
1017
1016
call_lifetime_start ( bcx, binfo. llmatch ) ;
1018
1017
if binfo. trmode == TrByRef && type_is_fat_ptr ( bcx. tcx ( ) , binfo. ty ) {
1019
- expr:: copy_fat_ptr ( bcx, * value_ptr, binfo. llmatch ) ;
1018
+ expr:: copy_fat_ptr ( bcx, * value_ptr, binfo. llmatch , binfo . ty ) ;
1020
1019
}
1021
1020
else {
1022
1021
Store ( bcx, * value_ptr, binfo. llmatch ) ;
@@ -1080,7 +1079,7 @@ fn compile_submatch_continue<'a, 'p, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
1080
1079
// the last field specially: instead of simply passing a
1081
1080
// ValueRef pointing to that field, as with all the others,
1082
1081
// we skip it and instead construct a 'fat ptr' below.
1083
- ( arg_count - 1 , Load ( bcx, expr :: get_dataptr ( bcx , val) ) )
1082
+ ( arg_count - 1 , load_addr ( bcx, val) )
1084
1083
} ;
1085
1084
let mut field_vals: Vec < ValueRef > = ( 0 ..arg_count) . map ( |ix|
1086
1085
adt:: trans_field_ptr ( bcx, & * repr, struct_val, 0 , ix)
@@ -1099,9 +1098,9 @@ fn compile_submatch_continue<'a, 'p, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
1099
1098
let llty = type_of:: type_of ( bcx. ccx ( ) , unsized_ty) ;
1100
1099
let scratch = alloca_no_lifetime ( bcx, llty, "__struct_field_fat_ptr" ) ;
1101
1100
let data = adt:: trans_field_ptr ( bcx, & * repr, struct_val, 0 , arg_count) ;
1102
- let len = Load ( bcx, expr :: get_len ( bcx , val ) ) ;
1103
- Store ( bcx, data, expr :: get_dataptr ( bcx , scratch) ) ;
1104
- Store ( bcx, len, expr :: get_len ( bcx , scratch) ) ;
1101
+ let len = load_extra ( bcx, val , left_ty ) ;
1102
+ store_addr ( bcx, data, scratch) ;
1103
+ store_extra ( bcx, len, scratch) ;
1105
1104
field_vals. push ( scratch) ;
1106
1105
}
1107
1106
_ => { }
@@ -1681,7 +1680,7 @@ pub fn bind_irrefutable_pat<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
1681
1680
// By ref binding: the value of the variable
1682
1681
// is the pointer `val` itself or fat pointer referenced by `val`
1683
1682
if type_is_fat_ptr ( bcx. tcx ( ) , ty) {
1684
- expr:: copy_fat_ptr ( bcx, val, llval) ;
1683
+ expr:: copy_fat_ptr ( bcx, val, llval, ty ) ;
1685
1684
}
1686
1685
else {
1687
1686
Store ( bcx, val, llval) ;
0 commit comments