private static void processInstruction(DalvInsn instruction, Dependencies.MethodDeps methodDeps)
{
String opname= instruction.getOpcode().getName();
if (opname.equals("instance-of") || opname.equals("const-class"))
{
CstInsn isaInsn= (CstInsn) instruction;
// TODO: Do we need this?
// dependencies.add(isaInsn.getConstant().toHuman());
}
// TODO: Do we need to add these?
// RegisterSpecList registers = instruction.getRegisters();
// for (int i = 0; i < registers.size(); ++i) {
// RegisterSpec register = registers.get(i);
// String descriptor = register.getType().getDescriptor();
// String registerType = register.getType().toHuman();
// // Sometimes a register type name starts with some info about the
// // register. We need to cut this out.
// if (descriptor.startsWith("N")) {
// registerType = registerType.substring(registerType.indexOf('L') + 1);
// }
// methodDeps.addDependency(registerType, "TODO");
// }
if (instruction instanceof CstInsn)
{
CstInsn cstInsn= (CstInsn) instruction;
if (isInvokeInstruction(cstInsn))
{
// Adds the class that a method references
CstBaseMethodRef methodRef= (CstBaseMethodRef) cstInsn.getConstant();
methodDeps.addDependency(methodRef.getDefiningClass().toHuman(), methodRef.getNat().getName().toHuman() + ":" + methodRef.getPrototype().toString());
}
else
{
Constant constant= cstInsn.getConstant();
if (constant instanceof CstMemberRef)
{
CstMemberRef memberRef= (CstMemberRef) constant;
methodDeps.addDependency(memberRef.getDefiningClass().getClassType().toHuman(), memberRef.getNat().getName().toHuman());