/** * Update side effect after unification * * @param s set of PointsToSetVariables that have been unified * @param rep number of the representative variable for the unified set. */ private void updateSideEffectsForUnification(HashSet<PointsToSetVariable> s, int rep) { PointsToSetVariable pRef = pointsToMap.getPointsToSet(rep); for (PointsToSetVariable p : s) { updateSideEffects(p, pRef); } }
/** * Update side effect after unification * * @param s set of PointsToSetVariables that have been unified * @param rep number of the representative variable for the unified set. */ private void updateSideEffectsForUnification(HashSet<PointsToSetVariable> s, int rep) { PointsToSetVariable pRef = pointsToMap.getPointsToSet(rep); for (PointsToSetVariable p : s) { updateSideEffects(p, pRef); } }
/** * did the pointer analysis use a type filter for a given points-to set? (this is ugly). */ @Override public boolean isFiltered(PointerKey key) { if (pointsToMap.isImplicit(key)) { return false; } PointsToSetVariable v = pointsToMap.getPointsToSet(key); if (v == null) { return false; } else { return v.getPointerKey() instanceof FilteredPointerKey; } }
/** * did the pointer analysis use a type filter for a given points-to set? (this is ugly). */ @Override public boolean isFiltered(PointerKey key) { if (pointsToMap.isImplicit(key)) { return false; } PointsToSetVariable v = pointsToMap.getPointsToSet(key); if (v == null) { return false; } else { return v.getPointerKey() instanceof FilteredPointerKey; } }
/** * Wipe out the cached transitive closure information */ public void revertToPreTransitive() { for (PointerKey key : Iterator2Iterable.make(iterateKeys())) { if (!isTransitiveRoot(key) && !isImplicit(key) && !isUnified(key)) { PointsToSetVariable v = getPointsToSet(key); v.removeAll(); } } }
/** * Wipe out the cached transitive closure information */ public void revertToPreTransitive() { for (PointerKey key : Iterator2Iterable.make(iterateKeys())) { if (!isTransitiveRoot(key) && !isImplicit(key) && !isUnified(key)) { PointsToSetVariable v = getPointsToSet(key); v.removeAll(); } } }
/** * Unify the points-to-sets for the variables identified by the set s * * @param s numbers of points-to-set variables * @throws IllegalArgumentException if s is null */ public void unify(IntSet s) { if (s == null) { throw new IllegalArgumentException("s is null"); } // cache the variables represented HashSet<PointsToSetVariable> cache = HashSetFactory.make(s.size()); for (IntIterator it = s.intIterator(); it.hasNext();) { int i = it.next(); cache.add(pointsToMap.getPointsToSet(i)); } // unify the variables pointsToMap.unify(s); int rep = pointsToMap.getRepresentative(s.intIterator().next()); // clean up the equations updateEquationsForUnification(cache, rep); // special logic to clean up side effects updateSideEffectsForUnification(cache, rep); }
/** * Unify the points-to-sets for the variables identified by the set s * * @param s numbers of points-to-set variables * @throws IllegalArgumentException if s is null */ public void unify(IntSet s) { if (s == null) { throw new IllegalArgumentException("s is null"); } // cache the variables represented HashSet<PointsToSetVariable> cache = HashSetFactory.make(s.size()); for (IntIterator it = s.intIterator(); it.hasNext();) { int i = it.next(); cache.add(pointsToMap.getPointsToSet(i)); } // unify the variables pointsToMap.unify(s); int rep = pointsToMap.getRepresentative(s.intIterator().next()); // clean up the equations updateEquationsForUnification(cache, rep); // special logic to clean up side effects updateSideEffectsForUnification(cache, rep); }
Assertions.UNREACHABLE(); PointsToSetVariable result = pointsToMap.getPointsToSet(key); if (result == null) { result = new PointsToSetVariable(key);
Assertions.UNREACHABLE(); PointsToSetVariable result = pointsToMap.getPointsToSet(key); if (result == null) { result = new PointsToSetVariable(key);
@Override @SuppressWarnings("unchecked") public OrdinalSet<InstanceKey> getPointsToSet(PointerKey key) { if (pointsToMap.isImplicit(key)) { return computeImplicitPointsToSet(key); } // special logic to handle contents of char[] from string constants. if (key instanceof InstanceFieldKey) { InstanceFieldKey ifk = (InstanceFieldKey) key; if (ifk.getInstanceKey() instanceof ConstantKey) { ConstantKey<?> i = (ConstantKey<?>) ifk.getInstanceKey(); if (i.getValue() instanceof String && i.getConcreteType().getClassLoader().getLanguage().equals(Language.JAVA)) { StringConstantCharArray contents = StringConstantCharArray.make((ConstantKey<String>) i); instanceKeys.add(contents); Collection<InstanceKey> singleton = HashSetFactory.make(); singleton.add(contents); return OrdinalSet.toOrdinalSet(singleton, instanceKeys); } } } PointsToSetVariable v = pointsToMap.getPointsToSet(key); if (v == null) { return OrdinalSet.empty(); } else { IntSet S = v.getValue(); return new OrdinalSet<>(S, instanceKeys); } }
@Override @SuppressWarnings("unchecked") public OrdinalSet<InstanceKey> getPointsToSet(PointerKey key) { if (pointsToMap.isImplicit(key)) { return computeImplicitPointsToSet(key); } // special logic to handle contents of char[] from string constants. if (key instanceof InstanceFieldKey) { InstanceFieldKey ifk = (InstanceFieldKey) key; if (ifk.getInstanceKey() instanceof ConstantKey) { ConstantKey<?> i = (ConstantKey<?>) ifk.getInstanceKey(); if (i.getValue() instanceof String && i.getConcreteType().getClassLoader().getLanguage().equals(Language.JAVA)) { StringConstantCharArray contents = StringConstantCharArray.make((ConstantKey<String>) i); instanceKeys.add(contents); Collection<InstanceKey> singleton = HashSetFactory.make(); singleton.add(contents); return OrdinalSet.toOrdinalSet(singleton, instanceKeys); } } } PointsToSetVariable v = pointsToMap.getPointsToSet(key); if (v == null) { return OrdinalSet.empty(); } else { IntSet S = v.getValue(); return new OrdinalSet<>(S, instanceKeys); } }
PointsToSetVariable pRef = pointsToMap.getPointsToSet(rep); for (PointsToSetVariable p : s) { if (p != pRef) {
PointsToSetVariable pRef = pointsToMap.getPointsToSet(rep); for (PointsToSetVariable p : s) { if (p != pRef) {