addUpwardFunargConstraints(result, name, definer, definingNode);
private Set<CGNode> getLexicalDefiners(final CGNode opNode, final Pair<String, String> definer) { if (definer == null) { return Collections.singleton(getBuilder().getCallGraph().getFakeRootNode()); } else if (getBuilder().sameMethod(opNode, definer.snd)) { PointerKey F = getBuilder().getPointerKeyForLocal(opNode, 1); IRView ir = getBuilder().getCFAContextInterpreter().getIRView(opNode); SymbolTable symtab = ir.getSymbolTable(); DefUse du = getBuilder().getCFAContextInterpreter().getDU(opNode); if (contentsAreInvariant(symtab, du, 1)) { system.recordImplicitPointsToSet(F); final InstanceKey[] functionKeys = getInvariantContents(symtab, du, opNode, 1); for (InstanceKey functionKey : functionKeys) { system.findOrCreateIndexForInstanceKey(functionKey);
private void newFieldOperation(CGNode opNode, final int objVn, final int fieldsVn, final boolean isLoadOperation, final ReflectedFieldAction action) { IRView ir = getBuilder().getCFAContextInterpreter().getIRView(opNode); SymbolTable symtab = ir.getSymbolTable(); DefUse du = getBuilder().getCFAContextInterpreter().getDU(opNode); PointerKey objKey = getBuilder().getPointerKeyForLocal(opNode, objVn); final PointerKey fieldKey = getBuilder().getPointerKeyForLocal(opNode, fieldsVn); if (contentsAreInvariant(symtab, du, objVn)) { InstanceKey[] x = getInvariantContents(symtab, du, opNode, objVn); for (InstanceKey element : x) { system.findOrCreateIndexForInstanceKey(element); if (contentsAreInvariant(symtab, du, fieldsVn)) { InstanceKey[] x = getInvariantContents(symtab, du, opNode, fieldsVn); for (InstanceKey element : x) { system.findOrCreateIndexForInstanceKey(element); if (contentsAreInvariant(symtab, du, objVn)) { system.recordImplicitPointsToSet(objKey); final InstanceKey[] objKeys = getInvariantContents(symtab, du, opNode, objVn); if (contentsAreInvariant(symtab, du, fieldsVn)) { system.recordImplicitPointsToSet(fieldKey); InstanceKey[] fieldsKeys = getInvariantContents(symtab, du, opNode, fieldsVn); newFieldOperationObjectAndFieldConstant(isLoadOperation, action, objKeys, fieldsKeys); newFieldOperationOnlyObjectConstant(isLoadOperation, action, fieldKey, objKeys);
private void newFieldOperation(CGNode opNode, final int objVn, final int fieldsVn, final boolean isLoadOperation, final ReflectedFieldAction action) { IRView ir = getBuilder().getCFAContextInterpreter().getIRView(opNode); SymbolTable symtab = ir.getSymbolTable(); DefUse du = getBuilder().getCFAContextInterpreter().getDU(opNode); PointerKey objKey = getBuilder().getPointerKeyForLocal(opNode, objVn); final PointerKey fieldKey = getBuilder().getPointerKeyForLocal(opNode, fieldsVn); if (contentsAreInvariant(symtab, du, objVn)) { InstanceKey[] x = getInvariantContents(symtab, du, opNode, objVn); for (InstanceKey element : x) { system.findOrCreateIndexForInstanceKey(element); if (contentsAreInvariant(symtab, du, fieldsVn)) { InstanceKey[] x = getInvariantContents(symtab, du, opNode, fieldsVn); for (InstanceKey element : x) { system.findOrCreateIndexForInstanceKey(element); if (contentsAreInvariant(symtab, du, objVn)) { system.recordImplicitPointsToSet(objKey); final InstanceKey[] objKeys = getInvariantContents(symtab, du, opNode, objVn); if (contentsAreInvariant(symtab, du, fieldsVn)) { system.recordImplicitPointsToSet(fieldKey); InstanceKey[] fieldsKeys = getInvariantContents(symtab, du, opNode, fieldsVn); newFieldOperationObjectAndFieldConstant(isLoadOperation, action, objKeys, fieldsKeys); newFieldOperationOnlyObjectConstant(isLoadOperation, action, fieldKey, objKeys);
super.visitPut(inst); if (inst.isStatic() || !getBuilder().useObjectCatalog()) return; final PointerKey objKey = getPointerKeyForLocal(objVn); final InstanceKey[] fieldNameKeys = new InstanceKey[] { getInstanceKeyForConstant(fieldName) }; assert fieldNameKeys.length == 1; if (contentsAreInvariant(symtab, du, objVn)) { system.recordImplicitPointsToSet(objKey); final InstanceKey[] objKeys = getInvariantContents(objVn); if (!getBuilder().isUncataloguedField(objKeys[i].getConcreteType(), fieldName)) { PointerKey objCatalog = getPointerKeyForObjectCatalog(objKeys[i]); if (objCatalog != null) { system.newConstraint(objCatalog, fieldNameKeys[0]);
super.visitPut(inst); if (inst.isStatic() || !getBuilder().useObjectCatalog()) return; final PointerKey objKey = getPointerKeyForLocal(objVn); final InstanceKey[] fieldNameKeys = new InstanceKey[] { getInstanceKeyForConstant(fieldName) }; assert fieldNameKeys.length == 1; if (contentsAreInvariant(symtab, du, objVn)) { system.recordImplicitPointsToSet(objKey); final InstanceKey[] objKeys = getInvariantContents(objVn); if (!getBuilder().isUncataloguedField(objKeys[i].getConcreteType(), fieldName)) { PointerKey objCatalog = getPointerKeyForObjectCatalog(objKeys[i]); if (objCatalog != null) { system.newConstraint(objCatalog, fieldNameKeys[0]);
@Override public void visitEachElementGet(EachElementGetInstruction inst) { int lval = inst.getDef(0); final PointerKey lk = getPointerKeyForLocal(lval); final PointerKey rk = getPointerKeyForLocal(rval); if (contentsAreInvariant(symbolTable, du, rval)) { InstanceKey objects[] = getInvariantContents(rval); for (InstanceKey object : objects) { PointerKey catalog = getPointerKeyForObjectCatalog(object); system.newConstraint(lk, assignOperator, catalog);
if (!isLoadOperation) { for (InstanceKey objKey : objKeys) { PointerKey objCatalog = getPointerKeyForObjectCatalog(objKey); if (objCatalog != null) { system.newConstraint(objCatalog, assignOperator, fieldKey);
@Override public void visitEachElementGet(EachElementGetInstruction inst) { int lval = inst.getDef(0); final PointerKey lk = getPointerKeyForLocal(lval); final PointerKey rk = getPointerKeyForLocal(rval); if (contentsAreInvariant(symbolTable, du, rval)) { InstanceKey objects[] = getInvariantContents(rval); for (InstanceKey object : objects) { PointerKey catalog = getPointerKeyForObjectCatalog(object); system.newConstraint(lk, assignOperator, catalog);
if (!isLoadOperation) { for (InstanceKey objKey : objKeys) { PointerKey objCatalog = getPointerKeyForObjectCatalog(objKey); if (objCatalog != null) { system.newConstraint(objCatalog, assignOperator, fieldKey);
addUpwardFunargConstraints(result, name, definer, definingNode);
private Set<CGNode> getLexicalDefiners(final CGNode opNode, final Pair<String, String> definer) { if (definer == null) { return Collections.singleton(getBuilder().getCallGraph().getFakeRootNode()); } else if (getBuilder().sameMethod(opNode, definer.snd)) { PointerKey F = getBuilder().getPointerKeyForLocal(opNode, 1); IRView ir = getBuilder().getCFAContextInterpreter().getIRView(opNode); SymbolTable symtab = ir.getSymbolTable(); DefUse du = getBuilder().getCFAContextInterpreter().getDU(opNode); if (contentsAreInvariant(symtab, du, 1)) { system.recordImplicitPointsToSet(F); final InstanceKey[] functionKeys = getInvariantContents(symtab, du, opNode, 1); for (InstanceKey functionKey : functionKeys) { system.findOrCreateIndexForInstanceKey(functionKey);
int vn = LI.getExitExposedUses()[i]; if (vn > 0) { IRView ir = getBuilder().getCFAContextInterpreter().getIRView(definingNode); DefUse du = getBuilder().getCFAContextInterpreter().getDU(definingNode); SymbolTable st = ir.getSymbolTable(); PointerKey rhs = getBuilder().getPointerKeyForLocal(definingNode, vn); if (contentsAreInvariant(st, du, vn)) { system.recordImplicitPointsToSet(rhs); final InstanceKey[] objs = getInvariantContents(st, du, definingNode, vn); for (InstanceKey obj : objs) { system.findOrCreateIndexForInstanceKey(obj);
PointerKey cat = getPointerKeyForObjectCatalog(receiver); if (cat != null) { system.newConstraint(cat, assignOperator, fieldKey); if (!doneField.contains(fptr) || !doneReceiver.contains(rptr)) { InstanceKey field = system.getInstanceKey(fptr); for (PointerKey pkey : Iterator2Iterable.make(isLoadOperation ? getPointerKeysForReflectedFieldRead(receiver, field) : getPointerKeysForReflectedFieldWrite(receiver, field))) { AbstractFieldPointerKey key = (AbstractFieldPointerKey) pkey; if (DEBUG_PROPERTIES)
objects.getValue().foreach(optr -> { InstanceKey object = system.getInstanceKey(optr); PointerKey objCatalog = getPointerKeyForObjectCatalog(object); for (InstanceKey fieldsKey : fieldsKeys) { if (isLoadOperation) { for (PointerKey pkey : Iterator2Iterable.make(getPointerKeysForReflectedFieldRead(object, fieldsKey))) { AbstractFieldPointerKey key = (AbstractFieldPointerKey) pkey; if (DEBUG_PROPERTIES) system.newConstraint(objCatalog, fieldsKey); for (PointerKey pkey : Iterator2Iterable.make(getPointerKeysForReflectedFieldWrite(object, fieldsKey))) { AbstractFieldPointerKey key = (AbstractFieldPointerKey) pkey; if (DEBUG_PROPERTIES)
PointerKey cat = getPointerKeyForObjectCatalog(receiver); if (cat != null) { system.newConstraint(cat, assignOperator, fieldKey); if (!doneField.contains(fptr) || !doneReceiver.contains(rptr)) { InstanceKey field = system.getInstanceKey(fptr); for (PointerKey pkey : Iterator2Iterable.make(isLoadOperation ? getPointerKeysForReflectedFieldRead(receiver, field) : getPointerKeysForReflectedFieldWrite(receiver, field))) { AbstractFieldPointerKey key = (AbstractFieldPointerKey) pkey; if (DEBUG_PROPERTIES)
int vn = LI.getExitExposedUses()[i]; if (vn > 0) { IRView ir = getBuilder().getCFAContextInterpreter().getIRView(definingNode); DefUse du = getBuilder().getCFAContextInterpreter().getDU(definingNode); SymbolTable st = ir.getSymbolTable(); PointerKey rhs = getBuilder().getPointerKeyForLocal(definingNode, vn); if (contentsAreInvariant(st, du, vn)) { system.recordImplicitPointsToSet(rhs); final InstanceKey[] objs = getInvariantContents(st, du, definingNode, vn); for (InstanceKey obj : objs) { system.findOrCreateIndexForInstanceKey(obj);
objects.getValue().foreach(optr -> { InstanceKey object = system.getInstanceKey(optr); PointerKey objCatalog = getPointerKeyForObjectCatalog(object); for (InstanceKey fieldsKey : fieldsKeys) { if (isLoadOperation) { for (PointerKey pkey : Iterator2Iterable.make(getPointerKeysForReflectedFieldRead(object, fieldsKey))) { AbstractFieldPointerKey key = (AbstractFieldPointerKey) pkey; if (DEBUG_PROPERTIES) system.newConstraint(objCatalog, fieldsKey); for (PointerKey pkey : Iterator2Iterable.make(getPointerKeysForReflectedFieldWrite(object, fieldsKey))) { AbstractFieldPointerKey key = (AbstractFieldPointerKey) pkey; if (DEBUG_PROPERTIES)
@Override protected void action(PointerKey lexicalKey, int vn) { PointerKey lval = getPointerKeyForLocal(vn); if (lexicalKey instanceof LocalPointerKey) { CGNode lnode = ((LocalPointerKey) lexicalKey).getNode(); int lvn = ((LocalPointerKey) lexicalKey).getValueNumber(); IRView lir = getBuilder().getCFAContextInterpreter().getIRView(lnode); SymbolTable lsymtab = lir.getSymbolTable(); DefUse ldu = getBuilder().getCFAContextInterpreter().getDU(lnode); // DefUse ldu = getAnalysisCache().getDefUse(lir); if (contentsAreInvariant(lsymtab, ldu, lvn)) { InstanceKey[] ik = getInvariantContents(lsymtab, ldu, lnode, lvn); system.recordImplicitPointsToSet(lexicalKey); for (InstanceKey element : ik) { system.findOrCreateIndexForInstanceKey(element); system.newConstraint(lval, element); } return; } } system.newConstraint(lval, assignOperator, lexicalKey); } });
protected void newFieldOperationObjectAndFieldConstant(final boolean isLoadOperation, final ReflectedFieldAction action, final InstanceKey[] objKeys, InstanceKey[] fieldsKeys) { for (InstanceKey objKey : objKeys) { PointerKey objCatalog = getPointerKeyForObjectCatalog(objKey); for (InstanceKey fieldsKey : fieldsKeys) { if (isLoadOperation) { for (PointerKey pkey : Iterator2Iterable.make(getPointerKeysForReflectedFieldRead(objKey, fieldsKey))) { AbstractFieldPointerKey key = (AbstractFieldPointerKey) pkey; if (DEBUG_PROPERTIES) action.dump(key, true, true); action.action(key); } } else { if (objCatalog != null) { system.newConstraint(objCatalog, fieldsKey); } for (PointerKey pkey : Iterator2Iterable.make(getPointerKeysForReflectedFieldWrite(objKey, fieldsKey))) { AbstractFieldPointerKey key = (AbstractFieldPointerKey) pkey; if (DEBUG_PROPERTIES) action.dump(key, true, true); action.action(key); } } } } }