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 de.fub.bytecode.generic.InstructionHandle;
00004 import gov.nasa.arc.ase.jpf.jvm.reflection.Reflection;
00005 import gov.nasa.arc.ase.jpf.TransitionResult;
00006 
00007 public class VerifyReflection extends Reflection {
00008   public InstructionHandle executeStaticMethod(MethodInfo mi, boolean atomic) {
00009     String name = mi.getFullName();
00010 
00011     if(name.equals("gov.nasa.arc.ase.jpf.jvm.Verify.atLabel(Ljava/lang/String;)V")) {
00012       String label = da.convert2String(th.getLocalVariable(0));
00013 
00014       Labels.set(label, th.getCurrentMethod().getFullName(), th.getPC().getNext().getPosition());
00015       
00016       return exit();
00017     }
00018 
00019     if(name.equals("gov.nasa.arc.ase.jpf.jvm.Verify.atLabel(I)V")) {
00020       int label = th.getLocalVariable(0);
00021 
00022       Labels.set(new Integer(label).toString(), th.getCurrentMethod().getFullName(), th.getPC().getNext().getPosition());
00023       
00024       return exit();
00025     }
00026 
00027     if(name.equals("gov.nasa.arc.ase.jpf.jvm.Verify.random(I)I"))
00028       return exit(th.doRandom(th.getLocalVariable(0)+1, ss.getScheduler()));
00029 
00030     if(name.equals("gov.nasa.arc.ase.jpf.jvm.Verify.randomBool()Z"))
00031       return exit(th.doRandom(2, ss.getScheduler()));
00032 
00033     if(name.equals("gov.nasa.arc.ase.jpf.jvm.Verify.beginAtomic()V")) {
00034       TransitionResult.setAtomic();
00035       return exit();
00036     }
00037 
00038     if(name.equals("gov.nasa.arc.ase.jpf.jvm.Verify.endAtomic()V")) {
00039       TransitionResult.clearAtomic();
00040       return exit();
00041     }
00042 
00043     if(name.equals("gov.nasa.arc.ase.jpf.jvm.Verify.atomicMethod()V")) {
00044       th.executeAtomicMethod(-1);
00045       return exit();
00046     }
00047 
00048     if(name.equals("gov.nasa.arc.ase.jpf.jvm.Verify.assert(Z)V")) {
00049       TransitionResult.assertionViolation(!Types.intToBoolean(th.getLocalVariable(0)));
00050       return exit();
00051     }
00052 
00053     return super.executeStaticMethod(mi, atomic);
00054   }  
00055   public boolean isStaticMethodDeterministic(MethodInfo mi) {
00056     String name = mi.getFullName();
00057 
00058     if(name.equals("gov.nasa.arc.ase.jpf.jvm.Verify.random(I)I"))
00059       return false;
00060 
00061     if(name.equals("gov.nasa.arc.ase.jpf.jvm.Verify.randomBool()Z"))
00062       return false;
00063 
00064     return super.isStaticMethodDeterministic(mi);
00065   }  
00066 }

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