public ExecutionState(StateImpl s, TraversalInfo predecessor, Via bt, bool MustFingerprint) : base(s, StateType.ExecutionState, predecessor, bt) { Debug.Assert(ProcessInfo != null && ProcessInfo.Length == NumProcesses); stateImpl = s; hasMultipleSuccessors = NumSuccessors() > 1; receipt = s.CheckIn(); if (!ZingerConfiguration.DoRandomSampling) { if (MustFingerprint) { this.fingerprint = s.Fingerprint; this.IsFingerPrinted = true; } else { this.fingerprint = null; this.IsFingerPrinted = false; } } }
public static void PrintTrace(Via[] bts) { int len = bts.Length; int i; Console.Write("{0} transitions: ", len); for (i = 0; i < len; i++) Console.Write(bts[i].ToString()); Console.WriteLine(""); }
public ExecutionState(StateImpl s, TraversalInfo predecessor, Via bt) : base(s, StateType.ExecutionState, predecessor, bt) { Debug.Assert(ProcessInfo != null && ProcessInfo.Length == NumProcesses); hasMultipleSuccessors = NumSuccessors() > 1; stateImpl = s; currProcess = 0; receipt = s.CheckIn(); #if true //dont fingerprint during random sampling if (!ZingerConfiguration.DoRandomSampling) { if (ZingerConfiguration.FingerprintSingleTransitionStates) { if (this.NumProcesses > 1) { this.fingerprint = s.Fingerprint; this.IsFingerPrinted = true; } else { // Fingerprint with probability p if (ZingerUtilities.rand.NextDouble() <= ZingerConfiguration.NonChooseProbability) { this.fingerprint = s.Fingerprint; this.IsFingerPrinted = true; } else { this.fingerprint = null; this.IsFingerPrinted = false; } } } else { this.fingerprint = s.Fingerprint; this.IsFingerPrinted = true; } } #endif }
protected override void Replay(TraversalInfo succ, Via bt) { ViaChoose vc = (ViaChoose)bt; StateImpl s = this.reclaimState(); s.RunChoice(vc.ChoiceNumber); succ.deOrphanize(s); }
public ChooseState(StateImpl s, TraversalInfo predecessor, Via bt, bool MustFingerprint) : base(s, StateType.ChooseState, predecessor, bt) { numChoices = s.NumChoices; stateImpl = s; hasMultipleSuccessors = s.NumChoices > 1; receipt = s.CheckIn(); if (!ZingerConfiguration.DoRandomSampling) { if (MustFingerprint) { fingerprint = s.Fingerprint; this.IsFingerPrinted = true; } else { this.fingerprint = null; this.IsFingerPrinted = false; } } }
public ChooseState(StateImpl s, TraversalInfo predecessor, Via bt) : base(s, StateType.ChooseState, predecessor, bt) { numChoices = s.NumChoices; hasMultipleSuccessors = s.NumChoices > 1; stateImpl = s; receipt = s.CheckIn(); if (!ZingerConfiguration.DoRandomSampling) { if (ZingerConfiguration.FingerprintSingleTransitionStates) { if (this.NumChoices > 1) { this.fingerprint = s.Fingerprint; this.IsFingerPrinted = true; } else { // Fingerprint with probability p if (ZingerUtilities.rand.NextDouble() <= ZingerConfiguration.NonChooseProbability) { this.fingerprint = s.Fingerprint; this.IsFingerPrinted = true; } else { this.fingerprint = null; this.IsFingerPrinted = false; } } } else { this.fingerprint = s.Fingerprint; this.IsFingerPrinted = true; } } }
protected override void Replay(TraversalInfo succ, Via bt) { throw new ArgumentException("cannot replay from a terminal node"); }
public TerminalState(StateImpl s, TraversalInfo pred, Via bt, bool MustFingerprint) : base(s, StateType.TerminalState, pred, bt) { hasMultipleSuccessors = false; if (s.IsErroneous) { IsErroneous = true; Error = s.Exception; } else if (s.IsFailedAssumption) { IsFailedAssumption = true; Error = s.Exception; } else if (s.IsValidTermination) { IsValidTermination = true; } stateImpl = s; receipt = s.CheckIn(); if (MustFingerprint) { this.fingerprint = s.Fingerprint; this.IsFingerPrinted = true; } else { this.fingerprint = null; this.IsFingerPrinted = false; } }
public TerminalState(StateImpl s, TraversalInfo pred, Via bt) : base(s, StateType.TerminalState, pred, bt) { hasMultipleSuccessors = false; if (s.IsErroneous) { IsErroneous = true; Error = s.Exception; } else if (s.IsFailedAssumption) { IsFailedAssumption = true; Error = s.Exception; } else if (s.IsValidTermination) { IsValidTermination = true; } stateImpl = s; receipt = s.CheckIn(); #if true if (ZingerConfiguration.FingerprintSingleTransitionStates) { // Fingerprint with probability p if (ZingerUtilities.rand.NextDouble() <= ZingerConfiguration.NonChooseProbability) { this.fingerprint = s.Fingerprint; this.IsFingerPrinted = true; } else { this.fingerprint = null; this.IsFingerPrinted = false; } } else { this.fingerprint = s.Fingerprint; this.IsFingerPrinted = true; } #endif }
protected override void Replay(TraversalInfo succ, Via bt) { ViaExecute ve = (ViaExecute)bt; StateImpl s = this.reclaimState(); s.RunProcess(ve.ProcessExecuted); succ.deOrphanize(s); }
protected abstract void Replay(TraversalInfo succ, Via bt);
protected static TraversalInfo MakeTraversalInfo(StateImpl s, TraversalInfo pred, Via bt, bool MustFingerprint) { if (s.IsTerminalState) return new TerminalState(s, pred, bt, MustFingerprint); if (s.IsChoicePending) return new ChooseState(s, pred, bt, MustFingerprint); if (s.IsNormalState) return new ExecutionState(s, pred, bt, MustFingerprint); Debug.Fail("unexpected state type"); return null; }
protected TraversalInfo(StateImpl s, StateType st, TraversalInfo pred, Via bt) { stateType = st; Via = bt; NumProcesses = s.NumProcesses; ProcessInfo = s.GetProcessInfo(); events = s.GetEvents(); exception = s.Exception; IsAcceptingState = s.IsAcceptingState; //initialize the plugin information. if (pred != null) { Predecessor = pred; CurrentDepth = pred.CurrentDepth + 1; zBounds = new ZingerBounds(pred.zBounds.ExecutionCost, pred.zBounds.ChoiceCost); zBounds.IncrementDepthCost(); doDelay = false; if (ZingerConfiguration.DoDelayBounding) { ZingDBSchedState = s.ZingDBSchedState; ZingDBScheduler = s.ZingDBScheduler; } else if (ZingerConfiguration.DoPreemptionBounding) { preemptionBounding = new ZingPreemptionBounding(ProcessInfo, NumProcesses, Predecessor.preemptionBounding.currentProcess); } if (ZingerConfiguration.DronacharyaEnabled || ZingerConfiguration.IsPluginEnabled) { ZingerPlugin = s.ZingerPlugin; ZingerPluginState = s.ZingerPluginState; } pred.Successor = this; MagicBit = pred.MagicBit; } else { zBounds = new ZingerBounds(); MagicBit = false; CurrentDepth = 0; if (ZingerConfiguration.DoDelayBounding) { ZingDBSchedState = s.ZingDBSchedState.Clone(false); ZingDBScheduler = s.ZingDBScheduler; } else if (ZingerConfiguration.DoPreemptionBounding) { preemptionBounding = new ZingPreemptionBounding(ProcessInfo, NumProcesses, 0); } if (ZingerConfiguration.DronacharyaEnabled || ZingerConfiguration.IsPluginEnabled) { ZingerPlugin = s.ZingerPlugin; ZingerPluginState = s.ZingerPluginState.Clone(); } } }