Ejemplo n.º 1
0
        /// <summary>
        /// Helper method that merges state with the target block and determines whether to continue by visiting the target block.
        /// </summary>
        /// <param name="edgeLabel">Label identifying incoming edge.</param>
        /// <param name="state">Locals state in which we are entering the target.</param>
        /// <param name="target">Target block.</param>
        /// <remarks>Only for traversing into blocks within the same routine (same type context).</remarks>
        private void TraverseToBlock(object edgeLabel, FlowState /*!*/ state, BoundBlock /*!*/ target)
        {
            Contract.ThrowIfNull(state);                              // state should be already set by previous block

            state = target.UpdateIncomingFlowState(edgeLabel, state); // merge states into new one

            var targetState = target.FlowState;

            if (targetState != null)
            {
                Debug.Assert(targetState.FlowContext == state.FlowContext);

                // block was visited already,
                // merge and check whether state changed

                if (state.Equals(targetState))
                {
                    return; // state convergated, we don't have to analyse target block again
                }
            }
            //else
            //{
            //    // block was not visited yet
            //    state = state.Clone();              // copy state into new one
            //}

            // update target block state
            target.FlowState = state;

            //
            _worklist.Enqueue(target);
        }