Skip to content

Commit

Permalink
Merge pull request #47 from lf-lang/remove-workspace
Browse files Browse the repository at this point in the history
Remove creusot sources and merge back vecmap into main runtime crate
  • Loading branch information
cmnrd authored Mar 13, 2024
2 parents 4ac6459 + 991d2fb commit 10fee74
Show file tree
Hide file tree
Showing 47 changed files with 75 additions and 26,295 deletions.
70 changes: 62 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,64 @@
[workspace]
[package]
name = "reactor_rt"
version = "0.1.0"
authors = ["Clément Fournier <clement.fournier76@gmail.com>"]
edition = "2021"

members = [
"runtime",
"vecmap",
]
exclude = [ "vecmap/creusot" ]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[profile.bench]
debug = true
[dependencies]
log = "0.4"
index_vec = "0.1"
#itertools = "0.10.1"
#bit-set = "0.5"
smallvec = { version = "1.10", features = ["const_generics"] }
petgraph = "0.6"
array-macro = "2.1"
atomic_refcell = "0.1"
crossbeam-utils = "0.8"
crossbeam-channel = { git = "https://github.com/oowekyala/crossbeam.git", rev = "9eed66904f969156dedad4eef61ce91d23b9cccb" }
static_assertions = "1.1.0"
rayon = { version = "1.5", optional = true }
cfg-if = "1.0.0"

[dev-dependencies]
criterion = "0.3"
env_logger = "0.9"
assert_matches = "1.5"
dmsort = "1.0.1"

[features]
default=["vec-id-sets"]
# Enable the parallel runtime implementation todo make default
parallel-runtime=["rayon"]
# Enables 64-bit wide reaction ids on 64 bit architectures.
# This may reduce performance, but allows for 2^32 reactor
# instances compared to the default of 2^16, which may feel
# a bit tight for some applications.
wide-ids=[]
vec-id-sets=[]
no-unsafe=[]
# used internally for benchmarking, to access private APIs
public-internals=[]

[[bench]]
name = "savina_pong"
harness = false

[[bench]]
name = "global_id"
path = "benches/micro/global_id.rs"
required-features = ["public-internals"]
harness = false

[[bench]]
name = "dmsort"
path = "benches/micro/dmsort.rs"
required-features = ["public-internals"]
harness = false

[[bench]]
name = "exec_reactions"
path = "benches/micro/exec_reactions.rs"
required-features = ["public-internals"]
harness = false
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion runtime/benches/savina_pong.rs → benches/savina_pong.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ mod reactors {
impl ::reactor_rt::assembly::ReactorInitializer for SavinaPongAdapter {
type Wrapped = SavinaPong;
type Params = SavinaPongParams;
const MAX_REACTION_ID: ::reactor_rt::LocalReactionId = ::reactor_rt::LocalReactionId::new(1 - 1);
const MAX_REACTION_ID: ::reactor_rt::LocalReactionId = ::reactor_rt::LocalReactionId::new(0);

fn assemble(
__params: Self::Params,
Expand Down
65 changes: 0 additions & 65 deletions runtime/Cargo.toml

This file was deleted.

2 changes: 1 addition & 1 deletion runtime/src/actions.rs → src/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl<T: Sync, K> ReactionTrigger<T> for Action<K, T> {
#[cfg(not(feature = "no-unsafe"))]
impl<T: Sync, K> triggers::ReactionTriggerWithRefAccess<T> for Action<K, T> {
fn get_value_ref(&self, now: &EventTag, _start: &Instant) -> Option<&T> {
self.map.get(&Reverse(*now)).map(|a| a.as_ref()).flatten()
self.map.get(&Reverse(*now)).and_then(|a| a.as_ref())
}
}

Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions runtime/src/lib.rs → src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
#[macro_use]
extern crate array_macro;
#[cfg(test)]
#[macro_use]
#[allow(unused)]
#[macro_use]
extern crate assert_matches;
#[macro_use]
extern crate index_vec;
Expand Down Expand Up @@ -94,12 +94,12 @@ pub use self::util::*;
pub mod test;

mod actions;
pub(self) mod ids;
mod ids;
mod ports;
mod scheduler;
mod time;
mod timers;
pub(self) mod triggers;
mod triggers;
mod util;

pub mod assembly;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion runtime/src/scheduler/debug.rs → src/scheduler/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ use std::collections::HashMap;
use std::fmt::{Display, Formatter, Result};
use std::ops::Range;

use crate::vecmap::VecMap;
use index_vec::{Idx, IndexVec};
use vecmap::VecMap;

use crate::assembly::{ReactorInitializer, TriggerId};
use crate::{GlobalReactionId, ReactorId};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ pub mod test {

fn new_ports<const N: usize>(&mut self, names: [&'static str; N]) -> [TriggerId; N] {
let result = array![_ => self.fixture.next_trigger_id.get_and_incr().unwrap(); N];
for (i, p) in (&result).iter().enumerate() {
for (i, p) in result.iter().enumerate() {
self.fixture.graph.record_port(*p);
self.fixture.debug_info.record_trigger(*p, Cow::Borrowed(names[i]));
}
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions runtime/src/scheduler/mod.rs → src/scheduler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ pub mod internals {
pub use super::dependencies::{ExecutableReactions, Level, LevelIx, ReactionLevelInfo};
}

pub(self) type ReactionPlan<'x> = Option<Cow<'x, ExecutableReactions<'x>>>;
pub(self) type ReactorBox<'a> = Box<dyn ReactorBehavior + 'a>;
pub(self) type ReactorVec<'a> = IndexVec<ReactorId, ReactorBox<'a>>;
type ReactionPlan<'x> = Option<Cow<'x, ExecutableReactions<'x>>>;
type ReactorBox<'a> = Box<dyn ReactorBehavior + 'a>;
type ReactorVec<'a> = IndexVec<ReactorId, ReactorBox<'a>>;

/// Can format stuff for trace messages.
#[derive(Clone)]
pub(self) struct DebugInfoProvider<'a> {
struct DebugInfoProvider<'a> {
id_registry: &'a DebugInfoRegistry,
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions runtime/src/util/mod.rs → src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
use std::convert::TryFrom;
use std::time::Duration;

pub(crate) mod vecmap;

#[macro_export]
#[doc(hidden)]
macro_rules! join_to {
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions vecmap/.gitignore

This file was deleted.

9 changes: 0 additions & 9 deletions vecmap/Cargo.toml

This file was deleted.

Loading

0 comments on commit 10fee74

Please sign in to comment.