diff --git a/src/runtime2/branch.rs b/src/runtime2/branch.rs index 8f156102d6828c75c8a77f8b7bdb5dc15b3f46c8..297585f7909df4eb0857c86295c3e2782ff1e78c 100644 --- a/src/runtime2/branch.rs +++ b/src/runtime2/branch.rs @@ -3,7 +3,7 @@ use std::ops::{Index, IndexMut}; use crate::protocol::ComponentState; use crate::protocol::eval::{Value, ValueGroup}; -use crate::runtime2::port::{Port, PortIdLocal}; +use crate::runtime2::port::PortIdLocal; /// Generic branch ID. A component will always have one branch: the /// non-speculative branch. This branch has ID 0. Hence in a speculative context @@ -78,14 +78,14 @@ impl Branch { /// parent of the new branch within the execution tree. fn new_sync(new_index: u32, parent_branch: &Branch) -> Self { debug_assert!( - (parent_branch.sync_state == SpeculativeState::RunningNonSync && !parent_branch.parent_index.is_valid()) || - (parent_branch.sync_state == SpeculativeState::HaltedAtBranchPoint) - ); + (parent_branch.sync_state == SpeculativeState::RunningNonSync && !parent_branch.parent_id.is_valid()) || + (parent_branch.sync_state == SpeculativeState::HaltedAtBranchPoint) + ); // forking from non-sync, or forking from a branching point debug_assert!(parent_branch.prepared_channel.is_none()); Branch { id: BranchId::new(new_index), - parent_id: parent_branch.index, + parent_id: parent_branch.id, code_state: parent_branch.code_state.clone(), sync_state: SpeculativeState::RunningInSync, awaiting_port: parent_branch.awaiting_port, @@ -130,7 +130,7 @@ impl BranchQueue { const NUM_QUEUES: usize = 3; -#[derive(PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub(crate) enum QueueKind { Runnable, AwaitingMessage, @@ -160,7 +160,7 @@ pub(crate) struct ExecTree { // All branches. the `parent_id` field in each branch implies the shape of // the tree. Branches are index stable throughout a sync round. pub branches: Vec, - pub queues: [BranchQueue; NUM_QUEUES] + queues: [BranchQueue; NUM_QUEUES] } impl ExecTree { @@ -235,7 +235,7 @@ impl ExecTree { branch.next_in_queue.index as usize }, None => { - queue.first as usize + queue.first.index as usize } }; @@ -322,7 +322,7 @@ impl IndexMut for ExecTree { } } -pub struct BranchQueueIter<'a> { +pub(crate) struct BranchQueueIter<'a> { branches: &'a [Branch], index: usize, } @@ -342,7 +342,7 @@ impl<'a> Iterator for BranchQueueIter<'a> { } } -pub struct BranchParentIter<'a> { +pub(crate) struct BranchParentIter<'a> { branches: &'a [Branch], index: usize, }