1 package gov.nasa.jpf.jvm.bytecode; 20 21 import gov.nasa.jpf.jvm.ClassInfo; 22 import gov.nasa.jpf.jvm.JVM; 23 import gov.nasa.jpf.jvm.MethodInfo; 24 import gov.nasa.jpf.jvm.Types; 25 26 import org.apache.bcel.classfile.ConstantPool; 27 import org.apache.bcel.generic.ConstantPoolGen; 28 import org.apache.bcel.generic.InstructionHandle; 29 30 31 34 public abstract class InvokeInstruction extends Instruction { 35 40 public String cname; 41 public String mname; 42 public String signature; 43 44 int argSize = -1; 45 46 47 int lastObj = Integer.MIN_VALUE; 48 49 53 MethodInfo invokedMethod; 54 55 protected InvokeInstruction () {} 56 57 public void setPeer (org.apache.bcel.generic.Instruction i, ConstantPool cp) { 58 org.apache.bcel.generic.InvokeInstruction ii; 59 ConstantPoolGen cpg; 60 61 cpg = ClassInfo.getConstantPoolGen(cp); 62 ii = (org.apache.bcel.generic.InvokeInstruction) i; 63 64 cname = ii.getClassName(cpg); 65 signature = ii.getSignature(cpg); 66 mname = MethodInfo.getUniqueName(ii.getMethodName(cpg), signature); 67 } 68 69 75 public MethodInfo getInvokedMethod () { 76 return invokedMethod; 77 } 78 79 protected InvokeInstruction (MethodInfo mi, String cname, String mname, String signature, 80 int offset, int position) { 81 this.mi = mi; 82 this.cname = cname; 83 this.mname = mname + signature; 84 this.signature = signature; 85 this.offset = offset; 86 this.position = position; 87 } 88 89 protected void init (InstructionHandle h, int o, MethodInfo m, 90 ConstantPool cp) { 91 super.init(h, o, m, cp); 92 isObservable |= JVM.observableInvokes.contains(cname + "." + mname); 93 } 94 95 protected int getArgSize () { 96 if (argSize < 0) { 97 argSize = Types.getArgumentsSize(signature) + 1; } 99 100 return argSize; 101 } 102 103 } 104 | Popular Tags |