@Override public IClassHierarchy getClassHierarchy() { return getCallGraph().getClassHierarchy(); } }
@Override public IClassHierarchy getClassHierarchy() { return getCallGraph().getClassHierarchy(); } }
/** * @return the points-to set for the exceptional return values from a particular call site */ private OrdinalSet<InstanceKey> computeImplicitExceptionsForCall(CGNode node, SSAInvokeInstruction call) { MutableSparseIntSet S = MutableSparseIntSet.makeEmpty(); for (CGNode target : getCallGraph().getPossibleTargets(node, call.getCallSite())) { PointerKey retVal = pointerKeys.getPointerKeyForExceptionalReturnValue(target); IntSet set = getPointsToSet(retVal).getBackingSet(); if (set != null) { S.addAll(set); } } return new OrdinalSet<>(S, instanceKeys); }
/** * @return the points-to set for the exceptional return values from a particular call site */ private OrdinalSet<InstanceKey> computeImplicitExceptionsForCall(CGNode node, SSAInvokeInstruction call) { MutableSparseIntSet S = MutableSparseIntSet.makeEmpty(); for (CGNode target : getCallGraph().getPossibleTargets(node, call.getCallSite())) { PointerKey retVal = pointerKeys.getPointerKeyForExceptionalReturnValue(target); IntSet set = getPointsToSet(retVal).getBackingSet(); if (set != null) { S.addAll(set); } } return new OrdinalSet<>(S, instanceKeys); }
private OrdinalSet<InstanceKey> computeImplicitPointsToSetAtCheckCast(CGNode node, SSACheckCastInstruction instruction) { PointerKey rhs = pointerKeys.getPointerKeyForLocal(node, instruction.getVal()); OrdinalSet<InstanceKey> rhsSet = getPointsToSet(rhs); MutableSparseIntSet S = MutableSparseIntSet.makeEmpty(); for (TypeReference t : instruction.getDeclaredResultTypes()) { IClass klass = getCallGraph().getClassHierarchy().lookupClass(t); if (klass == null) { // could not find the type. conservatively assume Object return rhsSet; } else { if (klass.isInterface()) { for (InstanceKey ik : rhsSet) { if (getCallGraph().getClassHierarchy().implementsInterface(ik.getConcreteType(), klass)) { S.add(getInstanceKeyMapping().getMappedIndex(ik)); } } } else { for (InstanceKey ik : rhsSet) { if (getCallGraph().getClassHierarchy().isSubclassOf(ik.getConcreteType(), klass)) { S.add(getInstanceKeyMapping().getMappedIndex(ik)); } } } } } return new OrdinalSet<>(S, instanceKeys); }
private OrdinalSet<InstanceKey> computeImplicitPointsToSetAtCheckCast(CGNode node, SSACheckCastInstruction instruction) { PointerKey rhs = pointerKeys.getPointerKeyForLocal(node, instruction.getVal()); OrdinalSet<InstanceKey> rhsSet = getPointsToSet(rhs); MutableSparseIntSet S = MutableSparseIntSet.makeEmpty(); for (TypeReference t : instruction.getDeclaredResultTypes()) { IClass klass = getCallGraph().getClassHierarchy().lookupClass(t); if (klass == null) { // could not find the type. conservatively assume Object return rhsSet; } else { if (klass.isInterface()) { for (InstanceKey ik : rhsSet) { if (getCallGraph().getClassHierarchy().implementsInterface(ik.getConcreteType(), klass)) { S.add(getInstanceKeyMapping().getMappedIndex(ik)); } } } else { for (InstanceKey ik : rhsSet) { if (getCallGraph().getClassHierarchy().isSubclassOf(ik.getConcreteType(), klass)) { S.add(getInstanceKeyMapping().getMappedIndex(ik)); } } } } } return new OrdinalSet<>(S, instanceKeys); }
public OrdinalSet<InstanceKey> computeImplicitPointsToSetAtGet(CGNode node, FieldReference field, int refVn, boolean isStatic) { IField f = getCallGraph().getClassHierarchy().resolveField(field); if (f == null) { return OrdinalSet.empty(); } if (isStatic) { PointerKey fKey = pointerKeys.getPointerKeyForStaticField(f); return getPointsToSet(fKey); } else { PointerKey ref = pointerKeys.getPointerKeyForLocal(node, refVn); MutableSparseIntSet S = MutableSparseIntSet.makeEmpty(); OrdinalSet<InstanceKey> refs = getPointsToSet(ref); for (InstanceKey ik : refs) { PointerKey fkey = pointerKeys.getPointerKeyForInstanceField(ik, f); if (fkey != null) { OrdinalSet pointees = getPointsToSet(fkey); IntSet set = pointees.getBackingSet(); if (set != null) { S.addAll(set); } } } return new OrdinalSet<>(S, instanceKeys); } }
public OrdinalSet<InstanceKey> computeImplicitPointsToSetAtGet(CGNode node, FieldReference field, int refVn, boolean isStatic) { IField f = getCallGraph().getClassHierarchy().resolveField(field); if (f == null) { return OrdinalSet.empty(); } if (isStatic) { PointerKey fKey = pointerKeys.getPointerKeyForStaticField(f); return getPointsToSet(fKey); } else { PointerKey ref = pointerKeys.getPointerKeyForLocal(node, refVn); MutableSparseIntSet S = MutableSparseIntSet.makeEmpty(); OrdinalSet<InstanceKey> refs = getPointsToSet(ref); for (InstanceKey ik : refs) { PointerKey fkey = pointerKeys.getPointerKeyForInstanceField(ik, f); if (fkey != null) { OrdinalSet pointees = getPointsToSet(fkey); IntSet set = pointees.getBackingSet(); if (set != null) { S.addAll(set); } } } return new OrdinalSet<>(S, instanceKeys); } }
OrdinalSet<InstanceKey> ep = getPointsToSet(e); for (InstanceKey ik : ep) { if (PropagationCallGraphBuilder.catches(caughtTypes, ik.getConcreteType(), getCallGraph().getClassHierarchy())) { S.add(instanceKeys.getMappedIndex(ik)); ConcreteTypeKey ck = (ConcreteTypeKey) ik; IClass klass = ck.getType(); if (PropagationCallGraphBuilder.catches(caughtTypes, klass, getCallGraph().getClassHierarchy())) { S.add(instanceKeys.getMappedIndex(SSAPropagationCallGraphBuilder .getInstanceKeyForPEI(node, peiLoc, type, iKeyFactory)));
OrdinalSet<InstanceKey> ep = getPointsToSet(e); for (InstanceKey ik : ep) { if (PropagationCallGraphBuilder.catches(caughtTypes, ik.getConcreteType(), getCallGraph().getClassHierarchy())) { S.add(instanceKeys.getMappedIndex(ik)); ConcreteTypeKey ck = (ConcreteTypeKey) ik; IClass klass = ck.getType(); if (PropagationCallGraphBuilder.catches(caughtTypes, klass, getCallGraph().getClassHierarchy())) { S.add(instanceKeys.getMappedIndex(SSAPropagationCallGraphBuilder .getInstanceKeyForPEI(node, peiLoc, type, iKeyFactory)));