Class Verifier
java.lang.Object
com.ibm.wala.shrike.shrikeBT.analysis.Analyzer
com.ibm.wala.shrike.shrikeBT.analysis.Verifier
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 Analyzer
Analyzer.FailureException, Analyzer.PathElement, Analyzer.TypeVisitorModifier and TypeClassDescriptionstatic final classThis exception is thrown by verify() when it fails.static final classstatic class -
Field Summary
Fields inherited from class Analyzer
backEdges, basicBlockStarts, classType, handlers, hierarchy, instructions, instToBC, isConstructor, isStatic, locals, maxLocals, maxStack, noEdges, noStrings, signature, stacks, stackSizes, thisType, topType, varTypesModifier and TypeFieldDescriptionprotected int[][]protected BitSetprotected final Stringprotected final ExceptionHandler[][]protected ClassHierarchyProviderprotected final IInstruction[]protected int[]protected final booleanprotected final booleanprotected String[][]protected intprotected intprotected static final int[]protected static final String[]protected final Stringprotected String[][]protected int[]static final Stringstatic final Stringprotected String[][] -
Constructor Summary
ConstructorsConstructorDescriptionVerifier(boolean isConstructor, boolean isStatic, String classType, String signature, IInstruction[] instructions, ExceptionHandler[][] handlers, int[] instToBC, String[][] vars) Initialize a verifier.Verifier(MethodData info) Initialize a verifier.Verifier(MethodData info, int[] instToBC, String[][] vars) -
Method Summary
Methods inherited from class Analyzer
computeTypes, createAnalyzer, findCommonSupertype, getBackEdges, getBasicBlockStarts, getInstructions, getLocalTypes, getReachableFrom, getReachableFrom, getReachableFromUpdate, getReachingToUpdate, getStackSizes, getStackTypes, initTypeInfo, isSubtypeOf, setClassHierarchy, stripSharpModifier and TypeMethodDescriptionfinal voidcomputeTypes(Analyzer.TypeVisitor v, BitSet makeTypesAt, boolean wantPath) Verify the method and compute types at every program point.static AnalyzercreateAnalyzer(MethodData info) final StringfindCommonSupertype(String t1, String t2) final int[][]final BitSetfinal IInstruction[]final String[][]final BitSetgetReachableFrom(int from) final BitSetgetReachableFrom(int from, boolean followHandlers, BitSet mask) final voidgetReachableFromUpdate(int from, BitSet reachable, boolean followHandlers, BitSet mask) final voidgetReachingToUpdate(int to, BitSet reaching, BitSet mask) int[]final String[][]protected final voidfinal booleanisSubtypeOf(String t1, String t2) final voidUse class hierarchy information in 'h'.static StringstripSharp(String type)
-
Constructor Details
-
Verifier
public Verifier(boolean isConstructor, boolean isStatic, String classType, String signature, IInstruction[] instructions, ExceptionHandler[][] handlers, int[] instToBC, String[][] vars) Initialize a verifier. -
Verifier
Initialize a verifier.- Throws:
NullPointerException- if info is null
-
Verifier
- Throws:
NullPointerException
-
-
Method Details
-
verify
Try to verify the method. If verification is unsuccessful, we throw an exception.- Throws:
Analyzer.FailureException- the method contains invalid bytecode
-
verifyCollectAll
- Throws:
Analyzer.FailureException
-
computeTypes
- Throws:
Analyzer.FailureException
-