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 import org.apache.bcel.classfile.ConstantPool; 28 29 30 34 public class RETURN extends ReturnInstruction { 35 public RETURN () {} 36 37 public RETURN (MethodInfo mi, int offset, int position) { 38 this.mi = mi; 39 this.offset = offset; 40 this.position = position; 41 } 42 43 public void setPeer (org.apache.bcel.generic.Instruction i, ConstantPool cp) { 44 } 45 46 public boolean isExecutable (SystemState ss, KernelState ks, ThreadInfo th) { 47 boolean isExec = true; 48 MethodInfo mi = th.getMethod(); 49 50 if (mi.isThreadEntry(th)){ 51 int objref = th.getObjectReference(); 52 isExec = ks.da.get(objref).canLock(th); 53 } 54 55 return isExec; 56 } 57 58 public boolean isSchedulingRelevant (SystemState ss, KernelState ks, ThreadInfo ti) { 59 MethodInfo mi = ti.getMethod(); 61 if (mi.isSynchronized()) { 62 return ti.hasOtherRunnables(); 63 } 64 65 return false; 66 } 67 68 int storeReturnValue (ThreadInfo th) { 69 return 0; } 71 72 void pushReturnValue (ThreadInfo th) { 73 } 75 76 public Instruction execute (SystemState ss, KernelState ks, ThreadInfo th) { 77 int objref = -1; 78 ClassInfo ci = null; 79 MethodInfo mi = th.getMethod(); 80 81 if (mi.isCtor()) { 83 objref = th.getThis(); 84 85 ci = ks.da.get(objref).getClassInfo(); 86 87 if (mi.getClassInfo() != ci) { 88 ci = null; 89 } 90 } 91 92 return cleanUpAndAdvance(th); 94 } 95 96 public String toString() { 97 return "return"; 98 } 99 100 101 public int getByteCode () { 102 return 0xB1; 103 } 104 } 105 | Popular Tags |