/** * get type for F appropriate for use in a field name. */ protected IClass getFieldNameType(InstanceKey F) { return F.getConcreteType(); }
protected LexicalParent[] getParents(InstanceKey base) { DynamicMethodObject function = (DynamicMethodObject) base.getConcreteType().getMethod(AstMethodReference.fnSelector); return function==null? new LexicalParent[0]: function.getParents(); }
@Override protected boolean needsScopeMappingKey(InstanceKey base) { return cha.isSubclassOf(base.getConcreteType(), codeBody) && getParents(base).length > 0; }
@Override public TypeFilter getTypeFilter() { return new SingleClassFilter(((ArrayClass) instance.getConcreteType()).getElementClass()); } }
/** * Handle assign of a particular exception instance into an exception variable * * @param exceptionVar points-to set for a variable representing a caught exception * @param catchClasses set of TypeReferences that the exceptionVar may catch * @param e a particular exception instance */ protected void assignInstanceToCatch(PointerKey exceptionVar, Set<IClass> catchClasses, InstanceKey e) { if (catches(catchClasses, e.getConcreteType(), cha)) { system.newConstraint(exceptionVar, e); } }
protected LexicalParent[] getParents(InstanceKey base) { DynamicMethodObject function = (DynamicMethodObject) base.getConcreteType().getMethod(AstMethodReference.fnSelector); return function==null? new LexicalParent[0]: function.getParents(); }
@Override protected boolean needsScopeMappingKey(InstanceKey base) { return cha.isSubclassOf(base.getConcreteType(), codeBody) && getParents(base).length > 0; }
@Override public TypeFilter getTypeFilter() { return new SingleClassFilter(((ArrayClass) instance.getConcreteType()).getElementClass()); } }
/** * Handle assign of a particular exception instance into an exception variable * * @param exceptionVar points-to set for a variable representing a caught exception * @param catchClasses set of TypeReferences that the exceptionVar may catch * @param e a particular exception instance */ protected void assignInstanceToCatch(PointerKey exceptionVar, Set<IClass> catchClasses, InstanceKey e) { if (catches(catchClasses, e.getConcreteType(), cha)) { system.newConstraint(exceptionVar, e); } }
@Override public Context getCalleeTarget(CGNode caller, CallSiteReference site, IMethod callee, InstanceKey[] receiver) { if (site.isStatic()) { return Everywhere.EVERYWHERE; } else { if (receiver == null) { throw new IllegalArgumentException("receiver is null"); } PointType P = new PointType(receiver[0].getConcreteType()); return new JavaTypeContext(P); } }
public static boolean representsNullType(InstanceKey key) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key == null"); } IClass cls = key.getConcreteType(); Language L = cls.getClassLoader().getLanguage(); return L.isNullType(cls.getReference()); }
/** * if F is a supported constant representing a field, return the corresponding {@link InstanceFieldKey} for I. Otherwise, return {@code null}. */ protected PointerKey getInstanceFieldPointerKeyForConstant(InstanceKey I, ConstantKey<?> F) { Object v = F.getValue(); // FIXME: current only constant string are handled if (I.getConcreteType().getClassLoader().getLanguage().modelConstant(v)) { IField f = I.getConcreteType().getField(Atom.findOrCreateUnicodeAtom(String.valueOf(v))); return getPointerKeyForInstanceField(I, f); } return null; }
/** * if F is a supported constant representing a field, return the corresponding {@link InstanceFieldKey} for I. Otherwise, return {@code null}. */ protected PointerKey getInstanceFieldPointerKeyForConstant(InstanceKey I, ConstantKey<?> F) { Object v = F.getValue(); // FIXME: current only constant string are handled if (I.getConcreteType().getClassLoader().getLanguage().modelConstant(v)) { IField f = I.getConcreteType().getField(Atom.findOrCreateUnicodeAtom(String.valueOf(v))); return getPointerKeyForInstanceField(I, f); } return null; }
public static boolean representsNullType(InstanceKey key) throws IllegalArgumentException { if (key == null) { throw new IllegalArgumentException("key == null"); } IClass cls = key.getConcreteType(); Language L = cls.getClassLoader().getLanguage(); return L.isNullType(cls.getReference()); }
@Override public PointerKey getPointerKeyForInstanceField(InstanceKey I, IField field) { if (field == null) { throw new IllegalArgumentException("field is null"); } IField resolveAgain = I.getConcreteType().getField(field.getName(), field.getFieldTypeReference().getName()); if (resolveAgain != null) { field = resolveAgain; } return new InstanceFieldKey(I, field); }
@Override public InstanceKey getInstanceKeyForAllocation(CGNode node, NewSiteReference allocation) { if (node.getMethod() instanceof JavaScriptConstructor) { InstanceKey bk = base.getInstanceKeyForAllocation(node, allocation); return new NormalAllocationInNode(node, allocation, bk.getConcreteType()); } else { return base.getInstanceKeyForAllocation(node, allocation); } }
@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 InstanceKey getInstanceKeyForAllocation(CGNode node, NewSiteReference allocation) { if (node.getMethod() instanceof JavaScriptConstructor) { InstanceKey bk = base.getInstanceKeyForAllocation(node, allocation); return new NormalAllocationInNode(node, allocation, bk.getConcreteType()); } else { return base.getInstanceKeyForAllocation(node, allocation); } }
@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 Context getCalleeTarget(CGNode caller, CallSiteReference site, IMethod callee, InstanceKey[] receiver) { if (callee.getReference().equals(GET_CLASS)) { return new JavaTypeContext(new PointType(receiver[0].getConcreteType())); } return null; }