private static Atom getLanguage(NewSiteReference target) { return target .getDeclaredType() .getClassLoader() .getLanguage(); }
private static Atom getLanguage(NewSiteReference target) { return target .getDeclaredType() .getClassLoader() .getLanguage(); }
private static Atom getLanguage(CallSiteReference site) { return site .getDeclaredTarget() .getDeclaringClass() .getClassLoader() .getLanguage(); }
public int addPhi(TypeReference type, int[] values) { Atom language = type.getClassLoader().getLanguage(); AbstractRootMethod root = getLanguageRoot(language); return root.addPhi(values); }
@Override public AstLexicalRead addGlobalRead(TypeReference type, String name) { Atom language = type.getClassLoader().getLanguage(); AbstractRootMethod root = getLanguageRoot(language); return ((AstFakeRoot) root).addGlobalRead(type, name); }
@Override public SSANewInstruction addAllocation(TypeReference type) { Atom language = type.getClassLoader().getLanguage(); AbstractRootMethod root = getLanguageRoot(language); return root.addAllocation(type); }
@Override public IClassLoader getClassLoader() { return getClassHierarchy().getLoader(getReference().getClassLoader()); }
@Override public int addCheckcast(TypeReference[] type, int rv, boolean isPEI) { Atom language = type[0].getClassLoader().getLanguage(); AbstractRootMethod root = getLanguageRoot(language); return root.addCheckcast(type, rv, isPEI); }
@Override public final String toString() { return "< " + getDeclaringClass().getClassLoader().getName() + ", " + getDeclaringClass().getName() + ", " + selector + " >"; }
@Override public int addGetInstance(FieldReference ref, int object) { TypeReference type = ref.getDeclaringClass(); Atom language = type.getClassLoader().getLanguage(); AbstractRootMethod root = getLanguageRoot(language); return root.addGetInstance(ref, object); }
public static TypeReference findOrCreateReferenceTo(TypeReference t) { if (t == null) { throw new IllegalArgumentException("t is null"); } TypeName name = t.getName(); if (t.isPrimitiveType()) { return findOrCreate(ClassLoaderReference.Primordial, name.getReferenceTypeForElementType()); } else { return findOrCreate(t.getClassLoader(), name.getReferenceTypeForElementType()); } }
@Override public void visitNew(NewInstruction instruction) { ClassLoaderReference loader = getReference().getDeclaringClass().getClassLoader(); TypeReference t = ShrikeUtil.makeTypeReference(loader, instruction.getType()); newSites.add(NewSiteReference.make(getProgramCounter(), t)); }
@Override public void visitPut(IPutInstruction instruction) { ClassLoaderReference loader = getReference().getDeclaringClass().getClassLoader(); FieldReference f = FieldReference.findOrCreate(loader, instruction.getClassType(), instruction.getFieldName(), instruction .getFieldType()); fieldsWritten.add(f); }
@Override public SSAAbstractInvokeInstruction addInvocation(int[] params, CallSiteReference site) { TypeReference type = site.getDeclaredTarget().getDeclaringClass(); Atom language = type.getClassLoader().getLanguage(); AbstractRootMethod root = getLanguageRoot(language); return root.addInvocation(params, site); }
@Override public final String toString() { return "< " + getDeclaringClass().getClassLoader().getName() + ", " + getDeclaringClass().getName() + ", " + getName() + ", " + fieldType + " >"; }
@Override public SSAAbstractInvokeInstruction addDirectCall(int functionVn, int[] argVns, CallSiteReference callSite) { TypeReference type = callSite.getDeclaredTarget().getDeclaringClass(); Atom language = type.getClassLoader().getLanguage(); AbstractRootMethod root = getLanguageRoot(language); return ((ScriptFakeRoot) root).addDirectCall(functionVn, argVns, callSite); } }
@Override public SSAAbstractInvokeInstruction addInvocation(int[] params, CallSiteReference site) { TypeReference type = site.getDeclaredTarget().getDeclaringClass(); Atom language = type.getClassLoader().getLanguage(); AbstractRootMethod root = getLanguageRoot(language); return root.addInvocation(params, site); }
@Override public final String toString() { return "< " + getDeclaringClass().getClassLoader().getName() + ", " + getDeclaringClass().getName() + ", " + getName() + ", " + fieldType + " >"; }
private IClass getPhantomSuperclass(BytecodeClass klass) { ClassLoaderReference loader = klass.getReference().getClassLoader(); TypeName superName = klass.getSuperName(); TypeReference superRef = TypeReference.findOrCreate(loader, superName); IClass superClass = lookupClass(superRef); if (superClass == null) { superClass = new PhantomClass(superRef, this); addClass(superClass); } return superClass; }
protected void test(URI[] androidLibs, String mainClass, String javaScopeFile, String... args) throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException, InterruptedException, ClassNotFoundException, SecurityException, InvalidClassFileException, FailureException { AnalysisScope javaScope = CallGraphTestUtil.makeJ2SEAnalysisScope(javaScopeFile, CallGraphTestUtil.REGRESSION_EXCLUSIONS); String javaJarPath = getJavaJar(javaScope); File androidDex = convertJarToDex(javaJarPath); Pair<CallGraph,PointerAnalysis<InstanceKey>> android = makeDalvikCallGraph(androidLibs, null, mainClass, androidDex.getAbsolutePath()); dynamicCG(new File(javaJarPath), mainClass, args); checkEdges(android.fst, t -> t.getDeclaringClass().getClassLoader().equals(ClassLoaderReference.Application)); }