harpoon.Backend.Maps
Class NameMap

java.lang.Object
  extended by harpoon.Backend.Maps.NameMap
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DefaultNameMap

public abstract class NameMap
extends Object
implements Serializable

NameMap gives a translation from methods, classes, and fields to unique string labels legal in assembly code.

Version:
$Id: NameMap.java,v 1.3 2003/04/19 01:03:54 salcianu Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
Serialized Form

Constructor Summary
NameMap()
           
 
Method Summary
abstract  String c_function_name(String function_name)
          Maps a C function name to the appropriate label string.
 Label label(HClass hc)
          Maps an HClass to a Label representing the location of its class pointer
 Label label(HClass hc, String suffix)
          Maps an HClass to a Label representing the class data structure associated with the given suffix.
 Label label(HField hf)
          Maps a static HField to a Label.
 Label label(HField hf, String suffix)
          Maps an HField to a Label representing the field information structure associated with the given suffix.
 Label label(HMethod hm)
          Maps an HMethod to a Label.
 Label label(HMethod hm, String suffix)
          Maps an HMethod to a Label representing the method information structure associated with the given suffix.
 Label label(String stringConstant)
          Maps a String constant to a Label.
 Label label(String stringConstant, String suffix)
          Maps a String constant to a Label representing the string data structure associated with the given suffix.
 String mangle(HClass hc)
          Mangle a class name.
abstract  String mangle(HClass hc, String suffix)
          Mangle a class name, adding a uniqueness suffix.
 String mangle(HField hf)
          Mangle a field name.
abstract  String mangle(HField hf, String suffix)
          Mangle a field name, adding a uniqueness suffix.
 String mangle(HMethod hm)
          Mangle a method name.
abstract  String mangle(HMethod hm, String suffix)
          Mangle a method name, adding a uniqueness suffix.
 String mangle(String string_constant)
          Mangle a reference to a string constant.
abstract  String mangle(String string_constant, String suffix)
          Mangle a reference to a string constant, adding a uniqueness suffix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NameMap

public NameMap()
Method Detail

c_function_name

public abstract String c_function_name(String function_name)
Maps a C function name to the appropriate label string. For many platforms, the label string has an underscore prepended. For others, the label string is the function name exactly.


mangle

public String mangle(HMethod hm)
Mangle a method name.


mangle

public abstract String mangle(HMethod hm,
                              String suffix)
Mangle a method name, adding a uniqueness suffix. The generated string is guaranteed not to conflict with any other mangled string from a different method, field, or class, or any other mangled string from this method with a different suffix. The suffix may be null; the string returned in this case is idential to that obtained by a call to mangle(hm) (with no specified suffix).


mangle

public String mangle(HField hf)
Mangle a field name.


mangle

public abstract String mangle(HField hf,
                              String suffix)
Mangle a field name, adding a uniqueness suffix. The generated string is guaranteed not to conflict with any other mangled string from a different method, field, or class, or any other mangled string from this field with a different suffix. The suffix may be null; the string returned in this case is idential to that obtained by a call to mangle(hf) (with no specified suffix).


mangle

public String mangle(HClass hc)
Mangle a class name.


mangle

public abstract String mangle(HClass hc,
                              String suffix)
Mangle a class name, adding a uniqueness suffix. The generated string is guaranteed not to conflict with any other mangled string from a different method, field, or class, or any other mangled string from this class with a different suffix. The suffix may be null; the string returned in this case is idential to that obtained by a call to mangle(hf) (with no specified suffix).


mangle

public String mangle(String string_constant)
Mangle a reference to a string constant.


mangle

public abstract String mangle(String string_constant,
                              String suffix)
Mangle a reference to a string constant, adding a uniqueness suffix. The generated string is guaranteed not to conflict with any other mangled string from any method, field, class, or string constant reference, or any other mangled reference to this string constant with a different suffix. The suffix may be null; the string returned in this case is idential to that obtained by a call to mangle(string_constant) (with no specified suffix).


label

public Label label(HClass hc)
Maps an HClass to a Label representing the location of its class pointer


label

public Label label(HClass hc,
                   String suffix)
Maps an HClass to a Label representing the class data structure associated with the given suffix.


label

public Label label(HField hf)
Maps a static HField to a Label.


label

public Label label(HField hf,
                   String suffix)
Maps an HField to a Label representing the field information structure associated with the given suffix.


label

public Label label(HMethod hm)
Maps an HMethod to a Label. Note that the method does not have to be static or final; in many cases we can determine the identity of a virtual function exactly using type information, and label() should return a Label we can use to take advantage of this information.


label

public Label label(HMethod hm,
                   String suffix)
Maps an HMethod to a Label representing the method information structure associated with the given suffix.


label

public Label label(String stringConstant)
Maps a String constant to a Label.


label

public Label label(String stringConstant,
                   String suffix)
Maps a String constant to a Label representing the string data structure associated with the given suffix.