Changeset - c2b16314e873
[Not reviewed]
0 6 0
Christopher Esterhuyse - 5 years ago 2020-10-28 09:37:42
christopher.esterhuyse@gmail.com
cleanup of unused code
6 files changed with 3 insertions and 32 deletions:
0 comments (0 inline, 0 general)
src/common.rs
Show inline comments
 
@@ -95,13 +95,12 @@ pub(crate) enum NonsyncBlocker {
 
pub(crate) enum SyncBlocker {
 
    Inconsistent,
 
    SyncBlockEnd,
 
    CouldntReadMsg(PortId),
 
    CouldntCheckFiring(PortId),
 
    PutMsg(PortId, Payload),
 
    NondetChoice { n: u16 },
 
}
 
pub(crate) struct DenseDebugHex<'a>(pub &'a [u8]);
 
pub(crate) struct DebuggableIter<I: Iterator<Item = T> + Clone, T: Debug>(pub(crate) I);
 
///////////////////// IMPL /////////////////////
 
impl IdParts for Id {
 
    fn id_parts(self) -> (ConnectorId, U32Suffix) {
src/protocol/arena.rs
Show inline comments
 
@@ -5,13 +5,13 @@ use core::marker::PhantomData;
 
#[derive(serde::Serialize, serde::Deserialize)]
 
pub struct Id<T> {
 
    index: u32,
 
    _phantom: PhantomData<T>,
 
}
 
#[derive(Debug, serde::Serialize, serde::Deserialize)]
 
pub struct Arena<T> {
 
pub(crate) struct Arena<T> {
 
    store: Vec<T>,
 
}
 
//////////////////////////////////
 

	
 
impl<T> Debug for Id<T> {
 
    fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
src/protocol/eval.rs
Show inline comments
 
@@ -3,17 +3,15 @@ use std::fmt;
 
use std::fmt::{Debug, Display, Formatter};
 
use std::{i16, i32, i64, i8};
 

	
 
use crate::common::*;
 

	
 
use crate::protocol::ast::*;
 
// use crate::protocol::inputsource::*;
 
// use crate::protocol::parser::*;
 
use crate::protocol::EvalContext;
 

	
 
const MAX_RECURSION: usize = 1024;
 
// const MAX_RECURSION: usize = 1024;
 

	
 
const BYTE_MIN: i64 = i8::MIN as i64;
 
const BYTE_MAX: i64 = i8::MAX as i64;
 
const SHORT_MIN: i64 = i16::MIN as i64;
 
const SHORT_MAX: i64 = i16::MAX as i64;
 
const INT_MIN: i64 = i32::MIN as i64;
src/runtime/communication.rs
Show inline comments
 
@@ -1092,26 +1092,12 @@ impl BranchingProtoComponent {
 
                            predicate.clone(),
 
                        );
 
                        branch.ended = true;
 
                        // This branch exits the cyclic drain
 
                        Self::insert_branch_merging(cd.output, predicate, branch);
 
                    }
 
                    B::NondetChoice { n } => {
 
                        // This branch requested the creation of a new n-way nondeterministic
 
                        // fork of the branch with a fresh speculative variable.
 
                        // ... allocate a new speculative variable
 
                        let var = rctx.spec_var_stream.next();
 
                        // ... and for n distinct values, create a new forked branch,
 
                        // and schedule them to be rerun through the cyclic drain.
 
                        for val in SpecVal::iter_domain().take(n as usize) {
 
                            let predicate_n = predicate.clone().inserted(var, val);
 
                            let mut branch_n = branch.clone();
 
                            branch_n.inner.untaken_choice = Some(val.0);
 
                            Self::insert_branch_merging(cd.swap, predicate_n, branch_n);
 
                        }
 
                    }
 
                }
 
            }
 
            std::mem::swap(cd.input, cd.swap);
 
        }
 
        Ok(())
 
    }
 
@@ -1437,17 +1423,7 @@ impl SyncProtoContext<'_> {
 
            // Make a note that this component has received
 
            // this port's message 1+ times this round
 
            self.branch_inner.did_put_or_get.insert(port);
 
        }
 
        maybe_msg
 
    }
 

	
 
    // NOT CURRENTLY USED
 
    // Once this component has injected a new nondeterministic branch with
 
    // SyncBlocker::NondetChoice, this is how the component retrieves it.
 
    // (Two step process necessary to get around mutable access rules,
 
    //  as injection of the nondeterministic choice modifies the
 
    //  branch predicate, forks the branch, etc.)
 
    pub(crate) fn take_choice(&mut self) -> Option<u16> {
 
        self.branch_inner.untaken_choice.take()
 
    }
 
}
src/runtime/mod.rs
Show inline comments
 
@@ -67,13 +67,12 @@ pub(crate) struct SyncProtoContext<'a> {
 

	
 
// The data coupled with a particular protocol component branch, but crucially omitting
 
// the `ComponentState` such that this may be passed by reference to the state with separate
 
// access control.
 
#[derive(Default, Debug, Clone)]
 
struct ProtoComponentBranchInner {
 
    untaken_choice: Option<u16>,
 
    did_put_or_get: HashSet<PortId>,
 
    inbox: HashMap<PortId, Payload>,
 
}
 

	
 
// A speculative variable that lives for the duration of the synchronous round.
 
// Each is assigned a value in domain `SpecVal`.
src/runtime/setup.rs
Show inline comments
 
@@ -3,13 +3,12 @@ use crate::runtime::*;
 

	
 
impl TokenTarget {
 
    // subdivides the domain of usize into
 
    // [NET_ENDPOINT][UDP_ENDPOINT  ]
 
    // ^0            ^usize::MAX/2   ^usize::MAX
 
    const HALFWAY_INDEX: usize = usize::MAX / 2;
 
    const MAX_INDEX: usize = usize::MAX;
 
}
 
impl From<Token> for TokenTarget {
 
    fn from(Token(index): Token) -> Self {
 
        if let Some(shifted) = index.checked_sub(Self::HALFWAY_INDEX) {
 
            TokenTarget::UdpEndpoint { index: shifted }
 
        } else {
 
@@ -1030,13 +1029,13 @@ fn session_optimize(
 
}
 

	
 
// Defines the optimization function, consuming an optimized map,
 
// and returning an optimized map.
 
fn leader_session_map_optimize(
 
    logger: &mut dyn Logger,
 
    mut m: HashMap<ConnectorId, SessionInfo>,
 
    m: HashMap<ConnectorId, SessionInfo>,
 
) -> Result<HashMap<ConnectorId, SessionInfo>, ConnectError> {
 
    log!(logger, "Session map optimize START");
 
    // currently, it's the identity function
 
    log!(logger, "Session map optimize END");
 
    Ok(m)
 
}
0 comments (0 inline, 0 general)