Skip to content

Commit e1dd65d

Browse files
committed
add write frame cursor offset as well
1 parent c32c9e2 commit e1dd65d

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/bit_machine/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,11 @@ impl BitMachine {
277277
}
278278

279279
'main_loop: loop {
280-
// Make a copy of the input frame to give to the tracker.
280+
// Capture read and write frames before the node action, to give to the tracker.
281+
// The read frame cursor is where the node's input begins.
282+
// The write frame cursor is where the node's output begins.
281283
let input_frame = self.read.last().map(Frame::shallow_copy);
284+
let output_frame = self.write.last().map(Frame::shallow_copy);
282285
let mut jet_result = Ok(());
283286

284287
match ip.inner() {
@@ -393,9 +396,8 @@ impl BitMachine {
393396
let output = match (ip.inner(), &jet_result) {
394397
(node::Inner::Unit | node::Inner::Iden | node::Inner::Witness(_), _)
395398
| (node::Inner::Jet(_), Ok(_)) => NodeOutput::Success(
396-
self.write
397-
.last()
398-
.map(|r| r.as_bit_iter(&self.data))
399+
output_frame
400+
.map(|frame| frame.as_bit_iter_from_cursor(&self.data))
399401
.unwrap_or(crate::BitIter::from([].iter().copied())),
400402
),
401403
(node::Inner::Jet(_), Err(_)) => NodeOutput::JetFailed,

0 commit comments

Comments
 (0)