Beispiel #1
0
        public void TreeEdge(Object sender, EdgeEventArgs args)
        {
            // get the state of the previous vertex (IL)
            this.getNullState(args.Edge);
            //	log.WriteLine("TreeEdge: {0}:{1}->{2}, {3}",args.Edge.ID,args.Edge.Source,args.Edge.Target,this.nullState);
            this.source = (InstructionVertex)args.Edge.Source;
            this.target = (InstructionVertex)args.Edge.Target;

            // propagate state
            foreach (IEdge e in this.graph.OutEdges((InstructionVertex)args.Edge.Target))
            {
                this.edgeNullStates[e]          = this.nullState;
                this.vertexNullStates[e.Target] = this.nullState;
            }

            //this.displayInstruction();
            // check state
            if (this.nullState != NullState.NonNull)
            {
                this.checkMethodInvoke();
            }

            // update next state
            this.updateBrTrueFalse();
        }
        /// <summary>
        /// Checks whether there is a definition from the beginning to the use node
        /// </summary>
        /// <param name="fdef"></param>
        /// <param name="otherDefinedOffsets"></param>
        /// <returns></returns>
        private bool HasDefinitionFromRootToUseNode(DUCoverStore dcs, FieldDefUseStore fuse, HashSet <int> otherDefinedOffsets)
        {
            DEFUSE_FEASIBILITY_TYPE feasibilityVal;

            if (this.feasibilityDicCache.TryGetValue(fuse, out feasibilityVal))
            {
                if (feasibilityVal == DEFUSE_FEASIBILITY_TYPE.USE_FEASIBLE)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }

            InstructionGraph    ig  = dcs.GetInstructionGraph(fuse.Method);
            DepthFirstTraversal dft = new DepthFirstTraversal(ig);
            InstructionVertex   iv  = ig.GetVertex(fuse.Offset);
            var result = dft.HasDefClearPathFromBeginning(iv, otherDefinedOffsets);

            if (result)
            {
                this.feasibilityDicCache[fuse] = DEFUSE_FEASIBILITY_TYPE.USE_FEASIBLE;
            }
            else
            {
                this.feasibilityDicCache[fuse] = DEFUSE_FEASIBILITY_TYPE.USE_INFEASIBLE;
            }

            return(!result);
        }
        public void TreeEdge(Object sender, EdgeEventArgs args)
        {
            // get the state of the previous vertex (IL)
            this.getNullState(args.Edge);
            //	log.WriteLine("TreeEdge: {0}:{1}->{2}, {3}",args.Edge.ID,args.Edge.Source,args.Edge.Target,this.nullState);
            this.source = (InstructionVertex)args.Edge.Source;
            this.target = (InstructionVertex)args.Edge.Target;

            // propagate state
            foreach(IEdge e in this.graph.OutEdges((InstructionVertex)args.Edge.Target))
            {
                this.edgeNullStates[e]=this.nullState;
                this.vertexNullStates[e.Target]=this.nullState;
            }

            //this.displayInstruction();
            // check state
            if (this.nullState!=NullState.NonNull)
            {
                this.checkMethodInvoke();
            }

            // update next state
            this.updateBrTrueFalse();
        }