def rebuildAST(): print("\n********* Rebuilding AST post abstracttion ********\n") print("Synthesizing expression with fresh FreeVars .... ") logger.info("\n********* Rebuilding AST post abstracttion ********\n") logger.info("Synthesizing expression with fresh FreeVars .... ") probeList = helper.getProbeList() completed = defaultdict(int) ## node -> depth for node in probeList: if not completed.__contains__(node): rebuildASTNode(node, completed) rev_symTable = {v: k for k, v in Globals.symTable.items()} Globals.symTable = {syms : node for node,syms in rev_symTable.items() \ if completed.__contains__(node)} maxdepth = max([node.depth for node in probeList]) Globals.depthTable = { depth: set([node for node in completed.keys() if node.depth == depth]) for depth in range(maxdepth + 1) } del probeList del completed del rev_symTable
def ErrorAnalysis(argList): absCount = 1 probeList = helper.getProbeList() maxdepth = max([node.depth for node in probeList]) logger.info("AST_DEPTH : {AST_DEPTH}".format(AST_DEPTH=maxdepth)) bound_mindepth, bound_maxdepth = argList.mindepth, argList.maxdepth if (argList.enable_abstraction): print("Abstraction Enabled... \n") while (maxdepth >= bound_maxdepth and maxdepth >= bound_mindepth): [abs_depth, sel_candidate_list ] = helper.selectCandidateNodes(maxdepth, bound_mindepth, bound_maxdepth) print("Canidate List Length:", len(sel_candidate_list)) if (len(sel_candidate_list) > 0): absCount += 1 results = simplify_with_abstraction(sel_candidate_list, argList, maxdepth) maxopCount = results.get("maxOpCount", 1000) probeList = helper.getProbeList() maxdepth = max([node.depth for node in probeList]) - 1 if (maxopCount > 1000 and maxdepth > 8 and bound_mindepth > 5): bound_maxdepth = maxdepth if bound_maxdepth > maxdepth else bound_maxdepth - 2 if bound_maxdepth - bound_mindepth > 4 else bound_maxdepth bound_mindepth = bound_mindepth - 2 if bound_maxdepth - bound_mindepth > 4 else bound_mindepth elif maxdepth <= bound_maxdepth and maxdepth > bound_mindepth: bound_maxdepth = maxdepth assert (bound_maxdepth >= bound_mindepth) else: break print("Bypassing abstraction\n") print(maxdepth, bound_maxdepth, bound_mindepth) #print("Expr->", probeList[0].f_expression) logger.info("BYPASSING_ABSTRACTION\n\n") return full_analysis(probeList, argList, maxdepth) else: return full_analysis(probeList, argList, maxdepth)