private @CheckForNull XField lookupField(InstructionHandle handle, FieldInstruction fins) { XField field = instructionToFieldMap.get(handle); if (field == null) { field = Hierarchy.findXField(fins, getCPG()); instructionToFieldMap.put(handle, field); } return field; }
@Override public void visitPUTSTATIC(PUTSTATIC obj) { if (doForwardSubstitution()) { XField xfield = Hierarchy.findXField(obj, getCPG()); if (xfield != null) { storeStaticField(xfield, obj, false); return; } } handleNormalInstruction(obj); }
@Override public void visitPUTFIELD(PUTFIELD obj) { if (doForwardSubstitution()) { XField xfield = Hierarchy.findXField(obj, getCPG()); if (xfield != null) { storeInstanceField(xfield, obj, false); return; } } handleNormalInstruction(obj); }
public void modelFieldLoad(FieldInstruction obj) { consumeStack(obj); Type loadType = obj.getFieldType(cpg); XField xfield = Hierarchy.findXField(obj, getCPG()); if (xfield != null) { loadType = getType(xfield); } pushValue(loadType); }
XField xfield = Hierarchy.findXField(obj, getCPG()); if (xfield != null) { if (xfield.isVolatile()) {
/** * Look up the field referenced by given FieldInstruction, returning it as * an {@link XField XField} object. * * @param fins * the FieldInstruction * @param cpg * the ConstantPoolGen used by the class containing the * instruction * @return an XField object representing the field, or null if no such field * could be found */ public static @CheckForNull XField findXField(FieldInstruction fins, @Nonnull ConstantPoolGen cpg) { String className = fins.getClassName(cpg); String fieldName = fins.getFieldName(cpg); String fieldSig = fins.getSignature(cpg); boolean isStatic = (fins.getOpcode() == Const.GETSTATIC || fins.getOpcode() == Const.PUTSTATIC); XField xfield = findXField(className, fieldName, fieldSig, isStatic); short opcode = fins.getOpcode(); if (xfield != null && xfield.isResolved() && xfield.isStatic() == (opcode == Const.GETSTATIC || opcode == Const.PUTSTATIC)) { return xfield; } else { return null; } }
@Override public void visitGETFIELD(GETFIELD obj) { XField xfield = Hierarchy.findXField(obj, getCPG()); if (xfield != null) { if (xfield.isVolatile()) { getFrame().killAllLoads(); } if (doRedundantLoadElimination()) { loadInstanceField(xfield, obj); return; } } handleNormalInstruction(obj); }
/** * Called to indicate that a field load or store was encountered. * * @param cpIndex * the constant pool index of the fieldref * @param isStatic * true if it is a static field access * @param isLoad * true if the access is a load */ private void setField(int cpIndex, boolean isStatic, boolean isLoad) { // We only allow one field access for an accessor method. accessCount++; if (accessCount != 1) { access = null; return; } ConstantPool cp = javaClass.getConstantPool(); ConstantFieldref fieldref = (ConstantFieldref) cp.getConstant(cpIndex); ConstantClass cls = (ConstantClass) cp.getConstant(fieldref.getClassIndex()); String className = cls.getBytes(cp).replace('/', '.'); ConstantNameAndType nameAndType = (ConstantNameAndType) cp.getConstant(fieldref.getNameAndTypeIndex()); String fieldName = nameAndType.getName(cp); String fieldSig = nameAndType.getSignature(cp); XField xfield = Hierarchy.findXField(className, fieldName, fieldSig, isStatic); if (xfield != null && xfield.isStatic() == isStatic && isValidAccessMethod(methodSig, xfield, isLoad)) { access = new InnerClassAccess(methodName, methodSig, xfield, isLoad); } }
XField xfield = Hierarchy.findXField(field.getClassName(), field.getFieldName(), field.getFieldSig(), field.isStatic()); if (!xfield.isResolved()) {
XField xfield = Hierarchy.findXField(fins, cpg); if (xfield == null) { continue;
xfield = Hierarchy.findXField(fins, cpg); if (xfield == null) { continue;
XField field = Hierarchy.findXField((FieldInstruction) ins, cpg); if (field != null) { if (isLoad) {
private @CheckForNull XField lookupField(InstructionHandle handle, FieldInstruction fins) { XField field = instructionToFieldMap.get(handle); if (field == null) { field = Hierarchy.findXField(fins, getCPG()); instructionToFieldMap.put(handle, field); } return field; }
@Override public void visitPUTSTATIC(PUTSTATIC obj) { if (doForwardSubstitution()) { XField xfield = Hierarchy.findXField(obj, getCPG()); if (xfield != null) { storeStaticField(xfield, obj, false); return; } } handleNormalInstruction(obj); }
@Override public void visitPUTFIELD(PUTFIELD obj) { if (doForwardSubstitution()) { XField xfield = Hierarchy.findXField(obj, getCPG()); if (xfield != null) { storeInstanceField(xfield, obj, false); return; } } handleNormalInstruction(obj); }
public void modelFieldLoad(FieldInstruction obj) { consumeStack(obj); Type loadType = obj.getFieldType(cpg); XField xfield = Hierarchy.findXField(obj, getCPG()); if (xfield != null) { loadType = getType(xfield); } pushValue(loadType); }
XField xfield = Hierarchy.findXField(obj, getCPG()); if (xfield != null) { if (xfield.isVolatile()) {
/** * Look up the field referenced by given FieldInstruction, returning it as * an {@link XField XField} object. * * @param fins * the FieldInstruction * @param cpg * the ConstantPoolGen used by the class containing the * instruction * @return an XField object representing the field, or null if no such field * could be found */ public static @CheckForNull XField findXField(FieldInstruction fins, @Nonnull ConstantPoolGen cpg) { String className = fins.getClassName(cpg); String fieldName = fins.getFieldName(cpg); String fieldSig = fins.getSignature(cpg); boolean isStatic = (fins.getOpcode() == Constants.GETSTATIC || fins.getOpcode() == Constants.PUTSTATIC); XField xfield = findXField(className, fieldName, fieldSig, isStatic); short opcode = fins.getOpcode(); if (xfield != null && xfield.isResolved() && xfield.isStatic() == (opcode == Constants.GETSTATIC || opcode == Constants.PUTSTATIC)) { return xfield; } else { return null; } }
@Override public void visitGETFIELD(GETFIELD obj) { XField xfield = Hierarchy.findXField(obj, getCPG()); if (xfield != null) { if (xfield.isVolatile()) { getFrame().killAllLoads(); } if (doRedundantLoadElimination()) { loadInstanceField(xfield, obj); return; } } handleNormalInstruction(obj); }
/** * Called to indicate that a field load or store was encountered. * * @param cpIndex * the constant pool index of the fieldref * @param isStatic * true if it is a static field access * @param isLoad * true if the access is a load */ private void setField(int cpIndex, boolean isStatic, boolean isLoad) { // We only allow one field access for an accessor method. accessCount++; if (accessCount != 1) { access = null; return; } ConstantPool cp = javaClass.getConstantPool(); ConstantFieldref fieldref = (ConstantFieldref) cp.getConstant(cpIndex); ConstantClass cls = (ConstantClass) cp.getConstant(fieldref.getClassIndex()); String className = cls.getBytes(cp).replace('/', '.'); ConstantNameAndType nameAndType = (ConstantNameAndType) cp.getConstant(fieldref.getNameAndTypeIndex()); String fieldName = nameAndType.getName(cp); String fieldSig = nameAndType.getSignature(cp); XField xfield = Hierarchy.findXField(className, fieldName, fieldSig, isStatic); if (xfield != null && xfield.isStatic() == isStatic && isValidAccessMethod(methodSig, xfield, isLoad)) { access = new InnerClassAccess(methodName, methodSig, xfield, isLoad); } }