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

PUTSTATIC.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.Constants;
00006 import de.fub.bytecode.generic.ConstantPoolGen;
00007 import de.fub.bytecode.generic.InstructionHandle;
00008 import gov.nasa.arc.ase.util.Debug;
00009 // ifdef RACE
00010 import gov.nasa.arc.ase.jpf.jvm.runtime.*;
00011 //#endif RACE
00012 
00013 public class PUTSTATIC extends AbstractInstruction {
00014   private de.fub.bytecode.generic.PUTSTATIC peer;
00015        
00016 //#endif RACE
00017 // ifdef RACE
00018   private void ANALYZE_execute(ThreadInfo th, StaticArea sa, 
00019                                ConstantPoolGen cpg, long value){
00020     if (Analyze.on()){
00021       String className = peer.getClassName(cpg);
00022       String fieldName = peer.getFieldName(cpg);
00023       ClassRef classref = new ClassRef(StaticMap.getEntry(className));
00024       LockStatus lock_status = sa.getLockStatus(className, fieldName);
00025       Analyze.debugPreAccess(th, className, fieldName, classref, "PUTSTATIC", value, lock_status);
00026       lock_status.checkWrite(th, className, fieldName);
00027       Analyze.debugPostAccess(lock_status);
00028     }
00029   }  
00030   private void DEPEND_execute(ThreadInfo th, ConstantPoolGen cpg){
00031     if (Depend.on()){
00032       String className = peer.getClassName(cpg);
00033       ClassRef classref = new ClassRef(StaticMap.getEntry(className));
00034       Depend.addWrite(th, classref);
00035     }
00036   }  
00037   public InstructionHandle execute(SystemState ss, KernelState ks, ThreadInfo th) {
00038     StaticArea sa = ks.static_area;
00039     ConstantPoolGen cpg = th.getCPG();
00040 
00041     // name of the class to get the field from
00042     String classname = peer.getClassName(cpg);
00043 
00044     // lets check that the class is loaded or load it otherwise
00045     JPFVM jpfvm = JPFVM.getJPFVM();
00046     ClassInfo ci = jpfvm.getClass(classname);
00047     if (!ks.static_area.hasClass(classname)) {
00048       ks.static_area.addClass(ci);
00049       return ci.initialize(ss, ks, th);
00050     }
00051 
00052     int size = peer.consumeStack(cpg);
00053     long value;
00054 
00055 // ifdef MARK_N_SWEEP
00056     if(size == 1)
00057       value = th.peek();
00058     else
00059       value = th.peek2();
00060 
00061     sa.setValue(peer.getClassName(cpg), peer.getFieldName(cpg), value);
00062     th.pop(size);
00063 //#else MARK_N_SWEEP
00064 
00065 
00066 
00067 
00068 
00069 
00070 //#endif MARK_N_SWEEP
00071 
00072 // ifdef RACE
00073     ANALYZE_execute(th, sa, cpg, value);
00074     DEPEND_execute(th, cpg);
00075 //#endif RACE
00076 
00077     return th.getPC().getNext();
00078   }  
00079   public void setPeer(de.fub.bytecode.generic.Instruction i) {
00080     peer = (de.fub.bytecode.generic.PUTSTATIC)i;
00081   }  
00082 }

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