fix(vm): lifetime (still does not compile)
This commit is contained in:
@@ -55,14 +55,12 @@ pub fn run(mut prog: Program) -> Result<p::Value> {
|
|||||||
let arena: Arena<Rootable![GcRoot<'_>]> = Arena::new(|mc| {
|
let arena: Arena<Rootable![GcRoot<'_>]> = Arena::new(|mc| {
|
||||||
new(&mut prog, mc)
|
new(&mut prog, mc)
|
||||||
});
|
});
|
||||||
eval(prog.top_level.into_iter(), &arena, |val| {
|
eval(prog.top_level.into_iter(), &arena, |val, vm| {
|
||||||
Ok(arena.mutate(|_, root: &GcRoot| {
|
Ok(val.to_public(vm, &mut HashSet::new()))
|
||||||
val.to_public(&root.vm, &mut HashSet::new())
|
|
||||||
}))
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn eval<'gc, T, F: for<'a> FnOnce(Value<'a>) -> Result<T>>(
|
fn eval<'gc, T, F: for<'a> FnOnce(Value<'a>, &VM<'a>) -> Result<T>>(
|
||||||
opcodes: impl Iterator<Item = OpCode>,
|
opcodes: impl Iterator<Item = OpCode>,
|
||||||
arena: &Arena<impl for<'a> Rootable<'a, Root = GcRoot<'a>>>,
|
arena: &Arena<impl for<'a> Rootable<'a, Root = GcRoot<'a>>>,
|
||||||
f: F
|
f: F
|
||||||
@@ -87,7 +85,7 @@ fn eval<'gc, T, F: for<'a> FnOnce(Value<'a>) -> Result<T>>(
|
|||||||
assert_eq!(ctx.stack.len(), 1);
|
assert_eq!(ctx.stack.len(), 1);
|
||||||
let mut ret = ctx.stack.pop();
|
let mut ret = ctx.stack.pop();
|
||||||
ret.force(&root.vm, mc);
|
ret.force(&root.vm, mc);
|
||||||
f(ret)
|
f(ret, &root.vm)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user