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 33 public class INVOKESPECIAL extends InvokeInstruction { 34 public INVOKESPECIAL () {} 35 36 public INVOKESPECIAL (MethodInfo mi, String cname, String mname, String signature, 37 int offset, int position) { 38 super(mi, cname, mname, signature, offset, position); 39 } 40 41 public int getByteCode () { 42 return 0xB7; 43 } 44 45 public boolean isDeterministic (SystemState ss, KernelState ks, ThreadInfo th) { 46 MethodInfo mi = getInvokedMethod(th, ks); 47 if (mi == null) { 48 return true; 49 } 50 51 return mi.isDeterministic(th); 52 } 53 54 public boolean isExecutable (SystemState ss, KernelState ks, ThreadInfo th) { 55 MethodInfo mi = getInvokedMethod(th, ks); 56 if (mi == null) { 57 return true; 58 } 59 60 return mi.isExecutable(th); 61 } 62 63 public Instruction execute (SystemState ss, KernelState ks, ThreadInfo th) { 64 MethodInfo mi = getInvokedMethod(th, ks); 65 if (mi == null) { 66 return th.createAndThrowException("java.lang.NoSuchMethodException", 67 "calling " + cname + "." + mname); 68 } 69 70 return mi.execute(th, false); 71 } 72 73 int getCalleeThis (ThreadInfo ti) { 74 return ti.getCalleeThis( getArgSize()); 75 } 76 77 public boolean isSchedulingRelevant (SystemState ss, KernelState ks, ThreadInfo ti) { 78 MethodInfo mi = getInvokedMethod( ti, ks); 79 int objRef = getCalleeThis(ti); 80 81 return mi.isSchedulingRelevant(ti,ks.da.get(objRef)); 82 } 83 84 87 MethodInfo getInvokedMethod (ThreadInfo th, KernelState ks) { 88 89 92 if (invokedMethod == null) { 93 ClassInfo ci = ClassInfo.getClassInfo(cname); 94 invokedMethod = ci.getMethod(mname, true); 95 } 96 97 return invokedMethod; } 99 } 100 | Popular Tags |