Skip to content

Commit

Permalink
Merge #210
Browse files Browse the repository at this point in the history
210: Ensure yksom works safely with untraceable allocation r=ltratt a=jacob-hughes



Co-authored-by: Jake Hughes <jh@jakehughes.uk>
  • Loading branch information
bors[bot] and jacob-hughes committed May 7, 2021
2 parents ba57c0f + c9d0bfe commit 585f86c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 1 deletion.
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
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

0 comments on commit 585f86c

Please sign in to comment.