@@ -4,7 +4,7 @@ use std::convert::TryFrom;
4
4
use rustc:: mir;
5
5
use rustc:: mir:: interpret:: { InterpResult , PointerArithmetic } ;
6
6
use rustc:: ty;
7
- use rustc:: ty:: layout:: { self , Align , LayoutOf , Size } ;
7
+ use rustc:: ty:: layout:: { Align , LayoutOf , Size } ;
8
8
use rustc_apfloat:: Float ;
9
9
use rustc_span:: source_map:: Span ;
10
10
@@ -384,37 +384,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
384
384
this. write_immediate ( * b, dest) ?;
385
385
}
386
386
387
- "init" => {
388
- // Check fast path: we don't want to force an allocation in case the destination is a simple value,
389
- // but we also do not want to create a new allocation with 0s and then copy that over.
390
- // FIXME: We do not properly validate in case of ZSTs and when doing it in memory!
391
- // However, this only affects direct calls of the intrinsic; calls to the stable
392
- // functions wrapping them do get their validation.
393
- // FIXME: should we check that the destination pointer is aligned even for ZSTs?
394
- if !dest. layout . is_zst ( ) {
395
- match dest. layout . abi {
396
- layout:: Abi :: Scalar ( ref s) => {
397
- let x = Scalar :: from_int ( 0 , s. value . size ( this) ) ;
398
- this. write_scalar ( x, dest) ?;
399
- }
400
- layout:: Abi :: ScalarPair ( ref s1, ref s2) => {
401
- let x = Scalar :: from_int ( 0 , s1. value . size ( this) ) ;
402
- let y = Scalar :: from_int ( 0 , s2. value . size ( this) ) ;
403
- this. write_immediate ( Immediate :: ScalarPair ( x. into ( ) , y. into ( ) ) , dest) ?;
404
- }
405
- _ => {
406
- // Do it in memory
407
- let mplace = this. force_allocation ( dest) ?;
408
- assert ! ( !mplace. layout. is_unsized( ) ) ;
409
- this. memory . write_bytes (
410
- mplace. ptr ,
411
- iter:: repeat ( 0u8 ) . take ( dest. layout . size . bytes ( ) as usize ) ,
412
- ) ?;
413
- }
414
- }
415
- }
416
- }
417
-
418
387
"pref_align_of" => {
419
388
let ty = substs. type_at ( 0 ) ;
420
389
let layout = this. layout_of ( ty) ?;
@@ -518,39 +487,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
518
487
this. write_scalar ( Scalar :: from_uint ( align. bytes ( ) , ptr_size) , dest) ?;
519
488
}
520
489
521
- "uninit" => {
522
- // Check fast path: we don't want to force an allocation in case the destination is a simple value,
523
- // but we also do not want to create a new allocation with 0s and then copy that over.
524
- // FIXME: We do not properly validate in case of ZSTs and when doing it in memory!
525
- // However, this only affects direct calls of the intrinsic; calls to the stable
526
- // functions wrapping them do get their validation.
527
- // FIXME: should we check alignment for ZSTs?
528
- if !dest. layout . is_zst ( ) {
529
- match dest. layout . abi {
530
- layout:: Abi :: Scalar ( ..) => {
531
- let x = ScalarMaybeUndef :: Undef ;
532
- this. write_immediate ( Immediate :: Scalar ( x) , dest) ?;
533
- }
534
- layout:: Abi :: ScalarPair ( ..) => {
535
- let x = ScalarMaybeUndef :: Undef ;
536
- this. write_immediate ( Immediate :: ScalarPair ( x, x) , dest) ?;
537
- }
538
- _ => {
539
- // Do it in memory
540
- let mplace = this. force_allocation ( dest) ?;
541
- assert ! ( !mplace. layout. is_unsized( ) ) ;
542
- let ptr = mplace. ptr . assert_ptr ( ) ;
543
- // We know the return place is in-bounds
544
- this. memory . get_raw_mut ( ptr. alloc_id ) ?. mark_definedness (
545
- ptr,
546
- dest. layout . size ,
547
- false ,
548
- ) ;
549
- }
550
- }
551
- }
552
- }
553
-
554
490
"write_bytes" => {
555
491
let ty = substs. type_at ( 0 ) ;
556
492
let ty_layout = this. layout_of ( ty) ?;
0 commit comments