@Override public IClassHierarchy getClassHierarchy() { return getDeclaringClass().getClassHierarchy(); }
@Override public Selector getSelector() { return getReference().getSelector(); }
public SSAInstruction[] getStatements() { return getStatements(SSAOptions.defaultOptions()); }
public ControlFlowGraph makeCFG(SyntheticMethod method) { if (method == null) { throw new IllegalArgumentException("method is null"); } return method.makeControlFlowGraph(method.getStatements()); }
@Override public String toString() { StringBuilder s = new StringBuilder("synthetic "); if (isFactoryMethod()) { s.append(" factory "); } s.append(method.toString()); return s.toString(); }
@Override public int getNumberOfParameters() { int n = method.getNumberOfParameters(); return isStatic() ? n : n + 1; }
@Override public IR makeIR(SyntheticMethod method, Context C, SSAOptions options) { if (method == null) { throw new IllegalArgumentException("method is null"); } return method.makeIR(C, options); }
@Override public IMethod getCalleeTarget(CGNode caller, CallSiteReference site, IClass receiver) { MethodReference target = site.getDeclaredTarget(); if (isInvokeExact(target)) { if (! impls.containsKey(target)) { SyntheticMethod invokeExactTrampoline = new SyntheticMethod(target, receiver.getClassHierarchy().lookupClass(TypeReference.JavaLangInvokeMethodHandle), false, false); impls.put(target, invokeExactTrampoline); } return impls.get(target); } return base.getCalleeTarget(caller, site, receiver); } }
@Override public String toString() { StringBuilder s = new StringBuilder("synthetic "); if (isFactoryMethod()) { s.append(" factory "); } s.append(method.toString()); return s.toString(); }
public ControlFlowGraph makeCFG(SyntheticMethod method) { if (method == null) { throw new IllegalArgumentException("method is null"); } return method.makeControlFlowGraph(method.getStatements()); }
@Override public int getNumberOfParameters() { int n = method.getNumberOfParameters(); return isStatic() ? n : n + 1; }
@Override public IR makeIR(SyntheticMethod method, Context C, SSAOptions options) { if (method == null) { throw new IllegalArgumentException("method is null"); } return method.makeIR(C, options); }
@Override public IMethod getCalleeTarget(CGNode caller, CallSiteReference site, IClass receiver) { MethodReference target = site.getDeclaredTarget(); if (isInvokeExact(target)) { if (! impls.containsKey(target)) { SyntheticMethod invokeExactTrampoline = new SyntheticMethod(target, receiver.getClassHierarchy().lookupClass(TypeReference.JavaLangInvokeMethodHandle), false, false); impls.put(target, invokeExactTrampoline); } return impls.get(target); } return base.getCalleeTarget(caller, site, receiver); } }
public SSAInstruction[] getStatements() { return getStatements(SSAOptions.defaultOptions()); }
private Collection<Statement> computeFactoryReturnStatements() { // todo: clean up logic with inheritance, delegation. HashSet<Statement> result = HashSetFactory.make(); for (CGNode n : builder.getCallGraph()) { if (n.getMethod() instanceof SyntheticMethod) { SyntheticMethod m = (SyntheticMethod) n.getMethod(); if (m.isFactoryMethod()) { result.add(new NormalReturnCallee(n)); } } } return result; }
@Override public Selector getSelector() { return getReference().getSelector(); }
@Override public TypeReference getParameterType(int i) { if (isStatic()) { return method.getParameterType(i); } else { if (i == 0) { return method.getDeclaringClass(); } else { return method.getParameterType(i - 1); } } }
@Override public IClassHierarchy getClassHierarchy() { return getDeclaringClass().getClassHierarchy(); }
public static boolean hasObjectArrayStore(IMethod m) throws InvalidClassFileException { if (m == null) { throw new IllegalArgumentException("m is null"); } if (m.isWalaSynthetic()) { SyntheticMethod sm = (SyntheticMethod) m; return hasObjectArrayStore(sm.getStatements()); } else { return hasShrikeBTObjectArrayStore((ShrikeCTMethod) m); } }
@Override public Context getCalleeTarget(CGNode caller, CallSiteReference site, IMethod callee, InstanceKey[] receiver) { if (callee == null) { throw new IllegalArgumentException("callee is null"); } if (callee.isWalaSynthetic()) { SyntheticMethod s = (SyntheticMethod) callee; if (s.isFactoryMethod()) { return new CallStringContext(new CallString(site, caller.getMethod())); } } return null; }