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

GETSTATIC.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.ConstantPoolGen;
00006 import de.fub.bytecode.generic.InstructionHandle;
00007 import gov.nasa.arc.ase.util.Debug;
00008 // ifdef RACE
00009 import gov.nasa.arc.ase.jpf.jvm.runtime.*;
00010 //#endif RACE
00011 
00012 public class GETSTATIC extends AbstractInstruction {
00013   private de.fub.bytecode.generic.GETSTATIC peer;
00014        
00015 //#endif RACE
00016 // ifdef RACE
00017   private void ANALYZE_execute(ThreadInfo th, StaticArea sa, ConstantPoolGen cpg){
00018     if (Analyze.on()){
00019       String classname = peer.getClassName(cpg);
00020       String fieldName = peer.getFieldName(cpg);
00021       ClassRef classref = new ClassRef(StaticMap.getEntry(classname));
00022       long value = sa.getValue(classname, fieldName);
00023       LockStatus lock_status = 
00024         sa.getLockStatus(classname, fieldName);
00025       Analyze.debugPreAccess(th, classname, fieldName, 
00026       classref, "GETSTATIC", value, lock_status);
00027       lock_status.checkRead(th, classname, fieldName);
00028       Analyze.debugPostAccess(lock_status);
00029     }
00030   }  
00031   private void DEPEND_execute(ThreadInfo th, ConstantPoolGen cpg){
00032     if (Depend.on()){
00033       String classname = peer.getClassName(cpg);
00034       ClassRef classref = new ClassRef(StaticMap.getEntry(classname));
00035       Depend.addRead(th, classref);
00036     }
00037   }  
00038   public InstructionHandle execute(SystemState ss, KernelState ks, ThreadInfo th) {
00039     ConstantPoolGen cpg = th.getCPG();
00040     String classname = peer.getClassName(cpg);
00041     StaticArea sa = ks.static_area;
00042 
00043     // we load the class if it was not loaded before
00044     JPFVM jpfvm = JPFVM.getJPFVM();
00045     ClassInfo ci = jpfvm.getClass(classname);
00046     if (!ks.static_area.hasClass(classname)) {
00047       ks.static_area.addClass(ci);
00048       return ci.initialize(ss, ks, th);
00049     }
00050 
00051     long value = sa.getValue(peer.getClassName(cpg), peer.getFieldName(cpg));
00052     if(peer.produceStack(cpg) == 1)
00053       th.push((int)value);
00054     else
00055       th.push2(value);
00056 
00057 // ifdef RACE
00058     ANALYZE_execute(th, sa, cpg);
00059     DEPEND_execute(th, cpg);
00060 //#endif RACE
00061 
00062     return th.getPC().getNext();
00063   }  
00064   public void setPeer(de.fub.bytecode.generic.Instruction i) {
00065     peer = (de.fub.bytecode.generic.GETSTATIC)i;
00066   }  
00067 }

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