Skip to content

Commit

Permalink
Merge pull request #23 from nikomatsakis/detransitize
Browse files Browse the repository at this point in the history
Detransitize the differential dataflow computation
  • Loading branch information
nikomatsakis authored May 14, 2018
2 parents 1d96cd7 + 8effcd1 commit 4945c13
Show file tree
Hide file tree
Showing 7 changed files with 421 additions and 8 deletions.
1 change: 1 addition & 0 deletions rust-toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nightly
5 changes: 4 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(deprecated)] // arg_enum! uses deprecated stuff

use crate::intern;
use crate::output::Output;
use crate::tab_delim;
Expand All @@ -10,6 +12,7 @@ arg_enum! {
#[derive(Debug, Clone, Copy)]
pub enum Algorithm {
Naive,
TimelyOpt,
}
}

Expand Down Expand Up @@ -45,7 +48,7 @@ pub fn main(opt: Opt) -> Result<(), Error> {
let verbose = opt.verbose | opt.stats;
let algorithm = opt.algorithm;
let all_facts = tab_delim::load_tab_delimited_facts(tables, &Path::new(&facts_dir))?;
timed(|| Output::compute(all_facts, algorithm, verbose))
timed(|| Output::compute(&all_facts, algorithm, verbose))
};

match result {
Expand Down
2 changes: 1 addition & 1 deletion src/facts.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use abomonation_derive::Abomonation;

/// The "facts" which are the basis of the NLL borrow analysis.
#[derive(Default)]
#[derive(Clone, Default)]
crate struct AllFacts {
/// `borrow_region(R, B, P)` -- the region R may refer to data
/// from borrow B starting at the point P (this is usually the
Expand Down
10 changes: 6 additions & 4 deletions src/output/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ use std::path::PathBuf;

mod dump;
mod tracking;
mod timely;
mod naive;
mod timely_opt;


#[derive(Clone, Debug)]
crate struct Output {
borrow_live_at: FxHashMap<Point, Vec<Loan>>,
crate borrow_live_at: FxHashMap<Point, Vec<Loan>>,

dump_enabled: bool,

Expand All @@ -36,9 +37,10 @@ crate struct Output {
}

impl Output {
crate fn compute(all_facts: AllFacts, algorithm: Algorithm, dump_enabled: bool) -> Self {
crate fn compute(all_facts: &AllFacts, algorithm: Algorithm, dump_enabled: bool) -> Self {
match algorithm {
Algorithm::Naive => timely::timely_dataflow(dump_enabled, all_facts),
Algorithm::Naive => naive::compute(dump_enabled, all_facts.clone()),
Algorithm::TimelyOpt => timely_opt::compute(dump_enabled, all_facts.clone()),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/output/timely.rs → src/output/naive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::sync::Mutex;
use timely;
use timely::dataflow::operators::*;

pub(super) fn timely_dataflow(dump_enabled: bool, all_facts: AllFacts) -> Output {
pub(super) fn compute(dump_enabled: bool, all_facts: AllFacts) -> Output {
let result = Arc::new(Mutex::new(Output::new(dump_enabled)));

// Use a channel to send `all_facts` to one worker (and only one)
Expand Down
Loading

0 comments on commit 4945c13

Please sign in to comment.