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
00009 import gov.nasa.arc.ase.jpf.jvm.runtime.*;
00010
00011
00012 public class GETFIELD extends AbstractInstruction {
00013 private de.fub.bytecode.generic.GETFIELD peer;
00014
00015
00016
00017 private void ANALYZE_execute(ThreadInfo th, int objref,
00018 DynamicArea da, ConstantPoolGen cpg){
00019 if (Analyze.on()){
00020 String className = peer.getClassName(cpg);
00021 String fieldName = peer.getFieldName(cpg);
00022 LockStatus lock_status = da.getLockStatus(objref, fieldName);
00023 Analyze.debugPreAccess(th, className, fieldName, new ObjRef(objref),
00024 "GETFIELD", da.getValue(objref, fieldName), lock_status);
00025 lock_status.checkRead(th, className, fieldName);
00026 Analyze.debugPostAccess(lock_status);
00027 }
00028 }
00029 private void DEPEND_execute(ThreadInfo th, int objref){
00030 if (Depend.on()){
00031 Depend.addRead(th, new ObjRef(objref));
00032 }
00033 }
00034 public InstructionHandle execute(SystemState ss, KernelState ks, ThreadInfo th) {
00035 ConstantPoolGen cpg = th.getCPG();
00036
00037 int objref;
00038 long value;
00039
00040
00041 objref = th.peek();
00042 value = ks.dynamic_area.getValue(objref, peer.getFieldName(cpg));
00043 th.pop();
00044
00045 if(peer.produceStack(cpg) == 1)
00046 th.push((int)value);
00047 else
00048 th.push2(value);
00049
00050 if(ks.dynamic_area.isFieldRef(objref, peer.getFieldName(cpg)))
00051 th.setOperandRef();
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 ANALYZE_execute(th, objref, ks.dynamic_area, cpg);
00064 DEPEND_execute(th, objref);
00065
00066
00067 return th.getPC().getNext();
00068 }
00069 public void setPeer(de.fub.bytecode.generic.Instruction i) {
00070 peer = (de.fub.bytecode.generic.GETFIELD)i;
00071 }
00072 }