about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir/interpret
AgeCommit message (Collapse)AuthorLines
2022-11-08another attempt at performance improvementsRalf Jung-23/+26
2022-11-07less unsupported errors in Miri, and clarifying commentsRalf Jung-9/+9
2022-11-07try to make things faster when only ptr provenance can existRalf Jung-5/+17
2022-11-06make uninit_mask a unit testRalf Jung-1/+22
2022-11-06move InitMask to its own moduleRalf Jung-587/+567
2022-11-06dont debug-print allocations, that's too verboseRalf Jung-4/+4
2022-11-06interpret: support for per-byte provenanceRalf Jung-185/+312
2022-10-22Auto merge of #103227 - lcnr:bye-bye-unevaluated-const, r=oli-obkbors-1/+25
stop using `ty::UnevaluatedConst` directly best reviewed commit by commit. simplifies #99798 because we now don't have to expand `ty::UnevaluatedConst` to `ty::Const`. I also remember some other places where using `ty::UnevaluatedConst` directly was annoying and caused issues, though I don't quite remember what they were rn '^^ r? `@oli-obk` cc `@JulianKnodt`
2022-10-21fix some typosRageking8-1/+1
2022-10-18`const_evaluatable_unchecked` to const evallcnr-1/+25
2022-10-14more dupe word typosRageking8-1/+1
2022-10-07make const_err a hard errorRalf Jung-18/+1
2022-10-04It's not about types or consts, but the lack of regionsOli Scherer-2/+2
2022-09-23rename Unevaluated to UnevaluatedConstb-naber-3/+3
2022-09-22introduce mir::Unevaluatedb-naber-3/+7
2022-09-19`DestructuredConst` split mir and tylcnr-1/+1
2022-09-17Auto merge of #98588 - b-naber:valtrees-cleanup, r=lcnrbors-2/+2
Use only ty::Unevaluated<'tcx, ()> in type system r? `@lcnr`
2022-09-15Replace more manual TypeFoldable and TypeVisitable impls with derivesOli Scherer-1/+1
2022-09-15derive various Lift impl instead of hand rolling themOli Scherer-18/+2
2022-09-13use ty::Unevaluated<'tcx, ()> in type systemb-naber-2/+2
2022-08-28improve OFFSET_IS_ADDR docsRalf Jung-2/+6
2022-08-27interpret: make read-pointer-as-bytes *always* work in MiriRalf Jung-95/+83
and show some extra information when it happens in CTFE
2022-08-27interpret: rename relocation → provenanceRalf Jung-95/+92
2022-08-26remove now-unused ScalarMaybeUninitRalf Jung-134/+1
2022-08-26make read_immediate error immediately on uninit, so ImmTy can carry ↵Ralf Jung-17/+8
initialized Scalar
2022-08-26remove some now-unnecessary parameters from check_bytesRalf Jung-19/+4
2022-07-30avoid assertion failures in try_to_scalar_intRalf Jung-1/+3
2022-07-23now we can make scalar_to_ptr a method on ScalarRalf Jung-0/+18
2022-07-20various nits from reviewRalf Jung-1/+1
2022-07-20consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable)Ralf Jung-14/+14
2022-07-20make use of symbolic vtables in interpreterRalf Jung-18/+9
2022-07-20rename get_global_alloc to try_get_global_allocRalf Jung-5/+12
2022-07-20add a Vtable kind of symbolic allocationsRalf Jung-4/+40
2022-07-19interpret: rename Tag/PointerTag to Prov/ProvenanceRalf Jung-95/+97
Let's avoid using two different terms for the same thing -- let's just call it "provenance" everywhere. In Miri, provenance consists of an AllocId and an SbTag (Stacked Borrows tag), which made this even more confusing.
2022-07-13get rid of MemPlaceMeta::PoisonRalf Jung-0/+2
MPlaceTy::dangling still exists, but now it is only called in places that actually conceptually allocate something new, so that's fine.
2022-07-09tweak names and output and blessRalf Jung-3/+3
2022-07-09review feedbackRalf Jung-3/+3
2022-07-09don't allow ZST in ScalarIntRalf Jung-8/+6
There are several indications that we should not ZST as a ScalarInt: - We had two ways to have ZST valtrees, either an empty `Branch` or a `Leaf` with a ZST in it. `ValTree::zst()` used the former, but the latter could possibly arise as well. - Likewise, the interpreter had `Immediate::Uninit` and `Immediate::Scalar(Scalar::ZST)`. - LLVM codegen already had to special-case ZST ScalarInt. So instead add new ZST variants to those types that did not have other variants which could be used for this purpose.
2022-07-06interpret: use AllocRange in UninitByteAccessRalf Jung-60/+51
also use nice new format string syntax in interpret/error.rs
2022-07-06Auto merge of #98206 - eggyal:align-to-chalk-folding-api, r=jackh726bors-2/+2
Split TypeVisitable from TypeFoldable Impl of rust-lang/compiler-team#520 following MCP approval. r? `@ghost`
2022-07-06Update TypeVisitor pathsAlan Egerton-1/+1
2022-07-05impl TypeVisitable in type traversal macrosAlan Egerton-1/+1
2022-07-05adjust dangling-int-ptr error messageRalf Jung-12/+25
2022-07-05Rollup merge of #98811 - RalfJung:interpret-alloc-range, r=oli-obkDylan DPC-25/+21
Interpret: AllocRange Debug impl, and use it more consistently The two commits are pretty independent but it did not seem worth having two PRs for them. r? ``@oli-obk``
2022-07-02more use of format! variable captureRalf Jung-2/+2
Co-authored-by: Joe ST <joe@fbstj.net>
2022-07-02Auto merge of #97585 - lqd:const-alloc-intern, r=RalfJungbors-6/+11
CTFE interning: don't walk allocations that don't need it The interning of const allocations visits the mplace looking for references to intern. Walking big aggregates like big static arrays can be costly, so we only do it if the allocation we're interning contains references or interior mutability. Walking ZSTs was avoided before, and this optimization is now applied to cases where there are no references/relocations either. --- While initially looking at this in the context of #93215, I've been testing with smaller allocations than the 16GB one in that issue, and with different init/uninit patterns (esp. via padding). In that example, by default, `eval_to_allocation_raw` is the heaviest query followed by `incr_comp_serialize_result_cache`. So I'll show numbers when incremental compilation is disabled, to focus on the const allocations themselves at 95% of the compilation time, at bigger array sizes on these minimal examples like `static ARRAY: [u64; LEN] = [0; LEN];`. That is a close construction to parts of the `ctfe-stress-test-5` benchmark, which has const allocations in the megabytes, while most crates usually have way smaller ones. This PR will have the most impact in these situations, as the walk during the interning starts to dominate the runtime. Unicode crates (some of which are present in our benchmarks) like `ucd`, `encoding_rs`, etc come to mind as having bigger than usual allocations as well, because of big tables of code points (in the hundreds of KB, so still an order of magnitude or 2 less than the stress test). In a check build, for a single static array shown above, from 100 to 10^9 u64s (for lengths in powers of ten), the constant factors are lowered: (log scales for easier comparisons) ![plot_log](https://user-images.githubusercontent.com/247183/171422958-16f1ea19-3ed4-4643-812c-1c7c60a97e19.png) (linear scale for absolute diff at higher Ns) ![plot_linear](https://user-images.githubusercontent.com/247183/171401886-2a869a4d-5cd5-47d3-9a5f-8ce34b7a6917.png) For one of the alternatives of that issue ```rust const ROWS: usize = 100_000; const COLS: usize = 10_000; static TWODARRAY: [[u128; COLS]; ROWS] = [[0; COLS]; ROWS]; ``` we can see a similar reduction of around 3x (from 38s to 12s or so). For the same size, the slowest case IIRC is when there are uninitialized bytes e.g. via padding ```rust const ROWS: usize = 100_000; const COLS: usize = 10_000; static TWODARRAY: [[(u64, u8); COLS]; ROWS] = [[(0, 0); COLS]; ROWS]; ``` then interning/walking does not dominate anymore (but means there is likely still some interesting work left to do here). Compile times in this case rise up quite a bit, and avoiding interning walks has less impact: around 23%, from 730s on master to 568s with this PR.
2022-07-02add AllocRange Debug impl; remove redundant AllocId Display implRalf Jung-25/+21
2022-06-29Auto merge of #98520 - RalfJung:invalid, r=compiler-errorsbors-2/+4
interpret: adjust error from constructing an invalid value
2022-06-29interpret: adjust error from constructing an invalid valueRalf Jung-2/+4
2022-06-28Improve pretty printing of valtrees for referencesDominik Stolz-7/+1