1 package gov.nasa.jpf.jvm.bytecode; 20 21 import gov.nasa.jpf.jvm.KernelState; 22 import gov.nasa.jpf.jvm.SystemState; 23 import gov.nasa.jpf.jvm.ThreadInfo; 24 25 import org.apache.bcel.classfile.ConstantPool; 26 import gov.nasa.jpf.jvm.ElementInfo; 27 28 29 33 public class MONITORENTER extends Instruction { 34 public boolean isExecutable (SystemState ss, KernelState ks, ThreadInfo th) { 35 int objref = th.peek(); 36 boolean isExec = ks.da.get(objref).canLock(th); 37 38 return isExec; 39 } 40 41 public void setPeer (org.apache.bcel.generic.Instruction i, ConstantPool cp) { 42 } 43 44 public Instruction execute (SystemState ss, KernelState ks, ThreadInfo th) { 45 int objref = th.pop(); 46 47 ks.da.get(objref).lock(th); 48 49 return getNext(th); 50 } 51 52 public boolean isSchedulingRelevant (SystemState ss, KernelState ks, ThreadInfo ti) { 53 int objref = ti.peek(); 54 ElementInfo ei = ks.da.get(objref); 55 56 if (mi.isBodySchedulingRelevant(ti,ei) && (ei.getLockCount() == 0)) { 57 return ti.hasOtherRunnables(); 59 } else { 60 return false; 62 } 63 } 64 65 public int getByteCode () { 66 return 0xC2; 67 } 68 } 69 | Popular Tags |