Skip to content

Commit

Permalink
feat: try to use boa gc
Browse files Browse the repository at this point in the history
  • Loading branch information
CertainLach committed Jan 16, 2024
1 parent eeb6fd0 commit 7fd85a5
Show file tree
Hide file tree
Showing 39 changed files with 498 additions and 457 deletions.
88 changes: 66 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/jsonnet/src/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use jrsonnet_evaluator::{
error::{ErrorKind::*, Result},
FileImportResolver, ImportResolver,
};
use jrsonnet_gcmodule::Trace;
use boa_gc::Trace;
use jrsonnet_parser::{SourceDirectory, SourceFile, SourcePath};

use crate::VM;
Expand Down
2 changes: 1 addition & 1 deletion crates/jrsonnet-evaluator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jrsonnet-interner.workspace = true
jrsonnet-parser.workspace = true
jrsonnet-types.workspace = true
jrsonnet-macros.workspace = true
jrsonnet-gcmodule.workspace = true

pathdiff.workspace = true
hashbrown.workspace = true
Expand All @@ -57,3 +56,4 @@ annotate-snippets = { workspace = true, features = ["color"], optional = true }
# Bigint
num-bigint = { workspace = true, features = ["serde"], optional = true }
derivative.workspace = true
boa_gc = { git = "https://github.com/boa-dev/boa", version = "0.17.0" }
14 changes: 7 additions & 7 deletions crates/jrsonnet-evaluator/src/arr/mod.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
use std::any::Any;

use jrsonnet_gcmodule::{Cc, Trace};
use boa_gc::{Gc, Trace, Finalize, GcBox};

Check warning on line 3 in crates/jrsonnet-evaluator/src/arr/mod.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused import: `GcBox`
use jrsonnet_interner::IBytes;
use jrsonnet_parser::LocExpr;

use crate::{function::FuncVal, gc::TraceBox, tb, Context, Result, Thunk, Val};
use crate::{DynGcBox, dyn_gc_box};
use crate::{function::FuncVal, Context, Result, Thunk, Val};

mod spec;
pub use spec::ArrayLike;
pub(crate) use spec::*;

/// Represents a Jsonnet array value.
#[derive(Debug, Clone, Trace)]
#[derive(Debug, Clone, Trace, Finalize)]
// may contrain other ArrValue
#[trace(tracking(force))]
pub struct ArrValue(Cc<TraceBox<dyn ArrayLike>>);
pub struct ArrValue(DynGcBox<dyn ArrayLike>);

pub trait ArrayLikeIter<T>: Iterator<Item = T> + DoubleEndedIterator + ExactSizeIterator {}
impl<I, T> ArrayLikeIter<T> for I where
Expand All @@ -24,7 +24,7 @@ impl<I, T> ArrayLikeIter<T> for I where

impl ArrValue {
pub fn new(v: impl ArrayLike) -> Self {
Self(Cc::new(tb!(v)))
Self(dyn_gc_box!(v))
}
pub fn empty() -> Self {
Self::new(RangeArray::empty())
Expand Down Expand Up @@ -177,7 +177,7 @@ impl ArrValue {
}

pub fn ptr_eq(a: &Self, b: &Self) -> bool {
Cc::ptr_eq(&a.0, &b.0)
Gc::ptr_eq(&a.0, &b.0)
}

/// Is this vec supports `.get_cheap()?`
Expand Down
Loading

0 comments on commit 7fd85a5

Please sign in to comment.