@Override public boolean shouldRefine(IField field, PointerKey basePtr, PointerKey val, IFlowLabel label, StateMachine.State state) { if (field == null) { throw new IllegalArgumentException("null field"); } if (field == ArrayContents.v()) { return true; } else { final IClass declaringClass = field.getDeclaringClass(); final Matcher m = refinePattern.matcher(declaringClass.toString()); final boolean foundPattern = m.find(); recordDecision(declaringClass, foundPattern); return foundPattern; } }
@Override public boolean shouldRefine(IField field, PointerKey basePtr, PointerKey val, IFlowLabel label, StateMachine.State state) { if (field == null) { throw new IllegalArgumentException("null field"); } if (field == ArrayContents.v()) { return true; } else { final IClass declaringClass = field.getDeclaringClass(); final Matcher m = refinePattern.matcher(declaringClass.toString()); final boolean foundPattern = m.find(); recordDecision(declaringClass, foundPattern); return foundPattern; } }
@Override public String descString() { return field.getDeclaringClass().toString() + '.' + field.getName().toString(); }
@Override public String descString() { return field.getDeclaringClass().toString() + '.' + field.getName().toString(); }
private static void verboseAction(PointerKey p) { if (p instanceof AbstractFieldPointerKey) { AbstractFieldPointerKey f = (AbstractFieldPointerKey) p; if (f.getInstanceKey().getConcreteType() != null) { TypeReference t = f.getInstanceKey().getConcreteType().getReference(); if (!considered.contains(t)) { considered.add(t); System.err.println("Considered " + t); } } } else if (p instanceof StaticFieldKey) { StaticFieldKey sf = (StaticFieldKey) p; TypeReference t = sf.getField().getDeclaringClass().getReference(); if (!considered.contains(t)) { considered.add(t); System.err.println("Considered " + t); } } }
@Override public boolean shouldRefine(IField field, PointerKey basePtr, PointerKey val, IFlowLabel label, StateMachine.State state) { if (field == null) { throw new IllegalArgumentException("null field"); } if (field == ArrayContents.v()) { return true; } IClass classToCheck = removeInner(field.getDeclaringClass()); if (superOfAnyEncountered(classToCheck)) { return true; } else { if (firstSkippedClass == null) { firstSkippedClass = classToCheck; } return false; } }
@Override public boolean shouldRefine(IField field, PointerKey basePtr, PointerKey val, IFlowLabel label, StateMachine.State state) { if (field == null) { throw new IllegalArgumentException("null field"); } if (field == ArrayContents.v()) { return true; } IClass classToCheck = removeInner(field.getDeclaringClass()); if (superOfAnyEncountered(classToCheck)) { return true; } else { if (firstSkippedClass == null) { firstSkippedClass = classToCheck; } return false; } }
IField field = cg.getClassHierarchy().resolveField(fref); if(field != null) { IClass cls = field.getDeclaringClass(); if(cls != null) { if (!refs.get(cgNode).containsKey(cls)) { IField field = cg.getClassHierarchy().resolveField(fput); if(field != null) { IClass cls = field.getDeclaringClass(); if(cls != null) { if (!mods.get(cgNode).containsKey(cls)) {
private static void verboseAction(PointerKey p) { if (p instanceof AbstractFieldPointerKey) { AbstractFieldPointerKey f = (AbstractFieldPointerKey) p; if (f.getInstanceKey().getConcreteType() != null) { TypeReference t = f.getInstanceKey().getConcreteType().getReference(); if (!considered.contains(t)) { considered.add(t); System.err.println("Considered " + t); } } } else if (p instanceof StaticFieldKey) { StaticFieldKey sf = (StaticFieldKey) p; TypeReference t = sf.getField().getDeclaringClass().getReference(); if (!considered.contains(t)) { considered.add(t); System.err.println("Considered " + t); } } }
IField field = cg.getClassHierarchy().resolveField(fref); if(field != null) { IClass cls = field.getDeclaringClass(); if(cls != null) { if (!refs.get(cgNode).containsKey(cls)) { IField field = cg.getClassHierarchy().resolveField(fput); if(field != null) { IClass cls = field.getDeclaringClass(); if(cls != null) { if (!mods.get(cgNode).containsKey(cls)) {
/** * @return the PointerKey that acts as a representation for the class of pointers that includes the given instance field. null if * there's some problem. * @throws IllegalArgumentException if I is null * @throws IllegalArgumentException if field is null */ public PointerKey getPointerKeyForInstanceField(InstanceKey I, IField field) { if (field == null) { throw new IllegalArgumentException("field is null"); } if (I == null) { throw new IllegalArgumentException("I is null"); } IClass t = field.getDeclaringClass(); IClass C = I.getConcreteType(); if (!(C instanceof SyntheticClass)) { if (!getClassHierarchy().isSubclassOf(C, t)) { return null; } } return pointerKeyFactory.getPointerKeyForInstanceField(I, field); }
/** * @return the PointerKey that acts as a representation for the class of pointers that includes the given instance field. null if * there's some problem. * @throws IllegalArgumentException if I is null * @throws IllegalArgumentException if field is null */ public PointerKey getPointerKeyForInstanceField(InstanceKey I, IField field) { if (field == null) { throw new IllegalArgumentException("field is null"); } if (I == null) { throw new IllegalArgumentException("I is null"); } IClass t = field.getDeclaringClass(); IClass C = I.getConcreteType(); if (!(C instanceof SyntheticClass)) { if (!getClassHierarchy().isSubclassOf(C, t)) { return null; } } return pointerKeyFactory.getPointerKeyForInstanceField(I, field); }
private int compareStaticKey(StaticFieldKey key1, Object key2) { if (key2 instanceof StaticFieldKey) { int n1 = cha.getNumber( key1.getField().getDeclaringClass() ); int n2 = cha.getNumber( ((StaticFieldKey)key2).getField().getDeclaringClass() ); if (n1 != n2) return n1-n2; else { return compareFields(key1.getField(), ((StaticFieldKey)key2).getField()); } } else return -1; }
private int compareStaticKey(StaticFieldKey key1, Object key2) { if (key2 instanceof StaticFieldKey) { int n1 = cha.getNumber( key1.getField().getDeclaringClass() ); int n2 = cha.getNumber( ((StaticFieldKey)key2).getField().getDeclaringClass() ); if (n1 != n2) return n1-n2; else { return compareFields(key1.getField(), ((StaticFieldKey)key2).getField()); } } else return -1; }
IField field = cg.getClassHierarchy().resolveField(fref); if(field != null) { IClass cls = field.getDeclaringClass(); if(cls != null) { if (!trefs.get(node).containsKey(cls)) { IField field = cg.getClassHierarchy().resolveField(fput); if(field != null) { IClass cls = field.getDeclaringClass(); if(cls != null) { if (!tmods.get(node).containsKey(cls)) {
if (!set.contains(sf.getField().getDeclaringClass().getReference().getName().toString().substring(1))) { result.add(p); if (VERBOSE) {
if (!set.contains(sf.getField().getDeclaringClass().getReference().getName().toString().substring(1))) { result.add(p); if (VERBOSE) {
public static TypeReference getType(PointerKey pk) { if (pk instanceof AbstractFieldPointerKey) { AbstractFieldPointerKey f = (AbstractFieldPointerKey) pk; if (f.getInstanceKey().getConcreteType() != null) { return f.getInstanceKey().getConcreteType().getReference(); } } else if (pk instanceof StaticFieldKey) { StaticFieldKey sf = (StaticFieldKey) pk; return sf.getField().getDeclaringClass().getReference(); } return null; } }
public static TypeReference getType(PointerKey pk) { if (pk instanceof AbstractFieldPointerKey) { AbstractFieldPointerKey f = (AbstractFieldPointerKey) pk; if (f.getInstanceKey().getConcreteType() != null) { return f.getInstanceKey().getConcreteType().getReference(); } } else if (pk instanceof StaticFieldKey) { StaticFieldKey sf = (StaticFieldKey) pk; return sf.getField().getDeclaringClass().getReference(); } return null; } }
private Set<CodeElement> getFieldAccessCodeElts(CGNode node, SSAFieldAccessInstruction inst) { if (inst.isStatic()) { return getStaticFieldAccessCodeElts(inst); } Set<CodeElement> elts = HashSetFactory.make(); final FieldReference fieldRef = inst.getDeclaredField(); final IField field = node.getClassHierarchy().resolveField(fieldRef); PointerKey pk = pa.getHeapModel().getPointerKeyForLocal(node, inst.getRef()); final OrdinalSet<InstanceKey> pointsToSet = pa.getPointsToSet(pk); if (pointsToSet.isEmpty()) { InstanceKey ik = new ConcreteTypeKey(field.getDeclaringClass()); elts.add(new FieldElement(ik, fieldRef)); elts.add(new InstanceKeyElement(ik)); } else { for (InstanceKey ik : pointsToSet) { elts.add(new FieldElement(ik, fieldRef)); elts.add(new InstanceKeyElement(ik)); } } return elts; }