feat: get rid of gc and cyclic thunk
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
use hashbrown::HashSet;
|
||||
use gc_arena::{Collect, Gc, Mutation};
|
||||
use std::rc::Weak;
|
||||
|
||||
use hashbrown::HashSet;
|
||||
|
||||
use crate::env::VmEnv;
|
||||
use crate::ty::public as p;
|
||||
use crate::vm::VM;
|
||||
use crate::env::VmEnv;
|
||||
|
||||
use super::Value;
|
||||
|
||||
@@ -12,17 +13,15 @@ pub struct List<'gc> {
|
||||
data: Vec<Value<'gc>>,
|
||||
}
|
||||
|
||||
unsafe impl<'gc> Collect<'gc> for List<'gc> {
|
||||
fn trace<T: gc_arena::collect::Trace<'gc>>(&self, cc: &mut T) {
|
||||
self.data.trace(cc);
|
||||
impl<'gc> Default for List<'gc> {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'gc> List<'gc> {
|
||||
pub fn new() -> Self {
|
||||
List {
|
||||
data: Vec::new(),
|
||||
}
|
||||
List { data: Vec::new() }
|
||||
}
|
||||
|
||||
pub fn with_capacity(cap: usize) -> Self {
|
||||
@@ -41,10 +40,10 @@ impl<'gc> List<'gc> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn capture(&mut self, env: Gc<'gc, VmEnv<'gc>>, mc: &Mutation<'gc>) {
|
||||
pub fn capture(&mut self, env: &Weak<VmEnv<'gc>>) {
|
||||
self.data.iter().for_each(|v| {
|
||||
if let Value::Thunk(ref thunk) = v.clone() {
|
||||
thunk.capture_env(env, mc);
|
||||
thunk.capture_env_weak(env.clone());
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user