@Override public String toString() { StringBuilder result = new StringBuilder(method.toString()); result.append('('); for (int i = 0; i < getNumberOfParameters() - 1; i++) { result.append(Arrays.toString(getParameterTypes(i))); result.append(','); } if (getNumberOfParameters() > 0) { result.append(Arrays.toString(getParameterTypes(getNumberOfParameters() - 1))); } result.append(')'); return result.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; final DefaultEntrypoint other = (DefaultEntrypoint) obj; if (!Arrays.equals(paramTypes, other.paramTypes)) return false; return true; } }
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + Arrays.hashCode(paramTypes); return result; }
/** * Add a call to this entrypoint from the fake root method * * @param m the Fake Root Method * @return the call instruction added, or null if the operation fails */ public SSAAbstractInvokeInstruction addCall(AbstractRootMethod m) { int paramValues[]; CallSiteReference site = makeSite(0); if (site == null) { return null; } paramValues = new int[getNumberOfParameters()]; for (int j = 0; j < paramValues.length; j++) { paramValues[j] = makeArgument(m, j); if (paramValues[j] == -1) { // there was a problem return null; } } return m.addInvocation(paramValues, site); }
private void processFinalizeMethod(final IClass klass) { if (getBuilder().finalizeVisited.add(klass)) { IMethod finalizer = klass.getMethod(MethodReference.finalizeSelector); if (finalizer != null && ! finalizer.getDeclaringClass().getReference().equals(TypeReference.JavaLangObject)) { Entrypoint ef = new DefaultEntrypoint(finalizer, getClassHierarchy()) { @Override protected TypeReference[] makeParameterTypes(IMethod method, int i) { if (i == 0) { return new TypeReference[]{ klass.getReference() }; } else { return super.makeParameterTypes(method, i); } } }; ef.addCall((AbstractRootMethod)callGraph.getFakeRootNode().getMethod()); getBuilder().markChanged(callGraph.getFakeRootNode()); } } }
IMethod m = null; while (iter.hasNext()) { m = iter.next().getMethod(); this.filteredEP.add(getCid(m));
TypeReference[] p = getParameterTypes(i); if (p.length == 0) { return -1;
@SuppressWarnings("deprecation") public void init(Iterable<Entrypoint> entrypoints) throws CancelException { super.init(); CGNode root = getFakeRootNode(); int programCounter = 0; for(Entrypoint e : entrypoints) { root.addTarget(e.makeSite(programCounter++), null); } newNodes.push(root); closure(); isInitialized = true; }
/** * Add a call to this entrypoint from the fake root method * * @param m the Fake Root Method * @return the call instruction added, or null if the operation fails */ public SSAAbstractInvokeInstruction addCall(AbstractRootMethod m) { int paramValues[]; CallSiteReference site = makeSite(0); if (site == null) { return null; } paramValues = new int[getNumberOfParameters()]; for (int j = 0; j < paramValues.length; j++) { paramValues[j] = makeArgument(m, j); if (paramValues[j] == -1) { // there was a problem return null; } } return m.addInvocation(paramValues, site); }
private void processFinalizeMethod(final IClass klass) { if (getBuilder().finalizeVisited.add(klass)) { IMethod finalizer = klass.getMethod(MethodReference.finalizeSelector); if (finalizer != null && ! finalizer.getDeclaringClass().getReference().equals(TypeReference.JavaLangObject)) { Entrypoint ef = new DefaultEntrypoint(finalizer, getClassHierarchy()) { @Override protected TypeReference[] makeParameterTypes(IMethod method, int i) { if (i == 0) { return new TypeReference[]{ klass.getReference() }; } else { return super.makeParameterTypes(method, i); } } }; ef.addCall((AbstractRootMethod)callGraph.getFakeRootNode().getMethod()); getBuilder().markChanged(callGraph.getFakeRootNode()); } } }
protected Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> getFieldBasedCallGraph(Iterable<Entrypoint> roots) throws CancelException { final Set<String> scripts = HashSetFactory.make(); for(Entrypoint e : roots) { String scriptName = getScriptName(((AstMethod)e.getMethod())); scripts.add(scriptName);
TypeReference[] p = getParameterTypes(i); if (p.length == 0) { return -1;
@SuppressWarnings("deprecation") public void init(Iterable<Entrypoint> entrypoints) throws CancelException { super.init(); CGNode root = getFakeRootNode(); int programCounter = 0; for(Entrypoint e : entrypoints) { root.addTarget(e.makeSite(programCounter++), null); } newNodes.push(root); closure(); isInitialized = true; }
@Override public String toString() { StringBuilder result = new StringBuilder(method.toString()); result.append('('); for (int i = 0; i < getNumberOfParameters() - 1; i++) { result.append(Arrays.toString(getParameterTypes(i))); result.append(','); } if (getNumberOfParameters() > 0) { result.append(Arrays.toString(getParameterTypes(getNumberOfParameters() - 1))); } result.append(')'); return result.toString(); }
System.err.println("Entrypoint: " + E); SSAAbstractInvokeInstruction call = E.addCall((AbstractRootMethod) callGraph.getFakeRootNode().getMethod());
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + Arrays.hashCode(paramTypes); return result; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; final DefaultEntrypoint other = (DefaultEntrypoint) obj; if (!Arrays.equals(paramTypes, other.paramTypes)) return false; return true; } }
final int paramCount = ep.getNumberOfParameters(); final TypeReference[] types = ep.getParameterTypes(i); if (types.length < 1) { throw new IllegalStateException("The Etrypoint " + ep + " did not return any types for its " + i + "th parameter");