harpoon.Backend.Analysis
Class ClassFieldMap

java.lang.Object
  extended by harpoon.Backend.Maps.FieldMap
      extended by harpoon.Backend.Analysis.ClassFieldMap
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
SortedClassFieldMap, TinyClassFieldMap

public abstract class ClassFieldMap
extends FieldMap

A ClassFieldMap is a FieldMap for non-static fields of a class. The user must implement a function giving the size of a field to complete the implementation. Results are cached for efficiency.

Version:
$Id: ClassFieldMap.java,v 1.7 2004/02/08 03:20:42 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
Serialized Form

Constructor Summary
ClassFieldMap()
          Creates a ClassFieldMap.
 
Method Summary
protected  HField[] declaredFields(HClass hc)
          Return the declared fields of the specified class in the order in which they should be allocated.
 List<HField> fieldList(HClass hc)
          Return an unmodifiable List over all appropriate fields in the given class, in order from smallest to largest offset.
 int fieldOffset(HField hf)
          Return an offset to the given field.
 
Methods inherited from class harpoon.Backend.Maps.FieldMap
fieldAlignment, fieldSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassFieldMap

public ClassFieldMap()
Creates a ClassFieldMap.

Method Detail

fieldOffset

public int fieldOffset(HField hf)
Description copied from class: FieldMap
Return an offset to the given field.

Specified by:
fieldOffset in class FieldMap

fieldList

public List<HField> fieldList(HClass hc)
Description copied from class: FieldMap
Return an unmodifiable List over all appropriate fields in the given class, in order from smallest to largest offset.

Specified by:
fieldList in class FieldMap

declaredFields

protected HField[] declaredFields(HClass hc)
Return the declared fields of the specified class in the order in which they should be allocated. This implementation just returns the result of hc.getDeclaredFields(), but you can override this to use a more intelligent sorting routine to save space. You do not have to filter static methods out of the returned array, but you may if you like.