@Override public void visitGet(SSAGetInstruction instruction) { visitGetInternal(instruction.getDef(), instruction.getRef(), instruction.isStatic(), instruction.getDeclaredField()); }
@Override public String toString(SymbolTable symbolTable) { if (isStatic()) { return getValueString(symbolTable, result) + " = getstatic " + getDeclaredField(); } else { return getValueString(symbolTable, result) + " = getfield " + getDeclaredField() + ' ' + getValueString(symbolTable, getRef()); } }
LOG(DEBUG, "DEBUG", "\tinst: " + instr.toString()); int derefValueNumber = -1; if (instr instanceof SSAGetInstruction && !((SSAGetInstruction) instr).isStatic()) { derefValueNumber = ((SSAGetInstruction) instr).getRef(); } else if (instr instanceof SSAPutInstruction && !((SSAPutInstruction) instr).isStatic()) {
private OrdinalSet<InstanceKey> computeImplicitPointsToSetAtGet(CGNode node, SSAGetInstruction instruction) { return computeImplicitPointsToSetAtGet(node, instruction.getDeclaredField(), instruction.getRef(), instruction.isStatic()); }
String fieldName = g.getDeclaredField().getName().toString(); result.append(g.getDef()); result.append(":="); result.append(g.isStatic() ? "getstatic " : "getfield "); result.append(fieldName); if (!g.isStatic()) { result.append(' '); result.append(g.getUse(0));
@Override public void visitGet(SSAGetInstruction instruction) { visitGetInternal(instruction.getDef(), instruction.isStatic(), instruction.getDeclaredField()); }
@Override public void visitGet(SSAGetInstruction instruction) { result.add(instruction.getDeclaredField()); } };
@Test public void testQualifiedStatic() throws IllegalArgumentException, CancelException, IOException { runTest(singleTestSrc(), rtJar, simpleTestEntryPoint(), Collections.singletonList( cg -> { MethodReference mref = descriptorToMethodRef("Source#QualifiedStatic#main#([Ljava/lang/String;)V", cg.getClassHierarchy()); CGNode node = cg.getNodes(mref).iterator().next(); SSAInstruction s = node.getIR().getInstructions()[4]; Assert.assertTrue("Did not find a getstatic instruction.", s instanceof SSAGetInstruction && ((SSAGetInstruction) s).isStatic()); final FieldReference field = ((SSAGetInstruction) s).getDeclaredField(); Assert.assertEquals("Expected a getstatic for 'value'.", field.getName().toString(), "value"); Assert.assertEquals("Expected a getstatic for 'value'.", field.getDeclaringClass().getName().toString(), "LFooQ"); }), true, null); }
@Override public void visitGet(SSAGetInstruction get) { String propName = get.getDeclaredField().getName().toString(); if(propName.startsWith("global ")) propName = propName.substring("global ".length()); Vertex v = factory.makePropVertex(propName), w = factory.makeVarVertex(func, get.getDef()); flowgraph.addEdge(v, w); handleLexicalDef(get.getDef()); }
@Override public int getNumberOfUses() { return (isStatic()) ? 0 : 1; }
@Override public void visitGet(SSAGetInstruction instruction) { if (!includePrimOps && instruction.getDeclaredFieldType().isPrimitiveType()) { return; } FieldReference fr = instruction.getDeclaredField(); IField f = cha.resolveField(fr); if (f == null) { return; } Set<MemoryAccess> s = MapUtil.findOrCreateSet(readMap, f); MemoryAccess fa = new MemoryAccess(instructionIndex, node); s.add(fa); }
@Override public Iterator<PointerKey> getReadsOfInstanceField(PointerKey pk, IField f) { // TODO: cache this!! if (f == ArrayContents.v()) { return getArrayReads(pk); } pk = convertPointerKeyToHeapModel(pk, mam.getHeapModel()); Collection<MemoryAccess> reads = mam.getFieldReads(pk, f); for (MemoryAccess a : reads) { addSubgraphForNode(a.getNode()); } ArrayList<PointerKey> readInto = new ArrayList<>(); for (MemoryAccess a : reads) { IR ir = a.getNode().getIR(); SSAGetInstruction s = (SSAGetInstruction) ir.getInstructions()[a.getInstructionIndex()]; if (s == null) { // actually dead code continue; } PointerKey r = heapModel.getPointerKeyForLocal(a.getNode(), s.getDef()); // if (Assertions.verifyAssertions) { // Assertions._assert(containsNode(r)); // } readInto.add(r); } return readInto.iterator(); }
@Override public void visitGet(SSAGetInstruction instruction) { TypeReference type = instruction.getDeclaredFieldType(); if (doPrimitives && type.isPrimitiveType()) { PrimitiveType p = language.getPrimitive(type); assert p != null : "no type for " + type; result = new DeclaredTypeOperator(p); } else { IClass klass = cha.lookupClass(type); if (klass == null) { // get from a field of a type that cannot be loaded. // be pessimistic result = new DeclaredTypeOperator(BOTTOM); } else { result = new DeclaredTypeOperator(new ConeType(klass)); } } }
private OrdinalSet<InstanceKey> computeImplicitPointsToSetAtGet(CGNode node, SSAGetInstruction instruction) { return computeImplicitPointsToSetAtGet(node, instruction.getDeclaredField(), instruction.getRef(), instruction.isStatic()); }
@Override public void visitGet(SSAGetInstruction instruction) { visitGetInternal(instruction.getDef(), instruction.isStatic(), instruction.getDeclaredField()); }
@Override public void visitGet(SSAGetInstruction instruction) { result.add(instruction.getDeclaredField()); } };
if (getInstr.isStatic()) { final CGNode cgNode = bb.getNode(); IClass fact = cha.lookupClass(getInstr.getDeclaredField().getDeclaringClass()); int factNum = domain.add(fact); BasicBlockInContext<IExplodedBasicBlock> fakeEntry = getFakeEntry(cgNode);
@Override public void visitGet(SSAGetInstruction get) { String propName = get.getDeclaredField().getName().toString(); if(propName.startsWith("global ")) propName = propName.substring("global ".length()); Vertex v = factory.makePropVertex(propName), w = factory.makeVarVertex(func, get.getDef()); flowgraph.addEdge(v, w); handleLexicalDef(get.getDef()); }