Changeset - f91ffb2597cc
[Not reviewed]
0 2 0
Christopher Esterhuyse - 5 years ago 2020-04-20 13:28:53
christopher.esterhuyse@gmail.com
had my predicates backwards. fixed bug in Native's recv_react proc
2 files changed with 28 insertions and 24 deletions:
0 comments (0 inline, 0 general)
src/runtime/actors.rs
Show inline comments
 
@@ -323,10 +323,10 @@ impl PolyP {
 
                            if payload_branch.blocking_on == Some(ekey) {
 
                                // run the fork
 
                                payload_branch.blocking_on = None;
 
                                Some((old_predicate, payload_branch))
 
                                Some((payload_predicate.clone(), payload_branch))
 
                            } else {
 
                                // don't bother running. its awaiting something else
 
                                incomplete2.insert(old_predicate, payload_branch);
 
                                incomplete2.insert(payload_predicate.clone(), payload_branch);
 
                                None
 
                            }
 
                        }
 
@@ -379,6 +379,7 @@ impl PolyN {
 
            let mut report_if_solution =
 
                |branch: &BranchN, pred: &Predicate, logger: &mut String| {
 
                    if branch.to_get.is_empty() {
 
                        log!(logger, "Native reporting solution with inbox {:#?}", &branch.gotten);
 
                        solution_storage.submit_and_digest_subtree_solution(
 
                            logger,
 
                            SubtreeId::PolyN,
 
@@ -396,14 +397,14 @@ impl PolyN {
 
            );
 
            match case {
 
                Csr::Nonexistant => { /* skip branch */ }
 
                Csr::FormerNotLatter | Csr::Equivalent => {
 
                Csr::LatterNotFormer | Csr::Equivalent => {
 
                    // Feed the message to this branch in-place. no need to modify pred.
 
                    if branch.to_get.remove(&ekey) {
 
                        branch.gotten.insert(ekey, payload.clone());
 
                        report_if_solution(&branch, &old_predicate, logger);
 
                    }
 
                }
 
                Csr::LatterNotFormer => {
 
                Csr::FormerNotLatter => {
 
                    // create a new branch with the payload_predicate.
 
                    let mut forked = branch.clone();
 
                    if forked.to_get.remove(&ekey) {
 
@@ -422,15 +423,10 @@ impl PolyN {
 
                    }
 
                }
 
            }
 
            // unlike PolyP machines, Native branches do not become inconsistent
 
            // unlike PolyP machines, Native branches do NOT become inconsistent
 
            branches2.insert(old_predicate, branch);
 
        }
 
        log!(
 
            logger,
 
            "Native now has {} branches with predicates: {:?}",
 
            branches2.len(),
 
            branches2.keys().collect::<Vec<_>>()
 
        );
 
        log!(logger, "Native now has branches {:#?}", &branches2);
 
        std::mem::swap(&mut branches2, &mut self.branches);
 
    }
 

	
src/runtime/communication.rs
Show inline comments
 
@@ -7,8 +7,15 @@ impl Controller {
 
        let ret = match &decision {
 
            Decision::Success(predicate) => {
 
                // overwrite MonoN/P
 
                self.inner.mono_n =
 
                    self.ephemeral.poly_n.take().unwrap().choose_mono(predicate).unwrap();
 
                self.inner.mono_n = {
 
                    let poly_n = self.ephemeral.poly_n.take().unwrap();
 
                    poly_n.choose_mono(predicate).unwrap_or_else(|| {
 
                        panic!(
 
                            "Ending round with decision pred {:#?} but poly_n has branches {:#?}. My log is... {}",
 
                            &predicate, &poly_n.branches, &self.inner.logger
 
                        );
 
                    })
 
                };
 
                self.inner.mono_ps.clear();
 
                self.inner.mono_ps.extend(
 
                    self.ephemeral
 
@@ -419,6 +426,7 @@ impl Controller {
 
                    return self.end_round_with_decision(decision);
 
                }
 
                CommMsgContents::SendPayload { payload_predicate, payload } => {
 
                    // check that we expect to be able to receive payloads from this sender
 
                    assert_eq!(
 
                        Getter,
 
                        self.inner.endpoint_exts.get(received.recipient).unwrap().info.polarity
 
@@ -434,6 +442,17 @@ impl Controller {
 
                        &payload_predicate,
 
                        &payload
 
                    );
 
                    let channel_id = self
 
                        .inner
 
                        .endpoint_exts
 
                        .get(received.recipient)
 
                        .expect("UEHFU")
 
                        .info
 
                        .channel_id;
 
                    if payload_predicate.query(channel_id) != Some(true) {
 
                        // sender didn't preserve the invariant
 
                        return Err(SyncErr::PayloadPremiseExcludesTheChannel(channel_id));
 
                    }
 
                    match subtree_id {
 
                        None => {
 
                            // this happens when a message is sent to a component that has exited.
 
@@ -455,17 +474,6 @@ impl Controller {
 
                        }
 
                        Some(PolyId::P { index }) => {
 
                            // Message for protocol actor
 
                            let channel_id = self
 
                                .inner
 
                                .endpoint_exts
 
                                .get(received.recipient)
 
                                .expect("UEHFU")
 
                                .info
 
                                .channel_id;
 
                            if payload_predicate.query(channel_id) != Some(true) {
 
                                // sender didn't preserve the invariant
 
                                return Err(SyncErr::PayloadPremiseExcludesTheChannel(channel_id));
 
                            }
 
                            let poly_p = &mut self.ephemeral.poly_ps[*index];
 

	
 
                            let m_ctx = PolyPContext {
0 comments (0 inline, 0 general)