1 package gov.nasa.jpf.jvm.bytecode; 20 21 import gov.nasa.jpf.jvm.ClassInfo; 22 import gov.nasa.jpf.jvm.KernelState; 23 import gov.nasa.jpf.jvm.MethodInfo; 24 import gov.nasa.jpf.jvm.SystemState; 25 import gov.nasa.jpf.jvm.ThreadInfo; 26 27 28 32 public class INVOKESTATIC extends InvokeInstruction { 33 ClassInfo ci; 34 35 public INVOKESTATIC () {} 36 37 public INVOKESTATIC (MethodInfo mi, String cname, String mname, String signature, 38 int offset, int position) { 39 super(mi, cname, mname, signature, offset, position); 40 } 41 42 ClassInfo getClassInfo () { 43 if (ci == null) { 44 ci = ClassInfo.getClassInfo(cname); 45 } 46 return ci; 47 } 48 49 public int getByteCode () { 50 return 0xB8; 51 } 52 53 public boolean isDeterministic (SystemState ss, KernelState ks, ThreadInfo ti) { 54 MethodInfo mi = getInvokedMethod(); 55 if (mi == null) { 56 return true; } 58 59 return mi.isDeterministic(ti); 60 } 61 62 public boolean isExecutable (SystemState ss, KernelState ks, ThreadInfo ti) { 63 MethodInfo mi = getInvokedMethod(); 64 if (mi == null) { 65 return true; } 67 68 return mi.isExecutable(ti); 69 } 70 71 public boolean examineAbstraction (SystemState ss, KernelState ks, 72 ThreadInfo ti) { 73 MethodInfo mi = getInvokedMethod(); 74 75 if (mi == null) { 76 return true; 77 } 78 79 return !ci.isStaticMethodAbstractionDeterministic(ti, mi); 80 } 81 82 public Instruction execute (SystemState ss, KernelState ks, ThreadInfo ti) { 83 if (mname.charAt(0) != '<') { 87 ks.sa.get(cname); 88 } 89 90 MethodInfo mi = getInvokedMethod(); 91 if (mi == null) { 92 return ti.createAndThrowException("java.lang.NoSuchMethodException", 93 "static " + ci.getName() + "." + mname); 94 } 95 96 return mi.execute(ti, false); 97 } 98 99 public boolean isSchedulingRelevant (SystemState ss, KernelState ks, ThreadInfo ti) { 100 ClassInfo clsInfo = getClassInfo(); 101 MethodInfo mi = getInvokedMethod(); 102 int objRef = clsInfo.getClassObjectRef(); 103 104 return mi.isSchedulingRelevant(ti, ks.da.get(objRef)); 105 } 106 107 public MethodInfo getInvokedMethod () { 108 ClassInfo clsInfo = getClassInfo(); 109 if (invokedMethod == null) { 110 invokedMethod = clsInfo.getMethod(mname, true); 111 } 112 113 return invokedMethod; 114 } 115 116 public String toString() { 117 if (asString == null) { 118 asString = ("invokeStatic " + cname + "." + mname); 119 } 120 121 return asString; 122 } 123 } 124 125 | Popular Tags |