rust/compiler/rustc_const_eval/src
bors cd6d8f2a04 Auto merge of #118336 - saethlin:const-to-op-cache, r=RalfJung
Return a finite number of AllocIds per ConstAllocation in Miri

Before this, every evaluation of a const slice would produce a new AllocId. So in Miri, this program used to have unbounded memory use:
```rust
fn main() {
    loop {
        helper();
    }
}

fn helper() {
    "ouch";
}
```
Every trip around the loop creates a new AllocId which we need to keep track of a base address for. And the provenance GC can never clean up that AllocId -> u64 mapping, because the AllocId is for a const allocation which will never be deallocated.

So this PR moves the logic of producing an AllocId for a ConstAllocation to the Machine trait, and the implementation that Miri provides will only produce 16 AllocIds for each allocation. The cache is also keyed on the Instance that the const is evaluated in, so that equal consts evaluated in two functions will have disjoint base addresses.

r? RalfJung
2024-01-24 10:17:12 +00:00
..
const_eval Auto merge of #119044 - RalfJung:intern-without-types, r=oli-obk 2024-01-23 14:08:08 +00:00
interpret Auto merge of #118336 - saethlin:const-to-op-cache, r=RalfJung 2024-01-24 10:17:12 +00:00
transform Auto merge of #119044 - RalfJung:intern-without-types, r=oli-obk 2024-01-23 14:08:08 +00:00
util const-eval interner: from-scratch rewrite using mutability information from provenance rather than types 2024-01-22 09:28:00 +01:00
errors.rs raw pointers are not references 2024-01-22 09:28:00 +01:00
lib.rs Use rustc_fluent_macro::fluent_messages! directly. 2023-11-26 08:38:40 +11:00