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 de.fub.bytecode.classfile.ConstantPool;
00004 import gov.nasa.arc.ase.jpf.jvm.SystemState;
00005 import gov.nasa.arc.ase.jpf.jvm.KernelState;
00006 import gov.nasa.arc.ase.jpf.jvm.ThreadInfo;
00007 import gov.nasa.arc.ase.jpf.jvm.ClassInfo;
00008 import gov.nasa.arc.ase.jpf.jvm.MethodInfo;
00009 import gov.nasa.arc.ase.util.Debug;
00010 
00011 public class RETURN extends ReturnInstruction {
00012   public Instruction execute(SystemState ss, KernelState ks, ThreadInfo th) {
00013     int objref = -1;
00014     ClassInfo ci = null;
00015     MethodInfo mi = th.getMethod();
00016 
00017     // return from a constructor
00018     if (mi.getName().equals("<init>")) {
00019 //#ifdef DEBUG
00020 
00021 //#endif DEBUG
00022       objref = th.getThis();
00023 
00024       ci = ks.da.get(objref).getClassInfo();
00025 
00026       if(mi.getClassInfo() != ci)
00027     ci = null;
00028     }
00029     
00030     // return from a class constructor
00031     if (mi.getFullName().equals("<clinit>()V")) {
00032 //#ifdef DEBUG
00033 
00034 //#endif DEBUG
00035       // removes a stack frame
00036       th.popFrame();
00037       th.removeArguments(mi);
00038 
00039       // returns to the instruction that caused the class init
00040       return th.getPC();
00041     }
00042 
00043     // release lock if method is synchronized
00044     mi.leave(th);
00045 
00046     // removes a stack frame
00047     th.popFrame();
00048 
00049     // just in case this is the return from the last stack frame
00050     if (th.countStackFrames() == 0)
00051       return null;
00052 
00053     th.removeArguments(mi);
00054 
00055 //#ifdef DEBUG
00056 
00057 
00058 //#endif DEBUG
00059 
00060     return th.getPC().getNext();
00061   }  
00062   public void setPeer(de.fub.bytecode.generic.Instruction i, ConstantPool cp) {
00063   }  
00064 }

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