Exemplo n.º 1
0
 public static String getCallClassName(Instruction ins, ConstantPoolGen cp) {
   if (ins instanceof INVOKESTATIC) {
     INVOKESTATIC invst = (INVOKESTATIC) ins;
     return invst.getClassName(cp);
   } else if (ins instanceof INVOKEVIRTUAL) {
     INVOKEVIRTUAL invst = (INVOKEVIRTUAL) ins;
     return invst.getClassName(cp);
   } else if (ins instanceof INVOKEINTERFACE) {
     INVOKEINTERFACE invst = (INVOKEINTERFACE) ins;
     return invst.getClassName(cp);
   } else if (ins instanceof INVOKESPECIAL) {
     INVOKESPECIAL invst = (INVOKESPECIAL) ins;
     return invst.getClassName(cp);
   } else {
     return null;
   }
 }
Exemplo n.º 2
0
 public static Type[] getCallArgTypes(Instruction ins, ConstantPoolGen cp) {
   if (ins instanceof INVOKESTATIC) {
     INVOKESTATIC invst = (INVOKESTATIC) ins;
     return invst.getArgumentTypes(cp);
   } else if (ins instanceof INVOKEVIRTUAL) {
     INVOKEVIRTUAL invst = (INVOKEVIRTUAL) ins;
     return invst.getArgumentTypes(cp);
   } else if (ins instanceof INVOKEINTERFACE) {
     INVOKEINTERFACE invst = (INVOKEINTERFACE) ins;
     return invst.getArgumentTypes(cp);
   } else if (ins instanceof INVOKESPECIAL) {
     INVOKESPECIAL invst = (INVOKESPECIAL) ins;
     return invst.getArgumentTypes(cp);
   } else {
     return null;
   }
 }
Exemplo n.º 3
0
 /** Symbolically executes the corresponding Java Virtual Machine instruction. */
 public void visitINVOKEINTERFACE(INVOKEINTERFACE o) {
   stack().pop(); // objectref
   for (int i = 0; i < o.getArgumentTypes(cpg).length; i++) {
     stack().pop();
   }
   // We are sure the invoked method will xRETURN eventually
   // We simulate xRETURNs functionality here because we
   // don't really "jump into" and simulate the invoked
   // method.
   if (o.getReturnType(cpg) != Type.VOID) {
     Type t = o.getReturnType(cpg);
     if (t.equals(Type.BOOLEAN)
         || t.equals(Type.CHAR)
         || t.equals(Type.BYTE)
         || t.equals(Type.SHORT)) {
       t = Type.INT;
     }
     stack().push(t);
   }
 }
Exemplo n.º 4
0
 public static Instruction getNewInvoke(Instruction ins, int index) {
   if (ins instanceof INVOKESTATIC) {
     INVOKESTATIC invst = (INVOKESTATIC) ins;
     invst.setIndex(index);
     return invst;
   } else if (ins instanceof INVOKEVIRTUAL) {
     INVOKEVIRTUAL invst = (INVOKEVIRTUAL) ins;
     invst.setIndex(index);
     return invst;
   } else if (ins instanceof INVOKEINTERFACE) {
     INVOKEINTERFACE invst = (INVOKEINTERFACE) ins;
     invst.setIndex(index);
     return invst;
   } else if (ins instanceof INVOKESPECIAL) {
     INVOKESPECIAL invst = (INVOKESPECIAL) ins;
     invst.setIndex(index);
     return invst;
   } else {
     return null;
   }
 }