Skip to content

Commit

Permalink
Visitor and VisitorMut can now optimize recursion for linear conn…
Browse files Browse the repository at this point in the history
…ections

This to avoid Brane WIR-like problems with long, linear workflows that cause the stack to overflow.
  • Loading branch information
Lut99 committed Oct 22, 2024
1 parent a496c3c commit 87abf6e
Show file tree
Hide file tree
Showing 2 changed files with 208 additions and 47 deletions.
8 changes: 4 additions & 4 deletions lib/reasoners/posix/src/workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Created:
// 11 Oct 2024, 16:54:04
// Last edited:
// 18 Oct 2024, 11:27:06
// 22 Oct 2024, 10:54:08
// Auto updated?
// Yes
//
Expand All @@ -17,7 +17,7 @@ use std::sync::LazyLock;

use tracing::{debug, span, Level};
use workflow::visitor::Visitor;
use workflow::{Dataset, ElemCall, Entity, Workflow};
use workflow::{Dataset, Elem, ElemCall, Entity, Workflow};


/***** CONSTANTS *****/
Expand Down Expand Up @@ -85,7 +85,7 @@ impl<'w> Visitor<'w> for DatasetCollector<'w> {
// self.write_sets.extend(repeat(location).zip(stop_sets.iter().cloned()));
// }

fn visit_call(&mut self, elem: &'w ElemCall) -> Result<(), Self::Error> {
fn visit_call(&mut self, elem: &'w ElemCall) -> Result<Option<&'w Elem>, Self::Error> {
// We take a more simplified view on dataset reading/writing.

// We consider a task's inputs as READING. Any task's outputs are WRITING.
Expand All @@ -110,7 +110,7 @@ impl<'w> Visitor<'w> for DatasetCollector<'w> {
}

// Also visit the next one before returning, lol
self.visit(&elem.next)
Ok(Some(&elem.next))
}
}

Expand Down
Loading

0 comments on commit 87abf6e

Please sign in to comment.