Optimize miri engine performance for sanity checks of arrays #53845
Labels
A-const-eval
Area: Constant evaluation, covers all const contexts (static, const fn, ...)
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
E-medium
Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
The knowledge about all the elements in an array can be used to run a single check instead of running the checks on each element one at a time (suggested in #53671 (comment)).
This is currently only done for strings, but could just as well be done for arrays of various types with
Scalar
layout.The E-easy part of this issue is to check for arrays/slices of the builtin integer types and simply verify that there are no relocations in the entire array and that the entire array has no undefined bytes. Should be possible by simply calling
rust/src/librustc_mir/interpret/memory.rs
Line 740 in 1114ab6
Ok
. No need to actually check the value.The E-medium part is to refactor
rust/src/librustc_mir/interpret/validity.rs
Line 99 in 1114ab6
rust/src/librustc_mir/interpret/validity.rs
Line 101 in 1114ab6
rust/src/librustc_mir/interpret/validity.rs
Lines 110 to 113 in 1114ab6
rust/src/librustc_mir/interpret/validity.rs
Line 166 in 1114ab6
The text was updated successfully, but these errors were encountered: