@@ -17,7 +17,7 @@ use rustc_target::spec::abi::Abi as CallAbi;
1717use crate :: const_eval:: CheckAlignment ;
1818
1919use super :: {
20- AllocBytes , AllocId , AllocRange , Allocation , ConstAllocation , Frame , ImmTy , InterpCx ,
20+ AllocBytes , AllocId , AllocRange , Allocation , ConstAllocation , FnArg , Frame , ImmTy , InterpCx ,
2121 InterpResult , MemoryKind , OpTy , Operand , PlaceTy , Pointer , Provenance , Scalar ,
2222} ;
2323
@@ -84,7 +84,7 @@ pub trait AllocMap<K: Hash + Eq, V> {
8484
8585/// Methods of this trait signifies a point where CTFE evaluation would fail
8686/// 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 {
8888 /// Additional memory kinds a machine wishes to distinguish from the builtin ones
8989 type MemoryKind : Debug + std:: fmt:: Display + MayLeak + Eq + ' static ;
9090
@@ -182,7 +182,7 @@ pub trait Machine<'mir, 'tcx>: Sized {
182182 ecx : & mut InterpCx < ' mir , ' tcx , Self > ,
183183 instance : ty:: Instance < ' tcx > ,
184184 abi : CallAbi ,
185- args : & [ OpTy < ' tcx , Self :: Provenance > ] ,
185+ args : & [ FnArg < ' tcx , Self :: Provenance > ] ,
186186 destination : & PlaceTy < ' tcx , Self :: Provenance > ,
187187 target : Option < mir:: BasicBlock > ,
188188 unwind : mir:: UnwindAction ,
@@ -194,7 +194,7 @@ pub trait Machine<'mir, 'tcx>: Sized {
194194 ecx : & mut InterpCx < ' mir , ' tcx , Self > ,
195195 fn_val : Self :: ExtraFnVal ,
196196 abi : CallAbi ,
197- args : & [ OpTy < ' tcx , Self :: Provenance > ] ,
197+ args : & [ FnArg < ' tcx , Self :: Provenance > ] ,
198198 destination : & PlaceTy < ' tcx , Self :: Provenance > ,
199199 target : Option < mir:: BasicBlock > ,
200200 unwind : mir:: UnwindAction ,
@@ -418,6 +418,18 @@ pub trait Machine<'mir, 'tcx>: Sized {
418418 Ok ( ( ) )
419419 }
420420
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+
421433 /// Called immediately before a new stack frame gets pushed.
422434 fn init_frame_extra (
423435 ecx : & mut InterpCx < ' mir , ' tcx , Self > ,
@@ -439,6 +451,14 @@ pub trait Machine<'mir, 'tcx>: Sized {
439451 Ok ( ( ) )
440452 }
441453
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+
442462 /// Called immediately after a stack frame got popped, but before jumping back to the caller.
443463 /// The `locals` have already been destroyed!
444464 fn after_stack_pop (
@@ -484,7 +504,7 @@ pub macro compile_time_machine(<$mir: lifetime, $tcx: lifetime>) {
484504 _ecx : & mut InterpCx < $mir, $tcx, Self > ,
485505 fn_val : !,
486506 _abi : CallAbi ,
487- _args : & [ OpTy < $tcx> ] ,
507+ _args : & [ FnArg < $tcx> ] ,
488508 _destination : & PlaceTy < $tcx, Self :: Provenance > ,
489509 _target : Option < mir:: BasicBlock > ,
490510 _unwind : mir:: UnwindAction ,
0 commit comments