Skip to content

Commit b43b75d

Browse files
authored
Rollup merge of #134055 - RalfJung:interpret-alloc-dedup, r=oli-obk
interpret: clean up deduplicating allocation functions The "align" and "kind" arguments would be largely ignored in the "dedup" case, so let's move that to entirely separate function. Let's also remove support for old-style miri_resolve_frame while we are at it. The docs have already said for a while that this must be set to 1.
2 parents 8fc28e9 + 6271550 commit b43b75d

File tree

5 files changed

+3
-104
lines changed

5 files changed

+3
-104
lines changed

src/shims/backtrace.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use rustc_abi::{ExternAbi, Size};
2-
use rustc_ast::ast::Mutability;
32
use rustc_middle::ty::layout::LayoutOf as _;
43
use rustc_middle::ty::{self, Instance, Ty};
54
use rustc_span::{BytePos, Loc, Symbol, hygiene};
@@ -179,14 +178,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
179178

180179
match flags {
181180
0 => {
182-
// These are "mutable" allocations as we consider them to be owned by the callee.
183-
let name_alloc =
184-
this.allocate_str(&name, MiriMemoryKind::Rust.into(), Mutability::Mut)?;
185-
let filename_alloc =
186-
this.allocate_str(&filename, MiriMemoryKind::Rust.into(), Mutability::Mut)?;
187-
188-
this.write_immediate(name_alloc.to_ref(this), &this.project_field(dest, 0)?)?;
189-
this.write_immediate(filename_alloc.to_ref(this), &this.project_field(dest, 1)?)?;
181+
throw_unsup_format!("miri_resolve_frame: v0 is not supported any more");
190182
}
191183
1 => {
192184
this.write_scalar(

src/shims/panic.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//! metadata we remembered when pushing said frame.
1313
1414
use rustc_abi::ExternAbi;
15-
use rustc_ast::Mutability;
1615
use rustc_middle::{mir, ty};
1716
use rustc_target::spec::PanicStrategy;
1817

@@ -161,7 +160,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
161160
let this = self.eval_context_mut();
162161

163162
// First arg: message.
164-
let msg = this.allocate_str(msg, MiriMemoryKind::Machine.into(), Mutability::Not)?;
163+
let msg = this.allocate_str_dedup(msg)?;
165164

166165
// Call the lang item.
167166
let panic = this.tcx.lang_items().panic_fn().unwrap();
@@ -180,7 +179,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
180179
let this = self.eval_context_mut();
181180

182181
// First arg: message.
183-
let msg = this.allocate_str(msg, MiriMemoryKind::Machine.into(), Mutability::Not)?;
182+
let msg = this.allocate_str_dedup(msg)?;
184183

185184
// Call the lang item.
186185
let panic = this.tcx.lang_items().panic_nounwind().unwrap();

tests/pass/backtrace/backtrace-api-v0.rs

-69
This file was deleted.

tests/pass/backtrace/backtrace-api-v0.stderr

-18
This file was deleted.

tests/pass/backtrace/backtrace-api-v0.stdout

-5
This file was deleted.

0 commit comments

Comments
 (0)