1 package gov.nasa.jpf.jvm.bytecode; 20 21 import gov.nasa.jpf.JPFException; 22 import gov.nasa.jpf.jvm.ElementInfo; 23 import gov.nasa.jpf.jvm.KernelState; 24 import gov.nasa.jpf.jvm.SystemState; 25 import gov.nasa.jpf.jvm.ThreadInfo; 26 27 import gov.nasa.jpf.jvm.FieldInfo; 28 import gov.nasa.jpf.jvm.DynamicArea; 29 30 31 35 public class GETFIELD extends InstanceFieldInstruction { 36 public Instruction execute (SystemState ss, KernelState ks, ThreadInfo ti) { 37 int objRef = lastThis = ti.pop(); 38 if (objRef == -1) { 39 return ti.createAndThrowException("java.lang.NullPointerException", 40 "referencing field '" + fname + "' on null object"); 41 } 42 43 FieldInfo fi = getFieldInfo(); 44 ElementInfo ei = DynamicArea.getHeap().get(objRef); 45 46 switch (fi.getStorageSize()) { 49 case 1: 50 ti.push( ei.getIntField(fi), fi.isReference()); 51 break; 52 case 2: 53 ti.longPush( ei.getLongField(fi)); 54 break; 55 default: 56 throw new JPFException("invalid field type"); 57 } 58 59 return getNext(ti); 60 } 61 62 public int getByteCode () { 63 return 0xB4; 64 } 65 66 public boolean isSchedulingRelevant (SystemState ss, KernelState ks, ThreadInfo ti) { 67 70 if (ti.usePorFieldBoundaries()) { 71 int objRef = ti.peek(); 72 return isSchedulingRelevant(ks, ti, objRef); 73 } 74 75 return false; 76 } 77 78 } 79 | Popular Tags |