public boolean isImplicit(PointerKey result) { return pointsToMap.isImplicit(result); }
public boolean isImplicit(PointerKey result) { return pointsToMap.isImplicit(result); }
/** * 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; } }
/** * If p is unified, returns the representative for p. */ public PointsToSetVariable getPointsToSet(PointerKey p) { if (p == null) { throw new IllegalArgumentException("null p"); } if (isImplicit(p)) { throw new IllegalArgumentException("unexpected: shouldn't ask a PointsToMap for an implicit points-to-set: " + p); } int i = pointerKeys.getMappedIndex(p); if (i == -1) { return null; } int repI = uf.find(i); PointsToSetVariable result = (PointsToSetVariable) pointsToSets.get(repI); if (result != null && p instanceof FilteredPointerKey && (!(result.getPointerKey() instanceof FilteredPointerKey))) { upgradeToFilter(result, ((FilteredPointerKey) p).getTypeFilter()); } return result; }
/** * If p is unified, returns the representative for p. */ public PointsToSetVariable getPointsToSet(PointerKey p) { if (p == null) { throw new IllegalArgumentException("null p"); } if (isImplicit(p)) { throw new IllegalArgumentException("unexpected: shouldn't ask a PointsToMap for an implicit points-to-set: " + p); } int i = pointerKeys.getMappedIndex(p); if (i == -1) { return null; } int repI = uf.find(i); PointsToSetVariable result = (PointsToSetVariable) pointsToSets.get(repI); if (result != null && p instanceof FilteredPointerKey && (!(result.getPointerKey() instanceof FilteredPointerKey))) { upgradeToFilter(result, ((FilteredPointerKey) p).getTypeFilter()); } return result; }
/** * 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(); } } }
if (pointsToMap.isImplicit(key)) { System.err.println("Did not expect to findOrCreatePointsToSet for implicitly represented PointerKey"); System.err.println(key);
if (pointsToMap.isImplicit(key)) { System.err.println("Did not expect to findOrCreatePointsToSet for implicitly represented PointerKey"); System.err.println(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); } }