Add MemoryExtra in InterpretCx constructor params
This commit is contained in:
parent
8ec39423dd
commit
e475539096
@ -47,7 +47,7 @@ pub(crate) fn mk_eval_cx<'mir, 'tcx>(
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
) -> CompileTimeEvalContext<'mir, 'tcx> {
|
||||
debug!("mk_eval_cx: {:?}", param_env);
|
||||
InterpretCx::new(tcx.at(span), param_env, CompileTimeInterpreter::new())
|
||||
InterpretCx::new(tcx.at(span), param_env, CompileTimeInterpreter::new(), Default::default())
|
||||
}
|
||||
|
||||
pub(crate) fn eval_promoted<'mir, 'tcx>(
|
||||
@ -632,7 +632,11 @@ pub fn const_eval_raw_provider<'tcx>(
|
||||
}
|
||||
|
||||
let span = tcx.def_span(cid.instance.def_id());
|
||||
let mut ecx = InterpretCx::new(tcx.at(span), key.param_env, CompileTimeInterpreter::new());
|
||||
let mut ecx = InterpretCx::new(
|
||||
tcx.at(span),
|
||||
key.param_env,
|
||||
CompileTimeInterpreter::new(),
|
||||
Default::default());
|
||||
|
||||
let res = ecx.load_mir(cid.instance.def);
|
||||
res.map(|body| {
|
||||
|
@ -196,12 +196,17 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> LayoutOf for InterpretCx<'mir, 'tcx, M>
|
||||
}
|
||||
|
||||
impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> {
|
||||
pub fn new(tcx: TyCtxtAt<'tcx>, param_env: ty::ParamEnv<'tcx>, machine: M) -> Self {
|
||||
pub fn new(
|
||||
tcx: TyCtxtAt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
machine: M,
|
||||
memory_extra: M::MemoryExtra,
|
||||
) -> Self {
|
||||
InterpretCx {
|
||||
machine,
|
||||
tcx,
|
||||
param_env,
|
||||
memory: Memory::new(tcx),
|
||||
memory: Memory::new(tcx, memory_extra),
|
||||
stack: Vec::new(),
|
||||
vtables: FxHashMap::default(),
|
||||
}
|
||||
|
@ -106,11 +106,11 @@ where
|
||||
}
|
||||
|
||||
impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
|
||||
pub fn new(tcx: TyCtxtAt<'tcx>) -> Self {
|
||||
pub fn new(tcx: TyCtxtAt<'tcx>, extra: M::MemoryExtra) -> Self {
|
||||
Memory {
|
||||
alloc_map: M::MemoryMap::default(),
|
||||
dead_alloc_map: FxHashMap::default(),
|
||||
extra: M::MemoryExtra::default(),
|
||||
extra,
|
||||
tcx,
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user