diff --git a/src/runtime2/inbox.rs b/src/runtime2/inbox.rs index f1175db78a17bb428cdee71c3bf0cc6c8d43210a..91db3a3711b6eecb1bfb71020328bbc54fad2f25 100644 --- a/src/runtime2/inbox.rs +++ b/src/runtime2/inbox.rs @@ -13,10 +13,32 @@ use super::port::PortIdLocal; #[derive(Debug, Copy, Clone)] pub(crate) struct PortAnnotation { pub port_id: PortIdLocal, - pub registered_id: Option, + pub registered_id: Option, pub expected_firing: Option, } +/// Marker for a branch in a port mapping. A marker is, like a branch ID, a +/// unique identifier for a branch, but differs in that a branch only has one +/// branch ID, but might have multiple associated markers (i.e. one branch +/// performing a `put` three times will generate three markers. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub(crate) struct BranchMarker{ + marker: u32, +} + +impl BranchMarker { + #[inline] + pub(crate) fn new(marker: u32) -> Self { + debug_assert!(marker != 0); + return Self{ marker }; + } + + #[inline] + pub(crate) fn new_invalid() -> Self { + return Self{ marker: 0 } + } +} + /// The header added by the synchronization algorithm to all. #[derive(Debug, Clone)] pub(crate) struct SyncHeader { @@ -31,7 +53,7 @@ pub(crate) struct DataHeader { pub expected_mapping: Vec, pub sending_port: PortIdLocal, pub target_port: PortIdLocal, - pub new_mapping: BranchId, + pub new_mapping: BranchMarker, } // TODO: Very much on the fence about this. On one hand I thought making it a