private String printRHSInstances(AbstractStatement s) { if (s instanceof UnaryStatement) { UnaryStatement u = (UnaryStatement) s; PointsToSetVariable rhs = (PointsToSetVariable) u.getRightHandSide(); IntSet value = rhs.getValue(); final int[] topFive = new int[5]; value.foreach(x -> { System.arraycopy(topFive, 1, topFive, 0, 4); topFive[4] = x; }); StringBuilder result = new StringBuilder(); for (int i = 0; i < 5; i++) { int p = topFive[i]; if (p != 0) { InstanceKey ik = getInstanceKey(p); result.append(p).append(" ").append(ik).append('\n'); } } return result.toString(); } else { return s.getClass().toString(); } }
/** * TODO: optimize; this may be inefficient; * * @return an List of instance keys corresponding to the integers in a set */ List<InstanceKey> getInstances(IntSet set) { LinkedList<InstanceKey> result = new LinkedList<>(); for (IntIterator it = set.intIterator(); it.hasNext();) { int j = it.next(); result.add(getInstanceKey(j)); } return result; }
/** * TODO: optimize; this may be inefficient; * * @return an List of instance keys corresponding to the integers in a set */ List<InstanceKey> getInstances(IntSet set) { LinkedList<InstanceKey> result = new LinkedList<>(); for (IntIterator it = set.intIterator(); it.hasNext();) { int j = it.next(); result.add(getInstanceKey(j)); } return result; }
private String printRHSInstances(AbstractStatement s) { if (s instanceof UnaryStatement) { UnaryStatement u = (UnaryStatement) s; PointsToSetVariable rhs = (PointsToSetVariable) u.getRightHandSide(); IntSet value = rhs.getValue(); final int[] topFive = new int[5]; value.foreach(x -> { System.arraycopy(topFive, 1, topFive, 0, 4); topFive[4] = x; }); StringBuilder result = new StringBuilder(); for (int i = 0; i < 5; i++) { int p = topFive[i]; if (p != 0) { InstanceKey ik = getInstanceKey(p); result.append(p).append(" ").append(ik).append('\n'); } } return result.toString(); } else { return s.getClass().toString(); } }
@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 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) { IntSetVariable<?> tv = rhs; if (tv.getValue() != null) { tv.getValue().foreach(ptr -> { InstanceKey iKey = system.getInstanceKey(ptr); PointerKey enclosing = new EnclosingObjectReferenceKey(iKey, cls); system.newConstraint(lvalKey, assignOperator, enclosing); }); } return NOT_CHANGED; }
@Override public byte evaluate(PointsToSetVariable lhs, PointsToSetVariable rhs) { IntSetVariable<?> tv = rhs; if (tv.getValue() != null) { tv.getValue().foreach(ptr -> { InstanceKey iKey = system.getInstanceKey(ptr); PointerKey enclosing = new EnclosingObjectReferenceKey(iKey, cls); system.newConstraint(lvalKey, assignOperator, enclosing); }); } return NOT_CHANGED; }
@Override public byte evaluate(PointsToSetVariable lhs, PointsToSetVariable rhs) { final IntSetVariable<?> objects = rhs; if (objects.getValue() != null) { objects.getValue().foreach(optr -> { InstanceKey object = system.getInstanceKey(optr); PointerKey objCatalog = getPointerKeyForObjectCatalog(object); if (objCatalog != null) { system.newConstraint(lk, assignOperator, objCatalog); } }); } return NOT_CHANGED; }
@Override public byte evaluate(PointsToSetVariable lhs, PointsToSetVariable rhs) { final IntSetVariable<?> objects = rhs; if (objects.getValue() != null) { objects.getValue().foreach(optr -> { InstanceKey object = system.getInstanceKey(optr); PointerKey objCatalog = getPointerKeyForObjectCatalog(object); if (objCatalog != null) { system.newConstraint(lk, assignOperator, objCatalog); } }); } return NOT_CHANGED; }
if (s != null && !s.isEmpty()) { s.foreach(x -> { keys[pi] = system.getInstanceKey(x); rec(pi + 1, rhsi + 1); });
if (s != null && !s.isEmpty()) { s.foreach(x -> { keys[pi] = system.getInstanceKey(x); rec(pi + 1, rhsi + 1); });
@Override public byte evaluate(PointsToSetVariable lhs, PointsToSetVariable rhs) { final IntSetVariable<?> fields = rhs; if (fields.getValue() != null) { fields.getValue().foreach(fptr -> { InstanceKey field = system.getInstanceKey(fptr); for (InstanceKey objKey : objKeys) { for (PointerKey pkey : Iterator2Iterable.make(isLoadOperation ? getPointerKeysForReflectedFieldRead(objKey, field) : getPointerKeysForReflectedFieldWrite(objKey, field))) { AbstractFieldPointerKey key = (AbstractFieldPointerKey) pkey; if (DEBUG_PROPERTIES) action.dump(key, false, true); action.action(key); } } }); } return NOT_CHANGED; }
@Override public byte evaluate(PointsToSetVariable lhs, PointsToSetVariable rhs) { final IntSetVariable<?> fields = rhs; if (fields.getValue() != null) { fields.getValue().foreach(fptr -> { InstanceKey field = system.getInstanceKey(fptr); for (InstanceKey objKey : objKeys) { for (PointerKey pkey : Iterator2Iterable.make(isLoadOperation ? getPointerKeysForReflectedFieldRead(objKey, field) : getPointerKeysForReflectedFieldWrite(objKey, field))) { AbstractFieldPointerKey key = (AbstractFieldPointerKey) pkey; if (DEBUG_PROPERTIES) action.dump(key, false, true); action.action(key); } } }); } return NOT_CHANGED; }
@Override public byte evaluate(PointsToSetVariable lhs, PointsToSetVariable rhs) { final IntSetVariable<?> objects = rhs; if (objects.getValue() != null) { objects.getValue().foreach(optr -> { InstanceKey object = system.getInstanceKey(optr); if (!getBuilder().isUncataloguedField(object.getConcreteType(), hack)) { PointerKey cat = getPointerKeyForObjectCatalog(object); if (cat != null) { system.newConstraint(cat, fieldNameKeys[0]); } } }); } return NOT_CHANGED; }
@Override public byte evaluate(PointsToSetVariable lhs, PointsToSetVariable rhs) { final IntSetVariable<?> objects = rhs; if (objects.getValue() != null) { objects.getValue().foreach(optr -> { InstanceKey object = system.getInstanceKey(optr); if (!getBuilder().isUncataloguedField(object.getConcreteType(), hack)) { PointerKey cat = getPointerKeyForObjectCatalog(object); if (cat != null) { system.newConstraint(cat, fieldNameKeys[0]); } } }); } return NOT_CHANGED; }
/** * 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); }
/** * 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); }
if (objects.getValue() != null) { objects.getValue().foreach(optr -> { InstanceKey object = system.getInstanceKey(optr); PointerKey objCatalog = getPointerKeyForObjectCatalog(object); for (InstanceKey fieldsKey : fieldsKeys) {
if (objects.getValue() != null) { objects.getValue().foreach(optr -> { InstanceKey object = system.getInstanceKey(optr); PointerKey objCatalog = getPointerKeyForObjectCatalog(object); for (InstanceKey fieldsKey : fieldsKeys) {