com.ibm.wala.shrikeBT.analysis
Class Verifier

java.lang.Object
  extended by com.ibm.wala.shrikeBT.analysis.Analyzer
      extended by com.ibm.wala.shrikeBT.analysis.Verifier

public final class Verifier
extends Analyzer

This class typechecks intermediate code. It's very easy to use:

 
      MethodData md = ...;
      try {
          (new Verifier(md)).verify();
      } catch (Verifier.FailureException ex) {
          System.out.println("Verification failed at instruction "
              + ex.getOffset() + ": " + ex.getReason());
      }
  
 
For full verification you need to provide class hierarchy information using setClassHierarchy. Without this information, we can't compute the exact types of variables at control flow merge points. If you don't provide a hierarchy, or the hierarchy you provide is partial, then the Verifier will be optimistic. This method can also be used to gather type information for every stack and local variable at every program point. Just call computeTypes() instead of verify() and then retrieve the results with getLocalTypes() and getStackTypes().


Nested Class Summary
 
Nested classes/interfaces inherited from class com.ibm.wala.shrikeBT.analysis.Analyzer
Analyzer.FailureException, Analyzer.PathElement, Analyzer.TypeVisitor
 
Field Summary
 
Fields inherited from class com.ibm.wala.shrikeBT.analysis.Analyzer
backEdges, basicBlockStarts, classType, handlers, hierarchy, instructions, isStatic, locals, maxLocals, maxStack, noEdges, noStrings, signature, stacks, stackSizes
 
Constructor Summary
Verifier(boolean isStatic, java.lang.String classType, java.lang.String signature, Instruction[] instructions, ExceptionHandler[][] handlers)
          Initialize a verifier.
Verifier(MethodData info)
          Initialize a verifier.
 
Method Summary
 void computeTypes()
           
 void verify()
          Try to verify the method.
 void verifyCollectAll()
           
 
Methods inherited from class com.ibm.wala.shrikeBT.analysis.Analyzer
computeTypes, createAnalyzer, findCommonSupertype, getBackEdges, getBasicBlockStarts, getInstructions, getLocalTypes, getReachableFrom, getReachableFrom, getReachableFromUpdate, getReachingTo, getReachingTo, getReachingToUpdate, getStackSizes, getStackTypes, initTypeInfo, isSubtypeOf, setClassHierarchy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Verifier

public Verifier(boolean isStatic,
                java.lang.String classType,
                java.lang.String signature,
                Instruction[] instructions,
                ExceptionHandler[][] handlers)
Initialize a verifier.


Verifier

public Verifier(MethodData info)
         throws java.lang.NullPointerException
Initialize a verifier.

Throws:
java.lang.NullPointerException - if info is null
Method Detail

verify

public void verify()
            throws Analyzer.FailureException
Try to verify the method. If verification is unsuccessful, we throw an exception.

Throws:
FailureException - the method contains invalid bytecode
Analyzer.FailureException

verifyCollectAll

public void verifyCollectAll()
                      throws Analyzer.FailureException
Throws:
Analyzer.FailureException

computeTypes

public void computeTypes()
                  throws Analyzer.FailureException
Throws:
Analyzer.FailureException