@@ -132,18 +132,11 @@ impl<'tcx> CValue<'tcx> {
132
132
( ptr. get_addr ( fx) , vtable)
133
133
}
134
134
CValueInner :: ByValPair ( data, vtable) => {
135
- let stack_slot = fx. bcx . create_sized_stack_slot ( StackSlotData {
136
- kind : StackSlotKind :: ExplicitSlot ,
137
- // FIXME Don't force the size to a multiple of 16 bytes once Cranelift gets a way to
138
- // specify stack slot alignment.
139
- size : ( u32:: try_from ( fx. target_config . pointer_type ( ) . bytes ( ) ) . unwrap ( ) + 15 )
140
- / 16
141
- * 16 ,
142
- } ) ;
143
- let data_ptr = Pointer :: stack_slot ( stack_slot) ;
144
- let mut flags = MemFlags :: new ( ) ;
145
- flags. set_notrap ( ) ;
146
- data_ptr. store ( fx, data, flags) ;
135
+ let data_ptr = fx. create_stack_slot (
136
+ u32:: try_from ( fx. target_config . pointer_type ( ) . bytes ( ) ) . unwrap ( ) ,
137
+ u32:: try_from ( fx. target_config . pointer_type ( ) . bytes ( ) ) . unwrap ( ) ,
138
+ ) ;
139
+ data_ptr. store ( fx, data, MemFlags :: trusted ( ) ) ;
147
140
148
141
( data_ptr. get_addr ( fx) , vtable)
149
142
}
@@ -372,13 +365,11 @@ impl<'tcx> CPlace<'tcx> {
372
365
. fatal ( format ! ( "values of type {} are too big to store on the stack" , layout. ty) ) ;
373
366
}
374
367
375
- let stack_slot = fx. bcx . create_sized_stack_slot ( StackSlotData {
376
- kind : StackSlotKind :: ExplicitSlot ,
377
- // FIXME Don't force the size to a multiple of 16 bytes once Cranelift gets a way to
378
- // specify stack slot alignment.
379
- size : ( u32:: try_from ( layout. size . bytes ( ) ) . unwrap ( ) + 15 ) / 16 * 16 ,
380
- } ) ;
381
- CPlace { inner : CPlaceInner :: Addr ( Pointer :: stack_slot ( stack_slot) , None ) , layout }
368
+ let stack_slot = fx. create_stack_slot (
369
+ u32:: try_from ( layout. size . bytes ( ) ) . unwrap ( ) ,
370
+ u32:: try_from ( layout. align . pref . bytes ( ) ) . unwrap ( ) ,
371
+ ) ;
372
+ CPlace { inner : CPlaceInner :: Addr ( stack_slot, None ) , layout }
382
373
}
383
374
384
375
pub ( crate ) fn new_var (
@@ -543,13 +534,7 @@ impl<'tcx> CPlace<'tcx> {
543
534
_ if src_ty. is_vector ( ) && dst_ty. is_vector ( ) => codegen_bitcast ( fx, dst_ty, data) ,
544
535
_ if src_ty. is_vector ( ) || dst_ty. is_vector ( ) => {
545
536
// FIXME(bytecodealliance/wasmtime#6104) do something more efficient for transmutes between vectors and integers.
546
- let stack_slot = fx. bcx . create_sized_stack_slot ( StackSlotData {
547
- kind : StackSlotKind :: ExplicitSlot ,
548
- // FIXME Don't force the size to a multiple of 16 bytes once Cranelift gets a way to
549
- // specify stack slot alignment.
550
- size : ( src_ty. bytes ( ) + 15 ) / 16 * 16 ,
551
- } ) ;
552
- let ptr = Pointer :: stack_slot ( stack_slot) ;
537
+ let ptr = fx. create_stack_slot ( src_ty. bytes ( ) , src_ty. bytes ( ) ) ;
553
538
ptr. store ( fx, data, MemFlags :: trusted ( ) ) ;
554
539
ptr. load ( fx, dst_ty, MemFlags :: trusted ( ) )
555
540
}
0 commit comments