de.rwth.dfa.jvm.samples
Class AbstractAnalyser

java.lang.Object
  |
  +--de.rwth.utils.AbstractClassProcessor
        |
        +--de.rwth.dfa.jvm.samples.AbstractAnalyser
Direct Known Subclasses:
CPAnalyser, LVAnalyser, SSAnalyser

public abstract class AbstractAnalyser
extends AbstractClassProcessor

An abstract class for constructing applications for analyzing the JVM methods of a class file.

Version:
$Id: AbstractAnalyser.java,v 1.3 2002/09/17 06:53:53 mohnen Exp $
Author:
Markus Mohnen

Field Summary
protected  java.lang.Object[] refSolution
          The reference solution of the current group of solvers.
protected  Table table
          The table for collection the statistics.
 
Fields inherited from class de.rwth.utils.AbstractClassProcessor
file, flags
 
Constructor Summary
AbstractAnalyser(java.lang.String[] args)
          Creates a new AbstractAnalyser instance.
 
Method Summary
protected  void checkResult(Lattice lattice, de.fub.bytecode.generic.InstructionList instrs, java.lang.Object[] solution, java.lang.Object[] refSolution)
          Cross checks results and reports errors in an IllegalArgumentException.
protected  void dumpResult(de.fub.bytecode.generic.InstructionList instrs, java.lang.Object[] solution)
          Print the code with the solution to standard output.
abstract  Abstraction getAbstraction(de.fub.bytecode.classfile.Method method, de.fub.bytecode.classfile.Code code, de.fub.bytecode.classfile.CodeException[] methodExceptions, de.fub.bytecode.generic.InstructionList instrs)
          Supposed to return the abstraction used for a specific method.
abstract  Solver[] getSolvers(Abstraction abstraction, java.lang.String methodName, de.fub.bytecode.generic.InstructionList methodInstrs, de.fub.bytecode.classfile.CodeException[] methodExceptions, Stopwatch stopwatch)
          Supposed to return all available solvers.
protected  boolean isAllMode()
          Checks if all solvers were requested on the command line.
protected  boolean isStatisticsMode()
          Checks if statistics mode was requested on the command line.
protected  boolean isVerboseMode()
          Checks if verbose mode was requested on the command line.
 void process(de.fub.bytecode.classfile.JavaClass jclass, java.lang.String filename)
          Processes a class file.
 void process(de.fub.bytecode.classfile.Method method, java.lang.String filename)
          Processes a method.
protected  void transferToTable(Stopwatch stopwatch, Solver solver, java.lang.String key)
          Transfers the results of a single solver run to the table.
 
Methods inherited from class de.rwth.utils.AbstractClassProcessor
process, usage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

protected Table table
The table for collection the statistics.

refSolution

protected java.lang.Object[] refSolution
The reference solution of the current group of solvers. It is null for the first solver of a group.
Constructor Detail

AbstractAnalyser

public AbstractAnalyser(java.lang.String[] args)
Creates a new AbstractAnalyser instance. It accepts the following command line options:
-v
Verbose mode. Dump all kind of information to standard error.
-a
Use all solvers. Default is to use only the first solver. This also activates the cross checking of (comparable) solver results.
-s
Statistics mode. At the end, a comma separated table with timing statistics, memory usage is printed to the standard output.
All non-native methods of the class file on the command line are processed and the code with the computed solution is printed to standard output.
Parameters:
args - a String[] value: The command line arguments.
Method Detail

isVerboseMode

protected boolean isVerboseMode()
Checks if verbose mode was requested on the command line.
Returns:
a boolean value

isAllMode

protected boolean isAllMode()
Checks if all solvers were requested on the command line.
Returns:
a boolean value

isStatisticsMode

protected boolean isStatisticsMode()
Checks if statistics mode was requested on the command line.
Returns:
a boolean value

dumpResult

protected void dumpResult(de.fub.bytecode.generic.InstructionList instrs,
                          java.lang.Object[] solution)
Print the code with the solution to standard output.
Parameters:
instrs - an InstructionList value
solution - an Object[] value

checkResult

protected void checkResult(Lattice lattice,
                           de.fub.bytecode.generic.InstructionList instrs,
                           java.lang.Object[] solution,
                           java.lang.Object[] refSolution)
Cross checks results and reports errors in an IllegalArgumentException.
Parameters:
lattice - a Lattice value
instrs - an InstructionList value
solution - an Object[] value
refSolution - an Object[] value

transferToTable

protected void transferToTable(Stopwatch stopwatch,
                               Solver solver,
                               java.lang.String key)
Transfers the results of a single solver run to the table.
Parameters:
stopwatch - a Stopwatch value
solver - a Solver value
key - a String value

getSolvers

public abstract Solver[] getSolvers(Abstraction abstraction,
                                    java.lang.String methodName,
                                    de.fub.bytecode.generic.InstructionList methodInstrs,
                                    de.fub.bytecode.classfile.CodeException[] methodExceptions,
                                    Stopwatch stopwatch)
Supposed to return all available solvers. Solvers with comparable results should be grouped in sequence together, the groups must be separated with null entries. The solution of the first solver in a group is used as reference solution for the group.
Parameters:
abstraction - an Abstraction value
methodName - a String value
methodInstrs - an InstructionList value
methodExceptions - a CodeException[] value
stopwatch - a Stopwatch value
Returns:
a Solver[] value

getAbstraction

public abstract Abstraction getAbstraction(de.fub.bytecode.classfile.Method method,
                                           de.fub.bytecode.classfile.Code code,
                                           de.fub.bytecode.classfile.CodeException[] methodExceptions,
                                           de.fub.bytecode.generic.InstructionList instrs)
Supposed to return the abstraction used for a specific method.
Parameters:
method - a Method value
code - a Code value
methodExceptions - a CodeException[] value
instrs - an InstructionList value
Returns:
an Abstraction value

process

public void process(de.fub.bytecode.classfile.Method method,
                    java.lang.String filename)
Processes a method.
Parameters:
method - a Method value
filename - a String value

process

public void process(de.fub.bytecode.classfile.JavaClass jclass,
                    java.lang.String filename)
Processes a class file.
Overrides:
process in class AbstractClassProcessor
Parameters:
jclass - a JavaClass value
filename - a String value