1
Fork 0

Replace terminator-based const eval limit

- Remove logic that limits const eval based on terminators, and use the
  stable metric instead (back edges + fn calls)
- Add unstable flag `tiny-const-eval-limit` to add UI tests that do not
  have to go up to the regular 2M step limit
This commit is contained in:
Bryan Garza 2022-12-29 23:14:29 +00:00
parent 8d99b0fc8d
commit eea42733ac
17 changed files with 138 additions and 61 deletions

View file

@ -243,10 +243,10 @@ pub trait Machine<'mir, 'tcx>: Sized {
ecx.stack_mut()[frame].locals[local].access_mut()
}
/// Called before a basic block terminator is executed.
/// You can use this to detect endlessly running programs.
/// Called when the interpreter encounters a `StatementKind::ConstEvalCounter` instruction.
/// You can use this to detect long or endlessly running programs.
#[inline]
fn before_terminator(_ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
fn increment_const_eval_counter(_ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
Ok(())
}