private String getFullyQualifiedMethodName() { String methodName; MethodGen methodGen = cfg.getMethodGen(); if (methodGen == null) { methodName = cfg.getMethodName(); } else { methodName = SignatureConverter.convertMethodSignature(methodGen); } return methodName; }
public static void dumpTypeDataflow(Method method, CFG cfg, TypeDataflow typeDataflow) throws DataflowAnalysisException { System.out.println("\n\n{ Type analysis for " + cfg.getMethodGen().getClassName() + "." + method.getName() + method.getSignature()); TreeSet<Location> tree = new TreeSet<>(); for (Iterator<Location> locs = cfg.locationIterator(); locs.hasNext();) { Location loc = locs.next(); tree.add(loc); } for (Location loc : tree) { System.out.println("\n Pre: " + typeDataflow.getFactAtLocation(loc)); System.out.println("Location: " + loc); System.out.println("Post: " + typeDataflow.getFactAfterLocation(loc)); } System.out.println("}\n\n"); }
private Location getValueNumberCreationLocation(ValueNumberDataflow vnd, ValueNumber vn) { ConstantPoolGen cpg = vnd.getCFG().getMethodGen().getConstantPool(); for(Iterator<Location> it = vnd.getCFG().locationIterator(); it.hasNext(); ) { Location loc = it.next(); if(loc.getHandle().getInstruction().produceStack(cpg) != 1) { continue; } try { ValueNumberFrame vnf = vnd.getFactAfterLocation(loc); if(vnf.getTopValue().equals(vn)) { return loc; } } catch (DataflowAnalysisException e) { AnalysisContext.logError("While analyzing "+vnd.getCFG().getMethodGen()+" at "+loc, e); } } return null; }
UselessValuesContext(ClassContext classContext, Method method) throws CheckedAnalysisException { this.classContext = classContext; this.method = method; cfg = classContext.getCFG(method); cpg = cfg.getMethodGen().getConstantPool(); ta = classContext.getTypeDataflow(method).getAnalysis(); vna = classContext.getValueNumberDataflow(method).getAnalysis(); }
} else { if (exceptionSet.isSingleton("java.lang.CloneNotSupportedException") && cfg.getMethodName().endsWith(".clone()")) { String className = cfg.getMethodGen().getClassName(); if (Subtypes2.instanceOf(className, "java.lang.Cloneable")) { deletedEdgeSet.add(edge);
Context context = new Context(cfg.getMethodGen().getConstantPool().getConstantPool(), method.getCode().getLocalVariableTable(), getParameterTypes(descriptor), classContext.getValueNumberDataflow(method)); Map<ValueNumber, VariableData> analyzedArguments = new HashMap<>(); MethodGen methodGen = cfg.getMethodGen(); Iterator<InstructionHandle> iterator = methodGen.getInstructionList().iterator(); while(iterator.hasNext()) {
try { ClassContext cc = Global.getAnalysisCache().getClassAnalysis(ClassContext.class, DescriptorFactory.createClassDescriptorFromDottedClassName(cfg.getMethodGen().getClassName())); System.out.println("Forwards cfg"); CFGPrinter printer = new CFGPrinter(cfg); printer.setIsForwards(false); printer.print(System.out); cc.dumpSimpleDataflowInformation(cfg.getMethodGen().getMethod()); } catch (CheckedAnalysisException e) { e.printStackTrace(System.out); System.out.println("----------------------------------------------------------------------"); System.out.println(this.getClass().getName() + " iteration: " + numIterations + ", timestamp: " + timestamp); MethodGen mg = cfg.getMethodGen(); System.out.println(mg.getClassName() + "." + mg.getName() + mg.getSignature()); System.out.println("----------------------------------------------------------------------"); System.out.println("-- Quiescence achieved-------------------------------------------------"); System.out.println(this.getClass().getName() + " iteration: " + numIterations + ", timestamp: " + timestamp); MethodGen mg = cfg.getMethodGen(); System.out.println(mg.getClassName() + "." + mg.getName() + mg.getSignature()); new RuntimeException("Quiescence achieved----------------------------------------------------------------")
boolean isTest = false; ConstantPoolGen cpg = cfg.getMethodGen().getConstantPool(); if (ins instanceof IfInstruction && ins.consumeStack(cpg) == 2) { isTest = true;
private String getFullyQualifiedMethodName() { String methodName; MethodGen methodGen = cfg.getMethodGen(); if (methodGen == null) { methodName = cfg.getMethodName(); } else { methodName = SignatureConverter.convertMethodSignature(methodGen); } return methodName; }
public static void dumpTypeDataflow(Method method, CFG cfg, TypeDataflow typeDataflow) throws DataflowAnalysisException { System.out.println("\n\n{ Type analysis for " + cfg.getMethodGen().getClassName() + "." + method.getName() + method.getSignature()); TreeSet<Location> tree = new TreeSet<Location>(); for (Iterator<Location> locs = cfg.locationIterator(); locs.hasNext();) { Location loc = locs.next(); tree.add(loc); } for (Location loc : tree) { System.out.println("\n Pre: " + typeDataflow.getFactAtLocation(loc)); System.out.println("Location: " + loc); System.out.println("Post: " + typeDataflow.getFactAfterLocation(loc)); } System.out.println("}\n\n"); }
/** * overrides the visitor to navigate basic blocks looking for all first usages of fields, removing those that are read from first. * * @param obj * the context object of the currently parsed method */ @Override public void visitMethod(Method obj) { if (localizableFields.isEmpty()) { return; } try { cfg = clsContext.getCFG(obj); cpg = cfg.getMethodGen().getConstantPool(); BasicBlock bb = cfg.getEntry(); Set<String> uncheckedFields = new HashSet<>(localizableFields.keySet()); visitedBlocks.clear(); checkBlock(bb, uncheckedFields); } catch (CFGBuilderException cbe) { localizableFields.clear(); } finally { cfg = null; cpg = null; } }
/** * overrides the visitor to navigate basic blocks looking for all first usages of fields, removing those that are read from first. * * @param obj * the context object of the currently parsed method */ @Override public void visitMethod(Method obj) { if (localizableFields.isEmpty()) { return; } try { cfg = clsContext.getCFG(obj); cpg = cfg.getMethodGen().getConstantPool(); BasicBlock bb = cfg.getEntry(); Set<String> uncheckedFields = new HashSet<>(localizableFields.keySet()); visitedBlocks.clear(); checkBlock(bb, uncheckedFields); } catch (CFGBuilderException cbe) { localizableFields.clear(); } finally { cfg = null; cpg = null; } }
UselessValuesContext(ClassContext classContext, Method method) throws CheckedAnalysisException { this.classContext = classContext; this.method = method; cfg = classContext.getCFG(method); cpg = cfg.getMethodGen().getConstantPool(); ta = classContext.getTypeDataflow(method).getAnalysis(); vna = classContext.getValueNumberDataflow(method).getAnalysis(); }
} else { if (exceptionSet.isSingleton("java.lang.CloneNotSupportedException") && cfg.getMethodName().endsWith(".clone()")) { String className = cfg.getMethodGen().getClassName(); if (Subtypes2.instanceOf(className, "java.lang.Cloneable")) { deletedEdgeSet.add(edge);
Context context = new Context(cfg.getMethodGen().getConstantPool().getConstantPool(), method.getCode().getLocalVariableTable(), getParameterTypes(descriptor), classContext.getValueNumberDataflow(method)); Map<ValueNumber, VariableData> analyzedArguments = new HashMap<>(); MethodGen methodGen = cfg.getMethodGen(); Iterator<InstructionHandle> iterator = methodGen.getInstructionList().iterator(); while(iterator.hasNext()) {
try { ClassContext cc = Global.getAnalysisCache().getClassAnalysis(ClassContext.class, DescriptorFactory.createClassDescriptorFromDottedClassName(cfg.getMethodGen().getClassName())); System.out.println("Forwards cfg"); CFGPrinter printer = new CFGPrinter(cfg); printer.setIsForwards(false); printer.print(System.out); cc.dumpSimpleDataflowInformation(cfg.getMethodGen().getMethod()); } catch (CheckedAnalysisException e) { e.printStackTrace(System.out); System.out.println("----------------------------------------------------------------------"); System.out.println(this.getClass().getName() + " iteration: " + numIterations + ", timestamp: " + timestamp); MethodGen mg = cfg.getMethodGen(); System.out.println(mg.getClassName() + "." + mg.getName() + mg.getSignature()); System.out.println("----------------------------------------------------------------------"); System.out.println("-- Quiescence achieved-------------------------------------------------"); System.out.println(this.getClass().getName() + " iteration: " + numIterations + ", timestamp: " + timestamp); MethodGen mg = cfg.getMethodGen(); System.out.println(mg.getClassName() + "." + mg.getName() + mg.getSignature()); new RuntimeException("Quiescence achieved----------------------------------------------------------------")
boolean isTest = false; ConstantPoolGen cpg = cfg.getMethodGen().getConstantPool(); if (ins instanceof IfInstruction && ins.consumeStack(cpg) == 2) { isTest = true;