private void continueTraversal(int pValue, SMGSingleLinkedListCandidate pCandidate) { SMGEdgePointsTo pt = smg.getPointer(pValue); SMGObject object = pt.getObject(); if (!candidates.containsKey(object)) { startTraversal(object); } if (inboundPointers.get(pValue) > 1) { return; } Map<Integer, SMGSingleLinkedListCandidate> objectCandidates = candidates.get(object); Integer offset = pCandidate.getOffset(); if (!objectCandidates.containsKey(offset)) { // try to infer a pointer presence: either NULL, or uninitialized if (smg.isCoveredByNullifiedBlocks(object, offset, AnonymousTypes.dummyPointer)) { objectCandidates.put(offset, new SMGSingleLinkedListCandidate(object, offset, 1)); } } if (objectCandidates.containsKey(offset)) { SMGSingleLinkedListCandidate myCandidate = objectCandidates.get(offset); if (pCandidate.isCompatibleWith(myCandidate)) { objectCandidates.remove(offset); pCandidate.addLength(myCandidate.getLength()); } } }
@Override public Set<SMGAbstractionCandidate> traverse(CLangSMG pSmg) { smg = pSmg; buildInboundPointers(); for (SMGObject object : smg.getHeapObjects()) { startTraversal(object); } Set<SMGAbstractionCandidate> returnSet = new HashSet<>(); for (Map<Integer, SMGSingleLinkedListCandidate> objCandidates : candidates.values()) { for (SMGSingleLinkedListCandidate candidate : objCandidates.values()) { if (candidate.getLength() > seqLengthThreshold) { returnSet.add(candidate); } } } return Collections.unmodifiableSet(returnSet); }