harpoon.Analysis.SizeOpt
Class ConstructorClassifier

java.lang.Object
  extended by harpoon.Analysis.SizeOpt.ConstructorClassifier

public class ConstructorClassifier
extends Object

The ConstructorClassifier class takes a look at constructor invocations and determines whether we can do one of several 'mostly-zero field' transformations.

Version:
$Id: ConstructorClassifier.java,v 1.6 2004/02/08 03:20:22 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>

Constructor Summary
ConstructorClassifier(HCodeFactory hcf, ClassHierarchy ch)
          Creates a ConstructorClassifier.
 
Method Summary
 Object constantValue(HMethod constructor, HField hf)
          Returns the constant value which field hf is set to whenever the given constructor is executed.
 boolean isConstant(HMethod constructor, HField hf)
          Returns true iff the given field hf is always set to a constant value when the given constructor is executed.
 boolean isGood(HField hf)
          Returns true iff the given field is 'subclass-final' and there is at least one callable constructor where the field's content can be predicted.
 boolean isGood(HMethod constructor)
          Returns true iff there is at least one field whose value can be predicted when this constructor is called.
 boolean isParam(HMethod constructor, HField hf)
          Returns true iff the given field hf is always set to the same value as one of the constructor's parameters whenever it is executed.
 int paramNumber(HMethod constructor, HField hf)
          Returns the number of the parameter (starting at 0) which holds the value which hf will be set to whenever the given constructor is executed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstructorClassifier

public ConstructorClassifier(HCodeFactory hcf,
                             ClassHierarchy ch)
Creates a ConstructorClassifier.

Method Detail

isGood

public boolean isGood(HField hf)
Returns true iff the given field is 'subclass-final' and there is at least one callable constructor where the field's content can be predicted.


isGood

public boolean isGood(HMethod constructor)
Returns true iff there is at least one field whose value can be predicted when this constructor is called.


isConstant

public boolean isConstant(HMethod constructor,
                          HField hf)
Returns true iff the given field hf is always set to a constant value when the given constructor is executed.


constantValue

public Object constantValue(HMethod constructor,
                            HField hf)
Returns the constant value which field hf is set to whenever the given constructor is executed. Requires that isConstant(constructor,hf) be true.


isParam

public boolean isParam(HMethod constructor,
                       HField hf)
Returns true iff the given field hf is always set to the same value as one of the constructor's parameters whenever it is executed.


paramNumber

public int paramNumber(HMethod constructor,
                       HField hf)
Returns the number of the parameter (starting at 0) which holds the value which hf will be set to whenever the given constructor is executed. Requires that isParam(constructor, hf be true.