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

VerifyReflection.java

00001 package gov.nasa.arc.ase.jpf.jvm;
00002 
00003 import gov.nasa.arc.ase.jpf.jvm.reflection.Reflection;
00004 import gov.nasa.arc.ase.jpf.TransitionResult;
00005 import gov.nasa.arc.ase.jpf.jvm.bytecode.Instruction;
00006 
00007 public class VerifyReflection extends Reflection {
00008   public Instruction executeStaticMethod(MethodInfo mi) {
00009     String name = mi.getFullName();
00010 
00011     if(name.equals("atLabel(Ljava/lang/String;)V")) {
00012 //#ifdef BUCHI
00013       String label = getStringArgument(0);
00014 
00015       Labels.set(label, th.getPC(-1).getNext());
00016 //#endif BUCHI
00017       
00018       return exit();
00019     }
00020 
00021     if(name.equals("atLabel(I)V")) {
00022 //#ifdef BUCHI
00023       int label = getIntArgument(0);
00024 
00025       Labels.set(Integer.toString(label), th.getPC(-1).getNext());
00026 //#endif BUCHI
00027 
00028       return exit();
00029     }
00030 
00031     if(name.equals("random(I)I"))
00032       return exit(ss.random(getIntArgument(0)+1));
00033 
00034     if(name.equals("randomBool()Z"))
00035       return exit(ss.random(2) != 0);
00036 
00037     if(name.equals("beginAtomic()V")) {
00038       th.list.ks.setAtomic();
00039       return exit();
00040     }
00041 
00042     if(name.equals("endAtomic()V")) {
00043       th.list.ks.clearAtomic();
00044       return exit();
00045     }
00046 
00047     if(name.equals("beginSoftAtomic()V")) {
00048       th.enterSoftAtomic();
00049       return exit();
00050     }
00051 
00052     if(name.equals("endSoftAtomic()V")) {
00053       th.leaveSoftAtomic();
00054       return exit();
00055     }
00056 
00057     if(name.equals("dumpState()V")) {
00058       System.out.println("dumping the state");
00059       ss.ks.log();
00060       return exit();
00061     }
00062 
00063     if(name.equals("assert(Z)V")) {
00064       th.list.ks.ss.violatedAssertion |= !Types.intToBoolean(th.getLocalVariable(0));
00065 
00066       return exit();
00067     }
00068 
00069     return super.executeStaticMethod(mi);
00070   }  
00071   public boolean isStaticMethodDeterministic(MethodInfo mi) {
00072     String name = mi.getFullName();
00073 
00074     if(name.equals("random(I)I"))
00075       return false;
00076 
00077     if(name.equals("randomBool()Z"))
00078       return false;
00079 
00080     return super.isStaticMethodDeterministic(mi);
00081   }  
00082 }

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