Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure yksom works safely with untraceable allocation #210

Merged
merged 3 commits into from
May 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Cargo.lock
target/
*.core
rebench.conf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One could argue that this one should be part of the repo, and part of CI ;)

rebench.data
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ arrayvec = "0.5"
cfgrammar = "0.9"
getopts = "0.2"
itertools = "0.9"
libgc = { git = "https://github.com/softdevteam/libgc" }
lrlex = "0.9"
lrpar = "0.9"
natrob = { git="https://github.com/softdevteam/natrob", features=["libgc"] }
Expand Down
1 change: 1 addition & 0 deletions src/lib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#![feature(arbitrary_self_types)]
#![feature(box_patterns)]
#![feature(coerce_unsized)]
#![feature(negative_impls)]
#![feature(dispatch_from_dyn)]
#![feature(entry_insert)]
#![feature(raw_ref_op)]
Expand Down
4 changes: 4 additions & 0 deletions src/lib/vm/objects/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use std::{

use std::gc::Gc;

use std::gc::NoTrace;

use crate::vm::{
core::VM,
error::{VMError, VMErrorKind},
Expand Down Expand Up @@ -44,6 +46,8 @@ pub struct NormalArray {
len: usize,
}

impl !NoTrace for NormalArray {}

// Since arrays have a fixed number of elements in their store, we do not need to allocate a separate
// object and store: we can fit both in a single block. We thus use a custom layout where
// the `NormalArray` comes first, followed immediately by a contiguous array of `Val`s. On a
Expand Down
4 changes: 4 additions & 0 deletions src/lib/vm/somstack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use std::gc::Gc;

use crate::vm::{objects::NormalArray, val::Val};

use std::gc::NoTrace;

pub const SOM_STACK_LEN: usize = 4096;

/// A contiguous stack of SOM values. This stack does minimal or no checking on important
Expand Down Expand Up @@ -34,6 +36,8 @@ pub struct SOMStack {
len: Cell<usize>,
}

impl !NoTrace for SOMStack {}

macro_rules! storage {
($self:ident) => {
// We assume that the stack immediately follows the `SOMStack` without padding. This
Expand Down
4 changes: 4 additions & 0 deletions src/lib/vm/val.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ use num_enum::{IntoPrimitive, UnsafeFromPrimitive};
use num_traits::{FromPrimitive, ToPrimitive};
use std::gc::Gc;

use std::gc::NoTrace;

use super::{
core::VM,
error::{VMError, VMErrorKind},
Expand Down Expand Up @@ -65,6 +67,8 @@ pub struct Val {
pub val: usize,
}

impl !NoTrace for Val {}

impl Val {
/// Create a new `Val` from an object that should be allocated on the heap.
pub fn from_obj<T: Obj + 'static>(obj: T) -> Val {
Expand Down