de.rwth.dfa.jvm.samples
Class LVAbstraction

java.lang.Object
  |
  +--de.rwth.dfa.jvm.samples.LVAbstraction
All Implemented Interfaces:
Abstraction

public class LVAbstraction
extends java.lang.Object
implements Abstraction

Implementation of a live variables abstraction. It can be used to determine the dead local variable slots for each instruction of a JVM method. The domain used is a BitVectorLattice with one bit for each slot. If the bit is not set in the result, then the slot is definitely dead. If it is set, the slot may be live or not.

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

Inner classes inherited from class de.rwth.dfa.jvm.Abstraction
Abstraction.Default
 
Field Summary
protected  BitVectorLattice b
          The lattice of this abstraction.
 
Fields inherited from interface de.rwth.dfa.jvm.Abstraction
DIRECTION_BACKWARD, DIRECTION_FORWARD, QUANTIFIER_ALL, QUANTIFIER_EXISTS
 
Constructor Summary
LVAbstraction(int maxLocals)
          Creates a new LVAbstraction instance.
LVAbstraction(de.fub.bytecode.classfile.Method m)
          Creates a new LVAbstraction instance.
 
Method Summary
 Function getAbstract(de.fub.bytecode.generic.InstructionHandle ih)
          Returns a KillGenBitVectorFunction for an instruction.
 Function getAbstract(InstructionHandleVector ihv)
          Returns a new KillGenBitVectorFunction for a vector of instructions.
 int getDirection()
          Returns DIRECTION_BACKWARD.
 java.lang.Object getInitialValue(de.fub.bytecode.generic.InstructionHandle ih, boolean isRoot)
          Returns the bottom element of the lattice where all bits are not set.
 java.lang.Object getInitialValue(InstructionHandleVector ihv, boolean isRoot)
          Returns the value of the default implementation in Abstraction.Default.
 Lattice getLattice()
          Returns the lattice of this abstraction.
 int getQuantifier()
          Returns QUANTIFIER_EXISTS.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

b

protected BitVectorLattice b
The lattice of this abstraction.
Constructor Detail

LVAbstraction

public LVAbstraction(int maxLocals)
Creates a new LVAbstraction instance.
Parameters:
maxLocals - an int value: The maximal number of used slots in the method.

LVAbstraction

public LVAbstraction(de.fub.bytecode.classfile.Method m)
Creates a new LVAbstraction instance.
Parameters:
m - a Method value
Method Detail

getLattice

public Lattice getLattice()
Returns the lattice of this abstraction.
Specified by:
getLattice in interface Abstraction
Returns:
a Lattice value

getInitialValue

public java.lang.Object getInitialValue(de.fub.bytecode.generic.InstructionHandle ih,
                                        boolean isRoot)
Returns the bottom element of the lattice where all bits are not set.
Specified by:
getInitialValue in interface Abstraction
Parameters:
ih - an InstructionHandle value
isRoot - a boolean value
Returns:
an Object value

getDirection

public int getDirection()
Returns DIRECTION_BACKWARD.
Specified by:
getDirection in interface Abstraction
Returns:
an int value

getQuantifier

public int getQuantifier()
Returns QUANTIFIER_EXISTS.
Specified by:
getQuantifier in interface Abstraction
Returns:
an int value

getAbstract

public Function getAbstract(de.fub.bytecode.generic.InstructionHandle ih)
Returns a KillGenBitVectorFunction for an instruction. The bits for those slots which are made dead (by overwriting the value) are killed, those which are made live (by accessing the value) are generated by the function.
Specified by:
getAbstract in interface Abstraction
Parameters:
ih - an InstructionHandle value
Returns:
a Function value

getInitialValue

public java.lang.Object getInitialValue(InstructionHandleVector ihv,
                                        boolean isRoot)
Returns the value of the default implementation in Abstraction.Default.
Specified by:
getInitialValue in interface Abstraction
Parameters:
ihv - an InstructionHandleVector value
isRoot - a boolean value
Returns:
an Object value

getAbstract

public Function getAbstract(InstructionHandleVector ihv)
Returns a new KillGenBitVectorFunction for a vector of instructions. This is much more efficient than using the default implementation in Abstraction.Default.
Specified by:
getAbstract in interface Abstraction
Parameters:
ihv - an InstructionHandleVector value
Returns:
a Function value