Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

RETURN.java

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 RETURN extends AbstractInstruction {
00009   private de.fub.bytecode.generic.RETURN peer;
00010 
00011   public InstructionHandle execute(SystemState ss, KernelState ks, ThreadInfo th) {
00012     MethodInfo mi = th.getCurrentMethod();
00013 
00014 // ifdef INITIALIZE
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 //#endif INITIALIZE
00034     
00035     // from a class construction you don't have to update the program counter
00036     if (mi.getMethodName().equals("<clinit>")) {
00037       // removes a stack frame
00038       th.popFrame();
00039       th.removeArguments(mi);
00040 
00041       // returns to the instruction that caused the class init
00042       return th.getPC();
00043     }
00044 
00045     // release lock if method is synchronized
00046     if (mi.getMethodGen().isSynchronized()) {
00047       if (mi.getMethodGen().isStatic()) {
00048     ks.static_area.monitorUnlock(mi.getClassInfo().getClassName(), th);
00049       } else {
00050     ks.dynamic_area.monitorUnlock(th.getThis(), th);
00051       }
00052     }
00053 
00054     // removes a stack frame
00055     th.popFrame();
00056 
00057     // just in case this is the return from the last stack frame
00058     if (th.getPC() == null)
00059       return null;
00060 
00061     th.removeArguments(mi);
00062     return th.getPC().getNext();
00063   }  
00064   public void setPeer(de.fub.bytecode.generic.Instruction i) {
00065     peer = (de.fub.bytecode.generic.RETURN)i;
00066   }  
00067 }

Generated at Thu Feb 7 06:53:56 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001