use of edu.columbia.cs.psl.phosphor.struct.MethodInformation in project phosphor by gmu-swe.
the class CallGraphBuildingClassVisitor method visitMethod.
@Override
public MethodVisitor visitMethod(int access, final String name, final String desc, String signature, String[] exceptions) {
final MethodInformation thisMIN = graph.getMethodNode(className, name, desc);
Instrumenter.classes.get(className).methods.add(new MethodNode(access, name, desc, signature, exceptions));
thisMIN.setVisited(true);
if ((access & Opcodes.ACC_NATIVE) != 0)
thisMIN.setPure(false);
return new MethodVisitor(Opcodes.ASM5, super.visitMethod(access, name, desc, signature, exceptions)) {
@Override
public void visitMethodInsn(int opcode, String _owner, String _name, String _desc, boolean intfc) {
super.visitMethodInsn(opcode, _owner, _name, _desc, intfc);
if (!(opcode == Opcodes.INVOKESPECIAL && _owner.equals("java/lang/Object")))
graph.addEdge(className, name, desc, _owner, _name, _desc);
if (_owner.equals("java/lang/reflect/Method") && name.equals("invoke"))
thisMIN.setCallsTaintedMethods(true);
if (opcode == Opcodes.INVOKESTATIC)
graph.addEdge(className, name, desc, _owner, "<clinit>", "()V");
}
@Override
public void visitFieldInsn(int opcode, String owner, String name, String desc) {
super.visitFieldInsn(opcode, owner, name, desc);
thisMIN.setPure(false);
if (opcode == Opcodes.GETSTATIC || opcode == Opcodes.PUTSTATIC)
graph.addEdge(className, name, desc, owner, "<clinit>", "()V");
}
@Override
public void visitTypeInsn(int opcode, String type) {
super.visitTypeInsn(opcode, type);
if (opcode == Opcodes.NEW)
graph.addEdge(className, name, desc, type, "<clinit>", "()V");
}
};
}
Aggregations