private SpecializedFactoryMethod findOrCreateSpecializedFactoryMethod(CGNode node) { SpecializedFactoryMethod m = syntheticMethodCache.get(node.getContext()); if (m == null) { Set<TypeReference> types = getTypesForContext(node.getContext()); m = new SpecializedFactoryMethod((SummarizedMethod) node.getMethod(), node.getContext(), types); syntheticMethodCache.put(node.getContext(), m); } return m; }
private SpecializedFactoryMethod findOrCreateSpecializedFactoryMethod(CGNode node) { SpecializedFactoryMethod m = syntheticMethodCache.get(node.getContext()); if (m == null) { Set<TypeReference> types = getTypesForContext(node.getContext()); m = new SpecializedFactoryMethod((SummarizedMethod) node.getMethod(), node.getContext(), types); syntheticMethodCache.put(node.getContext(), m); } return m; }
/** * This method walks recursively up the definition of a context C, to see if * the chain of contexts that give rise to C includes the method M. * * If C is a ReceiverInstanceContext, Let N be the node that allocated * C.instance. If N.method == M, return N.context. Else return * findRecursiveMatchingContext(M, N.context) Else return null */ public static Context findRecursiveMatchingContext(IMethod M, Context C) { CGNode n = findNodeRecursiveMatchingContext(M, C); return (n == null) ? null : n.getContext(); }
@Override public IR getIR(CGNode node) { if (node == null) { throw new IllegalArgumentException("node is null"); } if (DEBUG) { System.err.println("generating IR for " + node); } SpecializedFactoryMethod m = findOrCreateSpecializedFactoryMethod(node); return cache.getIR(m, node.getContext()); }
@Override public IR getIR(CGNode node) { // new Exception("getting IR for method "+node.getMethod().getReference().toString()).printStackTrace(); return cache.getIR(node.getMethod(), node.getContext()); }
@Override public IR getIR(CGNode node) { // new Exception("getting IR for method "+node.getMethod().getReference().toString()).printStackTrace(); return cache.getIR(node.getMethod(), node.getContext()); }
@Override public boolean recordFactoryType(CGNode node, IClass klass) { if (klass == null) { throw new IllegalArgumentException("klass is null"); } if (node == null) { throw new IllegalArgumentException("node is null"); } return recordType(node.getMethod().getClassHierarchy(), node.getContext(), klass.getReference()); }
@Override public boolean understands(CGNode node) { if (node == null) { throw new IllegalArgumentException("node is null"); } if (!(node.getContext().isA(JavaTypeContext.class))) { return false; } return node.getMethod().getReference().equals(CLASS_NEW_INSTANCE_REF); }
@Override public boolean understands(CGNode node) { if (node == null) { throw new IllegalArgumentException("node is null"); } return (node.getMethod().getReference().equals(CLONE) && ContextUtil.getConcreteClassFromContext(node.getContext()) != null); }
@Override public boolean understands(CGNode node) { if (node == null) { throw new IllegalArgumentException("node is null"); } if (!(node.getContext().isA(JavaTypeContext.class))) { return false; } return ClassFactoryContextSelector.isClassFactory(node.getMethod().getReference()); }
@Override public boolean understands(CGNode node) { if (node == null) { throw new IllegalArgumentException("node is null"); } if (!(node.getContext().isA(JavaTypeContext.class))) { return false; } return node.getMethod().getReference().equals(GetClassContextSelector.GET_CLASS); }
@Override public boolean understands(CGNode node) { if (node == null) { throw new IllegalArgumentException("node is null"); } if (!(node.getContext().isA(JavaTypeContext.class))) { return false; } return node.getMethod().getReference().equals(GetClassContextSelector.GET_CLASS); }
@Override public boolean understands(CGNode node) { if (node == null) { throw new IllegalArgumentException("node is null"); } if (!(node.getContext().isA(JavaTypeContext.class))) { return false; } return ClassFactoryContextSelector.isClassFactory(node.getMethod().getReference()); }
protected CallString getCallString(CGNode caller, CallSiteReference site, IMethod target) { int length = getLength(caller, site, target); if (length > 0) { if (caller.getContext().get(CALL_STRING) != null) { return new CallString(site, caller.getMethod(), length, (CallString) caller.getContext().get(CALL_STRING)); } else { return new CallString(site, caller.getMethod()); } } else { return null; } }
protected CallString getCallString(CGNode caller, CallSiteReference site, IMethod target) { int length = getLength(caller, site, target); if (length > 0) { if (caller.getContext().get(CALL_STRING) != null) { return new CallString(site, caller.getMethod(), length, (CallString) caller.getContext().get(CALL_STRING)); } else { return new CallString(site, caller.getMethod()); } } else { return null; } }
private FilteredPointerKey.TypeFilter getFilter(CGNode target) { FilteredPointerKey.TypeFilter filter = (FilteredPointerKey.TypeFilter) target.getContext().get(ContextKey.PARAMETERS[0]); if (filter != null) { return filter; } else { // the context does not select a particular concrete type for the // receiver. IClass C = getReceiverClass(target.getMethod()); return new FilteredPointerKey.SingleClassFilter(C); } }
private FilteredPointerKey.TypeFilter getFilter(CGNode target) { FilteredPointerKey.TypeFilter filter = (FilteredPointerKey.TypeFilter) target.getContext().get(ContextKey.PARAMETERS[0]); if (filter != null) { return filter; } else { // the context does not select a particular concrete type for the // receiver. IClass C = getReceiverClass(target.getMethod()); return new FilteredPointerKey.SingleClassFilter(C); } }
@Override public Iterator<NewSiteReference> iterateNewSites(CGNode node) { if (node == null) { throw new IllegalArgumentException("node is null"); } assert understands(node); TypeReference tr = ((TypeAbstraction)node.getContext().get(ContextKey.RECEIVER)).getTypeReference(); if (tr != null) { return new NonNullSingletonIterator<>(NewSiteReference.make(0, tr)); } return EmptyIterator.instance(); }
@Override public Iterator<NewSiteReference> iterateNewSites(CGNode node) { if (node == null) { throw new IllegalArgumentException("node is null"); } assert understands(node); TypeReference tr = ((TypeAbstraction)node.getContext().get(ContextKey.RECEIVER)).getTypeReference(); if (tr != null) { return new NonNullSingletonIterator<>(NewSiteReference.make(0, tr)); } return EmptyIterator.instance(); }
@Override public IR getIR(CGNode node) { if (node.getMethod() instanceof Retranslatable) { return getAnalysisCache().getIR(node.getMethod(), node.getContext()); } else { return super.getIR(node); } }