feat(gc): WIP
This commit is contained in:
@@ -79,7 +79,7 @@ impl<'gc> Func<'gc> {
|
||||
.borrow_mut(mc)
|
||||
.get_or_insert_with(|| vm.compile_func(self.func))
|
||||
.clone();
|
||||
let ret = unsafe { compiled.call(env.as_ref() as *const VmEnv, mc as *const _) };
|
||||
let ret = unsafe { compiled(env.as_ref() as *const VmEnv, mc as *const _) };
|
||||
Ok(ret.into())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,19 +7,12 @@ use crate::env::VmEnv;
|
||||
|
||||
use super::Value;
|
||||
|
||||
#[derive(Clone, PartialEq)]
|
||||
#[derive(Clone, PartialEq, Collect)]
|
||||
#[collect(no_drop)]
|
||||
pub struct List<'gc> {
|
||||
data: Vec<Value<'gc>>,
|
||||
}
|
||||
|
||||
unsafe impl<'gc> Collect<'gc> for List<'gc> {
|
||||
fn trace<Tr: gc_arena::collect::Trace<'gc>>(&self, cc: &mut Tr) {
|
||||
for v in self.data.iter() {
|
||||
v.trace(cc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'gc> List<'gc> {
|
||||
pub fn new() -> Self {
|
||||
List {
|
||||
|
||||
@@ -562,9 +562,9 @@ impl<'gc> Thunk<'gc> {
|
||||
*self.thunk.borrow_mut(mc) = _Thunk::Value(value);
|
||||
}
|
||||
|
||||
pub fn get_value(&self) -> Option<Value<'gc>> {
|
||||
if let _Thunk::Value(val) = &*self.thunk.borrow() {
|
||||
Some(val.clone())
|
||||
pub fn get_value(&self) -> Option<&Value<'gc>> {
|
||||
if let _Thunk::Value(val) = unsafe { &*self.thunk.as_ptr() } {
|
||||
Some(val)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user