protected TraversalInfo GetTraversalInfoForTrace(Trace trace) { TraversalInfo ti = new ExecutionState((StateImpl)StartStateStateImpl.Clone(), null, null); TraversalInfo newTi = null; if (trace != null) { if (trace.Count > 0) { for (int i = 0; i < trace.Count; ++i) { newTi = ti.GetSuccessorN((int)trace[i].Selection); System.Diagnostics.Debug.Assert(newTi != null); ti = newTi; } } } return ti; }
public static TraversalInfo Load(Assembly asm) { StateImpl initialState = StateImpl.Load(asm); TraversalInfo ti; ti = new ExecutionState(initialState, null, null); if (ti == null) throw new ArgumentException("initial state must be a normal execution node"); return ti; }
/// <summary> /// Used to obtain a traversalinfo when the entire state is saved /// at a depth cut off /// </summary> /// <param name="s"> The StateImpl object of the checkpointed state</param> /// <returns></returns> public static TraversalInfo MakeTraversalInfo(StateImpl s) { TraversalInfo retval = null; if (s.IsTerminalState) { retval = new TerminalState(s, null, null, true); } else if (s.IsChoicePending) { retval = new ChooseState(s, null, null, true); } else { // Normal state (ExecutionState) retval = new ExecutionState(s, null, null, true); } return (retval); }
/// <summary> /// Executes the model checker from the model initial state to the state represented by the given trace. /// Sets the initial state for algorithms not using reduction. /// </summary> /// <param name="trace">The trace that the model checker follows to set the initial TraversalInfo state. Can be null.</param> /// <returns>The transition depth of the resultant state.</returns> private TraversalInfo GetTraversalInfoForTrace(Trace trace, int threadId, StateImpl iState) { TraversalInfo ti = new ExecutionState((StateImpl)iState.Clone(threadId), null, null); int Step = 0; if (trace != null) { #region Trace Count greater than zero if (trace.Count > 0) { while (Step < trace.Count) { if (ZingerConfiguration.CompactTraces && ti.HasMultipleSuccessors) { ti = ti.GetSuccessorNForReplay((int)trace[Step++].Selection, false); } else if (ZingerConfiguration.CompactTraces) { while (!ti.HasMultipleSuccessors && ZingerConfiguration.CompactTraces) { int n = 0; if (ti.stateType.Equals(TraversalInfo.StateType.ExecutionState)) { int i = 0; while (i < ti.NumProcesses) { if (ti.ProcessInfo[i].Status.Equals(ProcessStatus.Runnable)) { n = i; break; } i++; } } ti = ti.GetSuccessorNForReplay(n, false); } } else { ti = ti.GetSuccessorNForReplay((int)trace[Step++].Selection, false); } } } #endregion Trace Count greater than zero #region Traversing the tail while (!ti.HasMultipleSuccessors && ZingerConfiguration.CompactTraces) { int n = 0; if (ti.stateType.Equals(TraversalInfo.StateType.ExecutionState)) { int i = 0; while (i < ti.NumProcesses) { if (ti.ProcessInfo[i].Status.Equals(ProcessStatus.Runnable)) { n = i; break; } i++; } } ti = ti.GetSuccessorNForReplay(n, false); } #endregion Traversing the tail } return ti; }