@@ -17,7 +17,7 @@ use rustc_target::spec::abi::Abi as CallAbi;
17
17
use crate :: const_eval:: CheckAlignment ;
18
18
19
19
use super :: {
20
- AllocBytes , AllocId , AllocRange , Allocation , ConstAllocation , Frame , ImmTy , InterpCx ,
20
+ AllocBytes , AllocId , AllocRange , Allocation , ConstAllocation , FnArg , Frame , ImmTy , InterpCx ,
21
21
InterpResult , MemoryKind , OpTy , Operand , PlaceTy , Pointer , Provenance , Scalar ,
22
22
} ;
23
23
@@ -84,7 +84,7 @@ pub trait AllocMap<K: Hash + Eq, V> {
84
84
85
85
/// Methods of this trait signifies a point where CTFE evaluation would fail
86
86
/// and some use case dependent behaviour can instead be applied.
87
- pub trait Machine < ' mir , ' tcx > : Sized {
87
+ pub trait Machine < ' mir , ' tcx : ' mir > : Sized {
88
88
/// Additional memory kinds a machine wishes to distinguish from the builtin ones
89
89
type MemoryKind : Debug + std:: fmt:: Display + MayLeak + Eq + ' static ;
90
90
@@ -182,7 +182,7 @@ pub trait Machine<'mir, 'tcx>: Sized {
182
182
ecx : & mut InterpCx < ' mir , ' tcx , Self > ,
183
183
instance : ty:: Instance < ' tcx > ,
184
184
abi : CallAbi ,
185
- args : & [ OpTy < ' tcx , Self :: Provenance > ] ,
185
+ args : & [ FnArg < ' tcx , Self :: Provenance > ] ,
186
186
destination : & PlaceTy < ' tcx , Self :: Provenance > ,
187
187
target : Option < mir:: BasicBlock > ,
188
188
unwind : mir:: UnwindAction ,
@@ -194,7 +194,7 @@ pub trait Machine<'mir, 'tcx>: Sized {
194
194
ecx : & mut InterpCx < ' mir , ' tcx , Self > ,
195
195
fn_val : Self :: ExtraFnVal ,
196
196
abi : CallAbi ,
197
- args : & [ OpTy < ' tcx , Self :: Provenance > ] ,
197
+ args : & [ FnArg < ' tcx , Self :: Provenance > ] ,
198
198
destination : & PlaceTy < ' tcx , Self :: Provenance > ,
199
199
target : Option < mir:: BasicBlock > ,
200
200
unwind : mir:: UnwindAction ,
@@ -418,6 +418,18 @@ pub trait Machine<'mir, 'tcx>: Sized {
418
418
Ok ( ( ) )
419
419
}
420
420
421
+ /// Called on places used for in-place function argument and return value handling.
422
+ ///
423
+ /// These places need to be protected to make sure the program cannot tell whether the
424
+ /// argument/return value was actually copied or passed in-place..
425
+ fn protect_in_place_function_argument (
426
+ ecx : & mut InterpCx < ' mir , ' tcx , Self > ,
427
+ place : & PlaceTy < ' tcx , Self :: Provenance > ,
428
+ ) -> InterpResult < ' tcx > {
429
+ // Without an aliasing model, all we can do is put `Uninit` into the place.
430
+ ecx. write_uninit ( place)
431
+ }
432
+
421
433
/// Called immediately before a new stack frame gets pushed.
422
434
fn init_frame_extra (
423
435
ecx : & mut InterpCx < ' mir , ' tcx , Self > ,
@@ -439,6 +451,14 @@ pub trait Machine<'mir, 'tcx>: Sized {
439
451
Ok ( ( ) )
440
452
}
441
453
454
+ /// Called just before the return value is copied to the caller-provided return place.
455
+ fn before_stack_pop (
456
+ _ecx : & InterpCx < ' mir , ' tcx , Self > ,
457
+ _frame : & Frame < ' mir , ' tcx , Self :: Provenance , Self :: FrameExtra > ,
458
+ ) -> InterpResult < ' tcx > {
459
+ Ok ( ( ) )
460
+ }
461
+
442
462
/// Called immediately after a stack frame got popped, but before jumping back to the caller.
443
463
/// The `locals` have already been destroyed!
444
464
fn after_stack_pop (
@@ -484,7 +504,7 @@ pub macro compile_time_machine(<$mir: lifetime, $tcx: lifetime>) {
484
504
_ecx : & mut InterpCx < $mir, $tcx, Self > ,
485
505
fn_val : !,
486
506
_abi : CallAbi ,
487
- _args : & [ OpTy < $tcx> ] ,
507
+ _args : & [ FnArg < $tcx> ] ,
488
508
_destination : & PlaceTy < $tcx, Self :: Provenance > ,
489
509
_target : Option < mir:: BasicBlock > ,
490
510
_unwind : mir:: UnwindAction ,
0 commit comments