00001 package gov.nasa.arc.ase.jpf.jvm.bytecode;
00002
00003 import gov.nasa.arc.ase.jpf.*;
00004 import gov.nasa.arc.ase.jpf.jvm.*;
00005 import de.fub.bytecode.generic.InstructionHandle;
00006 import gov.nasa.arc.ase.util.Debug;
00007
00008 public class MONITORENTER extends AbstractInstruction {
00009 private de.fub.bytecode.generic.MONITORENTER peer;
00010
00011 public InstructionHandle execute(SystemState ss, KernelState ks, ThreadInfo th) {
00012
00013 int objref = th.peek();
00014
00015 if (ks.dynamic_area.monitorLock(objref, th)) {
00016
00017 th.pop();
00018
00019 return th.getPC().getNext();
00020 } else {
00021 throw new InternalErrorException("can't get into the monitor");
00022 }
00023 }
00024 public boolean isExecutable(SystemState ss, KernelState ks, ThreadInfo th) {
00025
00026 int objref = th.peek();
00027
00028 return ks.dynamic_area.monitorCheckLock(objref, th);
00029 }
00030 public void setPeer(de.fub.bytecode.generic.Instruction i) {
00031 peer = (de.fub.bytecode.generic.MONITORENTER)i;
00032 }
00033 }