private OrdinalSet<InstanceKeyAndState> makeOrdinalSet(IntSet intSet) { // make a copy here, to avoid comodification during iteration // TODO remove the copying, do it only at necessary call sites return new OrdinalSet<>(intSetFactory.makeCopy(intSet), ikAndStates); }
private OrdinalSet<InstanceKeyAndState> makeOrdinalSet(IntSet intSet) { // make a copy here, to avoid comodification during iteration // TODO remove the copying, do it only at necessary call sites return new OrdinalSet<>(intSetFactory.makeCopy(intSet), ikAndStates); }
public OrdinalSet<T> makeSingleton(int i) { return new OrdinalSet<>(SparseIntSet.singleton(i), this); }
public OrdinalSet<T> makeSingleton(int i) { return new OrdinalSet<>(SparseIntSet.singleton(i), this); }
public OrdinalSet<T> makeSingleton(int i) { return new OrdinalSet<>(SparseIntSet.singleton(i), this); }
private OrdinalSet<InstanceKey> toOrdinalSet(InstanceKey[] ik) { MutableSparseIntSet s = MutableSparseIntSet.makeEmpty(); for (InstanceKey element : ik) { int index = instanceKeys.getMappedIndex(element); if (index != -1) { s.add(index); } else { assert index != -1 : "instance " + element + " not mapped!"; } } return new OrdinalSet<>(s, instanceKeys); }
private OrdinalSet<InstanceKey> toOrdinalSet(InstanceKey[] ik) { MutableSparseIntSet s = MutableSparseIntSet.makeEmpty(); for (InstanceKey element : ik) { int index = instanceKeys.getMappedIndex(element); if (index != -1) { s.add(index); } else { assert index != -1 : "instance " + element + " not mapped!"; } } return new OrdinalSet<>(s, instanceKeys); }
/** * @return the set of interesting nodes reachable from n */ public OrdinalSet<S> getReachableSet(Object n) throws IllegalStateException { if (solver == null) { throw new IllegalStateException("must call solve() before calling getReachableSet()"); } BitVectorVariable v = solver.getOut(n); assert v != null : "null variable for node " + n; if (v.getValue() == null) { return OrdinalSet.empty(); } else { return new OrdinalSet<>(v.getValue(), domain); } }
/** * @return the set of interesting nodes reachable from n */ public OrdinalSet<S> getReachableSet(Object n) throws IllegalStateException { if (solver == null) { throw new IllegalStateException("must call solve() before calling getReachableSet()"); } BitVectorVariable v = solver.getOut(n); assert v != null : "null variable for node " + n; if (v.getValue() == null) { return OrdinalSet.empty(); } else { return new OrdinalSet<>(v.getValue(), domain); } }
/** * @return the set of interesting nodes reachable from n */ public OrdinalSet<S> getReachableSet(Object n) throws IllegalStateException { if (solver == null) { throw new IllegalStateException("must call solve() before calling getReachableSet()"); } BitVectorVariable v = solver.getOut(n); assert v != null : "null variable for node " + n; if (v.getValue() == null) { return OrdinalSet.empty(); } else { return new OrdinalSet<>(v.getValue(), domain); } }
/** * @return the set of all locations read by any callee at a call site. */ private static OrdinalSet<PointerKey> unionHeapLocations(CallGraph cg, CGNode n, SSAAbstractInvokeInstruction call, Map<CGNode, OrdinalSet<PointerKey>> loc) { BitVectorIntSet bv = new BitVectorIntSet(); for (CGNode t : cg.getPossibleTargets(n, call.getCallSite())) { bv.addAll(loc.get(t).getBackingSet()); } return new OrdinalSet<>(bv, loc.get(n).getMapping()); }
/** * @return the set of all locations read by any callee at a call site. */ private static OrdinalSet<PointerKey> unionHeapLocations(CallGraph cg, CGNode n, SSAAbstractInvokeInstruction call, Map<CGNode, OrdinalSet<PointerKey>> loc) { BitVectorIntSet bv = new BitVectorIntSet(); for (CGNode t : cg.getPossibleTargets(n, call.getCallSite())) { bv.addAll(loc.get(t).getBackingSet()); } return new OrdinalSet<>(bv, loc.get(n).getMapping()); }
private OrdinalSet<InstanceKey> toOrdinalInstanceKeySet(Collection<IClass> c) { BimodalMutableIntSet s = new BimodalMutableIntSet(); for (IClass klass : c) { int index = getInstanceKeyMapping().add(new ConcreteTypeKey(klass)); s.add(index); } return new OrdinalSet<>(s, getInstanceKeyMapping()); }
private OrdinalSet<InstanceKey> toOrdinalInstanceKeySet(Collection<IClass> c) { BimodalMutableIntSet s = new BimodalMutableIntSet(); for (IClass klass : c) { int index = getInstanceKeyMapping().add(new ConcreteTypeKey(klass)); s.add(index); } return new OrdinalSet<>(s, getInstanceKeyMapping()); }
private OrdinalSet<InstanceKey> computeImplicitPointsToSetAtPhi(CGNode node, SSAPhiInstruction instruction) { MutableSparseIntSet S = MutableSparseIntSet.makeEmpty(); for (int i = 0; i < instruction.getNumberOfUses(); i++) { int vn = instruction.getUse(i); if (vn != -1) { PointerKey lpk = pointerKeys.getPointerKeyForLocal(node, vn); OrdinalSet pointees = getPointsToSet(lpk); IntSet set = pointees.getBackingSet(); if (set != null) { S.addAll(set); } } } return new OrdinalSet<>(S, instanceKeys); }
private OrdinalSet<InstanceKey> computeImplicitPointsToSetAtPi(CGNode node, SSAPiInstruction instruction) { MutableSparseIntSet S = MutableSparseIntSet.makeEmpty(); for (int i = 0; i < instruction.getNumberOfUses(); i++) { int vn = instruction.getUse(i); if (vn != -1) { PointerKey lpk = pointerKeys.getPointerKeyForLocal(node, vn); OrdinalSet pointees = getPointsToSet(lpk); IntSet set = pointees.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> computeImplicitPointsToSetAtALoad(CGNode node, SSAArrayLoadInstruction instruction) { PointerKey arrayRef = pointerKeys.getPointerKeyForLocal(node, instruction.getArrayRef()); MutableSparseIntSet S = MutableSparseIntSet.makeEmpty(); OrdinalSet<InstanceKey> refs = getPointsToSet(arrayRef); for (InstanceKey ik : refs) { PointerKey key = pointerKeys.getPointerKeyForArrayContents(ik); OrdinalSet pointees = getPointsToSet(key); IntSet set = pointees.getBackingSet(); if (set != null) { S.addAll(set); } } return new OrdinalSet<>(S, instanceKeys); }
private OrdinalSet<InstanceKey> computeImplicitPointsToSetAtALoad(CGNode node, SSAArrayLoadInstruction instruction) { PointerKey arrayRef = pointerKeys.getPointerKeyForLocal(node, instruction.getArrayRef()); MutableSparseIntSet S = MutableSparseIntSet.makeEmpty(); OrdinalSet<InstanceKey> refs = getPointsToSet(arrayRef); for (InstanceKey ik : refs) { PointerKey key = pointerKeys.getPointerKeyForArrayContents(ik); OrdinalSet pointees = getPointsToSet(key); IntSet set = pointees.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); }