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

PUTFIELD.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 PUTFIELD extends AbstractInstruction {
00014   private de.fub.bytecode.generic.PUTFIELD peer;
00015 
00016 //#endif RACE
00017 // ifdef RACE
00018   private void ANALYZE_execute(ThreadInfo th, int objref,
00019       DynamicArea da, ConstantPoolGen cpg, long value){
00020     if (Analyze.on()){
00021       String className = peer.getClassName(cpg);
00022       String fieldName = peer.getFieldName(cpg);
00023       LockStatus lock_status = da.getLockStatus(objref, fieldName);
00024       Analyze.debugPreAccess(th, className, fieldName, new ObjRef(objref),
00025       "PUTFIELD", value, lock_status);      
00026       lock_status.checkWrite(th, className, fieldName);
00027       Analyze.debugPostAccess(lock_status);
00028     }
00029   }  
00030   private void DEPEND_execute(ThreadInfo th, int objref){
00031     if (Depend.on()){
00032       Depend.addWrite(th, new ObjRef(objref));
00033     }
00034   }  
00035   public InstructionHandle execute(SystemState ss, KernelState ks, ThreadInfo th) {
00036     DynamicArea da = ks.dynamic_area;
00037 
00038     ConstantPoolGen cpg = th.getCPG();
00039 
00040     // size of the local stack
00041     int size = peer.consumeStack(cpg);
00042     
00043     // value to be put into the field
00044     long value;
00045     int objref;
00046 
00047 // ifdef MARK_N_SWEEP
00048     if (size == 3) { // object reference + value
00049       // dword value
00050       value = th.peek2();
00051       objref = th.peek(2);
00052     } else {
00053       // word value
00054       value = th.peek();
00055       objref = th.peek(1);
00056     }
00057 
00058     da.setValue(objref, peer.getFieldName(cpg), value);
00059 
00060     th.pop(size);
00061 //#else MARK_N_SWEEP
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 //#endif MARK_N_SWEEP
00074 // ifdef RACE
00075     ANALYZE_execute(th, objref, da, cpg, value);
00076     DEPEND_execute(th, objref);
00077 //#endif RACE
00078 
00079     return th.getPC().getNext();
00080   }  
00081   public void setPeer(de.fub.bytecode.generic.Instruction i) {
00082     peer = (de.fub.bytecode.generic.PUTFIELD)i;
00083   }  
00084 }

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