public BytecodeEGWalker(BehaviorCache behaviorCache, SemanticModel semanticModel){ this.behaviorCache = behaviorCache; this.semanticModel = semanticModel; checkerDispatcher = new CheckerDispatcher(this, Lists.newArrayList( new BytecodeSECheck.NullnessCheck(), new BytecodeSECheck.ZeronessCheck())); constraintManager = new ConstraintManager(); explodedGraph = new ExplodedGraph(); workList = new LinkedList<>(); endOfExecutionPath = new LinkedHashSet<>(); }
public void enqueue(ExplodedGraph.ProgramPoint programPoint, ProgramState programState, boolean exitPath) { int nbOfExecution = programState.numberOfTimeVisited(programPoint); if (nbOfExecution > MAX_EXEC_PROGRAM_POINT) { debugPrint(programState); return; } checkExplodedGraphTooBig(programState); ExplodedGraph.Node cachedNode = explodedGraph.getNode(programPoint, programState.visitedPoint(programPoint, nbOfExecution + 1)); if (!cachedNode.isNew && exitPath == cachedNode.exitPath) { // has been enqueued earlier return; } cachedNode.exitPath = exitPath; workList.addFirst(cachedNode); }
void enqueue(ProgramPoint pp, ProgramState programState) { int nbOfExecution = programState.numberOfTimeVisited(pp); if (nbOfExecution > MAX_EXEC_PROGRAM_POINT) { return; } ProgramState ps = programState.visitedPoint(pp, nbOfExecution + 1); ExplodedGraph.Node cachedNode = explodedGraph.node(pp, ps); cachedNode.addParent(node, null); if (cachedNode.isNew()) { workList.addFirst(cachedNode); } }
public BytecodeEGWalker(BehaviorCache behaviorCache, SemanticModel semanticModel){ this.behaviorCache = behaviorCache; this.semanticModel = semanticModel; checkerDispatcher = new CheckerDispatcher(this, Lists.newArrayList( new BytecodeSECheck.NullnessCheck(), new BytecodeSECheck.ZeronessCheck())); constraintManager = new ConstraintManager(); explodedGraph = new ExplodedGraph(); workList = new LinkedList<>(); endOfExecutionPath = new LinkedHashSet<>(); }
void enqueue(ProgramPoint pp, ProgramState programState) { int nbOfExecution = programState.numberOfTimeVisited(pp); if (nbOfExecution > MAX_EXEC_PROGRAM_POINT) { return; } ProgramState ps = programState.visitedPoint(pp, nbOfExecution + 1); ExplodedGraph.Node cachedNode = explodedGraph.node(pp, ps); cachedNode.addParent(node, null); if (cachedNode.isNew()) { workList.addFirst(cachedNode); } }
checkerDispatcher.init(tree, cfg); liveVariables = LiveVariables.analyze(cfg); explodedGraph = new ExplodedGraph(); methodTree = tree; constraintManager = new ConstraintManager();
public void addExceptionalYield(SymbolicValue target, ProgramState exceptionalState, String exceptionFullyQualifiedName, SECheck check) { // in order to create such Exceptional Yield, a parameter of the method has to be the cause of the exception if (methodBehavior != null && methodBehavior.parameters().contains(target)) { Type exceptionType = semanticModel.getClassType(exceptionFullyQualifiedName); ProgramState newExceptionalState = exceptionalState.clearStack().stackValue(constraintManager.createExceptionalSymbolicValue(exceptionType)); ExplodedGraph.Node exitNode = explodedGraph.node(node.programPoint, newExceptionalState); methodBehavior.createExceptionalCheckBasedYield(target, exitNode, exceptionFullyQualifiedName, check); exitNode.addParent(node, null); } }
checkerDispatcher.init(tree, cfg); liveVariables = LiveVariables.analyze(cfg); explodedGraph = new ExplodedGraph(); methodTree = tree; constraintManager = new ConstraintManager();
public void addExceptionalYield(SymbolicValue target, ProgramState exceptionalState, String exceptionFullyQualifiedName, SECheck check) { // in order to create such Exceptional Yield, a parameter of the method has to be the cause of the exception if (methodBehavior != null && methodBehavior.parameters().contains(target)) { Type exceptionType = semanticModel.getClassType(exceptionFullyQualifiedName); ProgramState newExceptionalState = exceptionalState.clearStack().stackValue(constraintManager.createExceptionalSymbolicValue(exceptionType)); ExplodedGraph.Node exitNode = explodedGraph.node(node.programPoint, newExceptionalState); methodBehavior.createExceptionalCheckBasedYield(target, exitNode, exceptionFullyQualifiedName, check); exitNode.addParent(node, null); } }
CFG cfg = CFG.build(tree); liveVariables = LiveVariables.analyze(cfg); explodedGraph = new ExplodedGraph(); methodTree = tree; constraintManager = new ConstraintManager();
public void enqueue(ProgramPoint newProgramPoint, ProgramState programState, boolean exitPath, @Nullable MethodYield methodYield) { ProgramPoint programPoint = newProgramPoint; int nbOfExecution = programState.numberOfTimeVisited(programPoint); if (nbOfExecution > MAX_EXEC_PROGRAM_POINT) { if (isRestartingForEachLoop(programPoint)) { // reached the max number of visit by program point, so take the false branch with current program state programPoint = new ProgramPoint(((CFG.Block) programPoint.block).falseBlock()); } else { debugPrint(programPoint); return; } } checkExplodedGraphTooBig(programState); ProgramState ps = programState.visitedPoint(programPoint, nbOfExecution + 1); ExplodedGraph.Node cachedNode = explodedGraph.node(programPoint, ps); if (!cachedNode.isNew() && exitPath == cachedNode.exitPath) { // has been enqueued earlier cachedNode.addParent(node, methodYield); return; } cachedNode.exitPath = exitPath; cachedNode.addParent(node, methodYield); workList.addFirst(cachedNode); }
public void enqueue(ProgramPoint newProgramPoint, ProgramState programState, boolean exitPath, @Nullable MethodYield methodYield) { ProgramPoint programPoint = newProgramPoint; int nbOfExecution = programState.numberOfTimeVisited(programPoint); if (nbOfExecution > MAX_EXEC_PROGRAM_POINT) { if (isRestartingForEachLoop(programPoint)) { // reached the max number of visit by program point, so take the false branch with current program state programPoint = new ProgramPoint(((CFG.Block) programPoint.block).falseBlock()); } else { debugPrint(programPoint); return; } } checkExplodedGraphTooBig(programState); ProgramState ps = programState.visitedPoint(programPoint, nbOfExecution + 1); ExplodedGraph.Node cachedNode = explodedGraph.node(programPoint, ps); if (!cachedNode.isNew() && exitPath == cachedNode.exitPath) { // has been enqueued earlier cachedNode.addParent(node, methodYield); return; } cachedNode.exitPath = exitPath; cachedNode.addParent(node, methodYield); workList.addFirst(cachedNode); }