@Override public Iterator<PointerKey> getPointerKeysForReflectedFieldWrite(InstanceKey I, InstanceKey F) { List<PointerKey> result = new LinkedList<>(); if (F instanceof ConstantKey) { PointerKey ifk = getInstanceFieldPointerKeyForConstant(I, (ConstantKey<?>) F); if (ifk != null) { result.add(ifk); } } result.add(ReflectedFieldPointerKey.mapped(new ConcreteTypeKey(getFieldNameType(F)), I)); return result.iterator(); }
if (result instanceof ConcreteTypeKey) { ConcreteTypeKey c = (ConcreteTypeKey) result; if (c.getConcreteType().getReference().equals(TypeReference.JavaLangString)) { .getConcreteType())); } else { Assertions.UNREACHABLE("need to handle " + result.getClass());
assert ik instanceof ConcreteTypeKey : "uh oh: need to implement getCaughtException constraints for instance " + ik; ConcreteTypeKey ck = (ConcreteTypeKey) ik; IClass klass = ck.getType(); if (PropagationCallGraphBuilder.catches(catchClasses, klass, cha)) { addNode(exceptionVar);
assert ik instanceof ConcreteTypeKey : "uh oh: need to implement getCaughtException constraints for instance " + ik; ConcreteTypeKey ck = (ConcreteTypeKey) ik; IClass klass = ck.getType(); if (PropagationCallGraphBuilder.catches(catchClasses, klass, cha)) { addNode(exceptionVar);
@Override public Iterator<PointerKey> getPointerKeysForReflectedFieldWrite(InstanceKey I, InstanceKey F) { List<PointerKey> result = new LinkedList<>(); if (F instanceof ConstantKey) { PointerKey ifk = getInstanceFieldPointerKeyForConstant(I, (ConstantKey<?>) F); if (ifk != null) { result.add(ifk); } } result.add(ReflectedFieldPointerKey.mapped(new ConcreteTypeKey(getFieldNameType(F)), I)); return result.iterator(); }
IClass klass = ck.getType(); if (PropagationCallGraphBuilder.catches(catchClasses, klass, cha)) { g.addNode(exceptionVar);
if (result instanceof ConcreteTypeKey) { ConcreteTypeKey c = (ConcreteTypeKey) result; if (c.getConcreteType().getReference().equals(TypeReference.JavaLangString)) { .getConcreteType())); } else { Assertions.UNREACHABLE("need to handle " + result.getClass());
/** * @return a set of ConcreteTypeKeys that represent the exceptions the PEI may throw. */ @Override public InstanceKey getInstanceKeyForPEI(CGNode node, ProgramCounter peiLoc, TypeReference type) { IClass klass = cha.lookupClass(type); if (klass == null) { return null; } return new ConcreteTypeKey(cha.lookupClass(type)); }
IClass klass = ck.getType(); if (PropagationCallGraphBuilder.catches(catchClasses, klass, cha)) { g.addNode(exceptionVar);
/** * @return a set of ConcreteTypeKeys that represent the exceptions the PEI may throw. */ @Override public InstanceKey getInstanceKeyForPEI(CGNode node, ProgramCounter peiLoc, TypeReference type) { IClass klass = cha.lookupClass(type); if (klass == null) { return null; } return new ConcreteTypeKey(cha.lookupClass(type)); }
IClass klass = ck.getType(); if (PropagationCallGraphBuilder.catches(catchClasses, klass, cha)) { addNode(exceptionVar);
@Override public InstanceKey getInstanceKeyForAllocation(CGNode node, NewSiteReference allocation) { if (allocation == null) { throw new IllegalArgumentException("allocation is null"); } if (String.valueOf(allocation).contains("java/lang/invoke/DirectMethodHandle$StaticAccessor")) { System.err.println("got " + allocation + " in " + node); } if (options.getClassTargetSelector() == null) { throw new IllegalStateException("options did not specify class target selector"); } IClass type = options.getClassTargetSelector().getAllocatedTarget(node, allocation); if (type == null) { return null; } ConcreteTypeKey key = new ConcreteTypeKey(type); return key; }
IClass klass = ck.getType(); if (PropagationCallGraphBuilder.catches(catchClasses, klass, cha)) { addNode(exceptionVar);
/** * @param pei a PEI instruction * @param cha governing class hierarchy * @return a set of ConcreteTypeKeys that represent the exceptions the PEI may throw. * @throws IllegalArgumentException if pei is null */ public static InstanceKey[] getInstanceKeysForPEI(SSAInstruction pei, IClassHierarchy cha) { if (pei == null) { throw new IllegalArgumentException("pei is null"); } Collection<TypeReference> types = pei.getExceptionTypes(); // TODO: institute a cache? if (types == null) { return null; } InstanceKey[] result = new InstanceKey[types.size()]; int i = 0; for (TypeReference type : types) { assert type != null; IClass klass = cha.lookupClass(type); result[i++] = new ConcreteTypeKey(klass); } return result; }
IClass klass = ck.getType(); if (PropagationCallGraphBuilder.catches(catchClasses, klass, cha)) { system.newConstraint(exceptionVar, getInstanceKeyForPEI(node, peiLoc, type, instanceKeyFactory));
@Override public InstanceKey getInstanceKeyForAllocation(CGNode node, NewSiteReference allocation) { if (allocation == null) { throw new IllegalArgumentException("allocation is null"); } if (String.valueOf(allocation).contains("java/lang/invoke/DirectMethodHandle$StaticAccessor")) { System.err.println("got " + allocation + " in " + node); } if (options.getClassTargetSelector() == null) { throw new IllegalStateException("options did not specify class target selector"); } IClass type = options.getClassTargetSelector().getAllocatedTarget(node, allocation); if (type == null) { return null; } ConcreteTypeKey key = new ConcreteTypeKey(type); return key; }
IClass klass = ck.getType(); if (PropagationCallGraphBuilder.catches(catchClasses, klass, cha)) { system.newConstraint(exceptionVar, getInstanceKeyForPEI(node, peiLoc, type, instanceKeyFactory));
/** * @param pei a PEI instruction * @param cha governing class hierarchy * @return a set of ConcreteTypeKeys that represent the exceptions the PEI may throw. * @throws IllegalArgumentException if pei is null */ public static InstanceKey[] getInstanceKeysForPEI(SSAInstruction pei, IClassHierarchy cha) { if (pei == null) { throw new IllegalArgumentException("pei is null"); } Collection<TypeReference> types = pei.getExceptionTypes(); // TODO: institute a cache? if (types == null) { return null; } InstanceKey[] result = new InstanceKey[types.size()]; int i = 0; for (TypeReference type : types) { assert type != null; IClass klass = cha.lookupClass(type); result[i++] = new ConcreteTypeKey(klass); } return result; }
InstanceKey ik = SSAPropagationCallGraphBuilder.getInstanceKeyForPEI(node, peiLoc, type, iKeyFactory); ConcreteTypeKey ck = (ConcreteTypeKey) ik; IClass klass = ck.getType(); if (PropagationCallGraphBuilder.catches(caughtTypes, klass, getCallGraph().getClassHierarchy())) { S.add(instanceKeys.getMappedIndex(SSAPropagationCallGraphBuilder
/** * @param c {@code Collection<IClass>} */ private static MutableMapping<InstanceKey> makeInstanceKeys(Collection<IClass> c) { if (c == null) { throw new IllegalArgumentException("null c"); } MutableMapping<InstanceKey> result = MutableMapping.make(); for (IClass klass : c) { if (!klass.isAbstract() && !klass.isInterface()) { result.add(new ConcreteTypeKey(klass)); } } return result; }