From 39625667a9b644d381502fc30742ee35d3bbf893 2020-02-04 15:07:29 From: Christopher Esterhuyse Date: 2020-02-04 15:07:29 Subject: [PATCH] more debug prints on branch predicates --- diff --git a/src/runtime/actors.rs b/src/runtime/actors.rs index 86aa3c4c3d1cf33c7a78ac5224b83a4ff0ed58b6..113915b302e6dab02f840e54c246bd302dc52625 100644 --- a/src/runtime/actors.rs +++ b/src/runtime/actors.rs @@ -54,6 +54,8 @@ impl PolyP { mut to_run: Vec<(Predicate, BranchP)>, ) -> Result { use SyncRunResult as Srr; + let cid = m_ctx.inner.channel_id_stream.controller_id; + lockprintln!("{:?}: ~ Running branches for PolyP {:?}!", cid, m_ctx.my_subtree_id,); while let Some((mut predicate, mut branch)) = to_run.pop() { let mut r_ctx = BranchPContext { m_ctx: m_ctx.reborrow(), @@ -63,6 +65,13 @@ impl PolyP { }; use PolyBlocker as Sb; let blocker = branch.state.sync_run(&mut r_ctx, protocol_description); + lockprintln!( + "{:?}: ~ ... ran PolyP {:?} with branch pred {:?} to blocker {:?}", + cid, + r_ctx.m_ctx.my_subtree_id, + &predicate, + &blocker + ); match blocker { Sb::Inconsistent => {} // DROP Sb::CouldntReadMsg(ekey) => { diff --git a/src/runtime/communication.rs b/src/runtime/communication.rs index 8df9f261e33c9ae5c9929f5bdcc78c727ccb182e..c104fce7d64c39e494384136d76fda59f9862586 100644 --- a/src/runtime/communication.rs +++ b/src/runtime/communication.rs @@ -451,6 +451,11 @@ impl MonoContext for MonoPContext<'_> { type D = ProtocolD; type S = ProtocolS; fn new_component(&mut self, moved_ekeys: HashSet, init_state: Self::S) { + lockprintln!( + "{:?}: !! MonoContext callback to new_component with ekeys {:?}!", + self.inner.channel_id_stream.controller_id, + &moved_ekeys, + ); if moved_ekeys.is_subset(self.ekeys) { self.ekeys.retain(|x| !moved_ekeys.contains(x)); self.inner.mono_ps.push(MonoP { state: init_state, ekeys: moved_ekeys }); @@ -469,13 +474,24 @@ impl MonoContext for MonoPContext<'_> { info: EndpointInfo { polarity: Putter, channel_id }, endpoint: b, }); + lockprintln!( + "{:?}: !! MonoContext callback to new_channel. returning ekeys {:?}!", + self.inner.channel_id_stream.controller_id, + [kp, kg], + ); [kp, kg] } fn new_random(&self) -> u64 { type Bytes8 = [u8; std::mem::size_of::()]; let mut bytes = Bytes8::default(); getrandom::getrandom(&mut bytes).unwrap(); - unsafe { std::mem::transmute::(bytes) } + let val = unsafe { std::mem::transmute::(bytes) }; + lockprintln!( + "{:?}: !! MonoContext callback to new_random. returning val {:?}!", + self.inner.channel_id_stream.controller_id, + val, + ); + val } } @@ -565,10 +581,24 @@ impl PolyContext for BranchPContext<'_, '_> { fn is_firing(&self, ekey: Key) -> Option { assert!(self.ekeys.contains(&ekey)); let channel_id = self.m_ctx.inner.endpoint_exts.get(ekey).unwrap().info.channel_id; - self.predicate.query(channel_id) + let val = self.predicate.query(channel_id); + lockprintln!( + "{:?}: !! PolyContext callback to is_firing by {:?}! returning {:?}", + self.m_ctx.inner.channel_id_stream.controller_id, + self.m_ctx.my_subtree_id, + val, + ); + val } fn read_msg(&self, ekey: Key) -> Option<&Payload> { assert!(self.ekeys.contains(&ekey)); - self.inbox.get(&ekey) + let val = self.inbox.get(&ekey); + lockprintln!( + "{:?}: !! PolyContext callback to read_msg by {:?}! returning {:?}", + self.m_ctx.inner.channel_id_stream.controller_id, + self.m_ctx.my_subtree_id, + val, + ); + val } }