@Override public byte evaluate(final PointsToSetVariable lhs, PointsToSetVariable rhs) { class Op implements IntSetAction { private boolean changed = false; @Override public void act(int x) { InstanceKey protoObj = system.getInstanceKey(x); PointerKey protoObjKey = new TransitivePrototypeKey(protoObj); changed |= system.newStatement(lhs, assignOperator, system.findOrCreatePointsToSet(protoObjKey), true, true); } } if (rhs.getValue() != null) { Op op = new Op(); rhs.getValue().foreach(op); return (op.changed? CHANGED: NOT_CHANGED); } return NOT_CHANGED; }
@Override public boolean addInverseFiltered(PropagationSystem system, PointsToSetVariable L, PointsToSetVariable R) { IntSet f = system.getInstanceKeysForClass(concreteType); // SJF: this is horribly inefficient. we really don't want to do // diffs in here. TODO: fix it. probably keep not(f) cached and // use addAllInIntersection return (f == null) ? L.addAll(R) : L.addAll(IntSetUtil.diff(R.getValue(), f)); }
@Override public boolean addInverseFiltered(PropagationSystem system, PointsToSetVariable L, PointsToSetVariable R) { int idx = system.findOrCreateIndexForInstanceKey(concreteType); if (!R.contains(idx) || L.contains(idx)) { return L.addAll(R); } else { MutableIntSet copy = IntSetUtil.makeMutableCopy(R.getValue()); copy.remove(idx); return L.addAll(copy); } }
if (DEBUG_ARRAY_LOAD) { PointsToSetVariable def = getFixedSet(); String S = "EVAL ArrayLoad " + rhs.getPointerKey() + ' ' + def.getPointerKey(); System.err.println(S); System.err.println("EVAL ArrayLoad " + def + ' ' + rhs); if (rhs.size() == 0) { return NOT_CHANGED; final PointerKey dVal = def.getPointerKey(); }; if (priorInstances != null) { rhs.getValue().foreachExcluding(priorInstances, action); priorInstances.addAll(rhs.getValue()); } else { rhs.getValue().foreach(action);
/** * Simply add the instance to each relevant points-to set. */ @Override public byte evaluate(PointsToSetVariable dummyLHS, PointsToSetVariable var) { PointsToSetVariable ref = var; if (ref.size() == 0) { return NOT_CHANGED; } IntSet value = ref.getValue(); final MutableBoolean sideEffect = new MutableBoolean(); IntSetAction action = i -> { InstanceKey I = system.getInstanceKey(i); if (!representsNullType(I)) { PointerKey p = getPointerKeyForInstanceField(I, field); if (p != null) { sideEffect.b |= system.newConstraint(p, instance); } } }; if (priorInstances != null) { value.foreachExcluding(priorInstances, action); priorInstances.addAll(value); } else { value.foreach(action); } byte sideEffectMask = sideEffect.b ? (byte) SIDE_EFFECT_MASK : 0; return (byte) (NOT_CHANGED | sideEffectMask); }
int rep = uf.find(repI); PointsToSetVariable p = (PointsToSetVariable) pointsToSets.get(rep); if (pi.getValue() != null) { p.addAll(pi.getValue()); if (pj.getValue() != null) { p.addAll(pj.getValue()); recordUnified(pi.getPointerKey()); upgradeTypeFilter(pi, p); recordUnified(pj.getPointerKey()); upgradeTypeFilter(pj, p); if (isTransitiveRoot(pi.getPointerKey()) || isTransitiveRoot(pj.getPointerKey())) { recordTransitiveRoot(p.getPointerKey());
result = new PointsToSetVariable(key); pointsToMap.put(key, result); } else { PointerKey pk = result.getPointerKey(); if (!(pk instanceof FilteredPointerKey)) { result.setPointerKey(key); pk = key;
@Override public int getNumberOfStatementsThatDef(PointsToSetVariable v) { if (v == null) { throw new IllegalArgumentException("v is null"); } int number = v.getGraphNodeId(); if (number == -1) { return 0; } int result = delegateGraph.getPredNodeCount(v); for (IBinaryNaturalRelation R : implicitUnaryMap.values()) { IntSet s = R.getRelated(number); if (s != null) { result += s.size(); } } return result; }
@Override public boolean equals(Object o) { if (o == null) { return false; } if (getClass().equals(o.getClass())) { UnarySideEffect other = (UnarySideEffect) o; return fixedSet.equals(other.fixedSet); } else { return false; } }
if (!L.add(index)) { if (L.getGraphNodeId() > -1) { changedVariable(L);
@Override public boolean addAll(PointsToSetVariable other) { if (PARANOID) { checkTypes(other.getValue()); } // TODO Auto-generated method stub boolean v = super.addAll(other); cryIfTooBig(); return v; }
@Override public boolean addFiltered(PropagationSystem system, PointsToSetVariable L, PointsToSetVariable R) { IntSet f = bits(system); return (f == null) ? false : L.addAllInIntersection(R, f); }
@Override public void act(int i) { InstanceKey I = system.getInstanceKey(i); IClass C = I.getConcreteType(); if ((C.getMethod(targetMethod.getSelector()) == targetMethod) == sense) { if (L.add(i)) { result = true; } } } }
@Override public byte evaluate(PointsToSetVariable lhs, PointsToSetVariable rhs) { if (PropagationCallGraphBuilder.DEBUG_ASSIGN) { String S = "EVAL Assign " + lhs.getPointerKey() + ' ' + rhs.getPointerKey(); S = S + "\nEVAL " + lhs + ' ' + rhs; System.err.println(S); } boolean changed = lhs.addAll(rhs); if (PropagationCallGraphBuilder.DEBUG_ASSIGN) { System.err.println("RESULT " + lhs + (changed ? " (changed)" : "")); } return changed ? CHANGED : NOT_CHANGED; }
if (DEBUG_ARRAY_LOAD) { PointsToSetVariable def = getFixedSet(); String S = "EVAL ArrayLoad " + rhs.getPointerKey() + ' ' + def.getPointerKey(); System.err.println(S); System.err.println("EVAL ArrayLoad " + def + ' ' + rhs); if (rhs.size() == 0) { return NOT_CHANGED; final PointerKey dVal = def.getPointerKey(); }; if (priorInstances != null) { rhs.getValue().foreachExcluding(priorInstances, action); priorInstances.addAll(rhs.getValue()); } else { rhs.getValue().foreach(action);
/** * Simply add the instance to each relevant points-to set. */ @Override public byte evaluate(PointsToSetVariable dummyLHS, PointsToSetVariable var) { PointsToSetVariable ref = var; if (ref.size() == 0) { return NOT_CHANGED; } IntSet value = ref.getValue(); final MutableBoolean sideEffect = new MutableBoolean(); IntSetAction action = i -> { InstanceKey I = system.getInstanceKey(i); if (!representsNullType(I)) { PointerKey p = getPointerKeyForInstanceField(I, field); if (p != null) { sideEffect.b |= system.newConstraint(p, instance); } } }; if (priorInstances != null) { value.foreachExcluding(priorInstances, action); priorInstances.addAll(value); } else { value.foreach(action); } byte sideEffectMask = sideEffect.b ? (byte) SIDE_EFFECT_MASK : 0; return (byte) (NOT_CHANGED | sideEffectMask); }
@Override public boolean addInverseFiltered(PropagationSystem system, PointsToSetVariable L, PointsToSetVariable R) { int idx = system.findOrCreateIndexForInstanceKey(concreteType); if (!R.contains(idx) || L.contains(idx)) { return L.addAll(R); } else { MutableIntSet copy = IntSetUtil.makeMutableCopy(R.getValue()); copy.remove(idx); return L.addAll(copy); } }
int rep = uf.find(repI); PointsToSetVariable p = (PointsToSetVariable) pointsToSets.get(rep); if (pi.getValue() != null) { p.addAll(pi.getValue()); if (pj.getValue() != null) { p.addAll(pj.getValue()); recordUnified(pi.getPointerKey()); upgradeTypeFilter(pi, p); recordUnified(pj.getPointerKey()); upgradeTypeFilter(pj, p); if (isTransitiveRoot(pi.getPointerKey()) || isTransitiveRoot(pj.getPointerKey())) { recordTransitiveRoot(p.getPointerKey());
result = new PointsToSetVariable(key); pointsToMap.put(key, result); } else { PointerKey pk = result.getPointerKey(); if (!(pk instanceof FilteredPointerKey)) { result.setPointerKey(key); pk = key;