org.jikesrvm.classloader
Class InterfaceMethodSignature

java.lang.Object
  extended by org.jikesrvm.classloader.InterfaceMethodSignature
All Implemented Interfaces:
TIBLayoutConstants, SizeConstants

public final class InterfaceMethodSignature
extends Object
implements TIBLayoutConstants, SizeConstants

An interface method signature is a pair of atoms: interfaceMethodName + interfaceMethodDescriptor.


Field Summary
private  Atom descriptor
          Descriptor of the interface method
private static ImmutableEntryHashSetRVM<InterfaceMethodSignature> dictionary
          Used to canonicalize InterfaceMethodSignatures
private  int id
          Id of this interface method signature (not used in hashCode or equals).
private  Atom name
          Name of the interface method
private static int nextId
          Used to assign ids.
 
Fields inherited from interface org.jikesrvm.objectmodel.TIBLayoutConstants
IMT_METHOD_SLOTS, NEEDS_DYNAMIC_LINK, TIB_ARRAY_ELEMENT_TIB_INDEX, TIB_DOES_IMPLEMENT_INDEX, TIB_FIRST_SPECIALIZED_METHOD_INDEX, TIB_FIRST_VIRTUAL_METHOD_INDEX, TIB_INTERFACE_DISPATCH_TABLE_INDEX, TIB_SUPERCLASS_IDS_INDEX, TIB_TYPE_INDEX
 
Fields inherited from interface org.jikesrvm.SizeConstants
BITS_IN_ADDRESS, BITS_IN_BOOLEAN, BITS_IN_BYTE, BITS_IN_CHAR, BITS_IN_DOUBLE, BITS_IN_EXTENT, BITS_IN_FLOAT, BITS_IN_INT, BITS_IN_LONG, BITS_IN_OFFSET, BITS_IN_PAGE, BITS_IN_SHORT, BITS_IN_WORD, BYTES_IN_ADDRESS, BYTES_IN_BOOLEAN, BYTES_IN_BYTE, BYTES_IN_CHAR, BYTES_IN_DOUBLE, BYTES_IN_EXTENT, BYTES_IN_FLOAT, BYTES_IN_INT, BYTES_IN_LONG, BYTES_IN_OFFSET, BYTES_IN_PAGE, BYTES_IN_SHORT, BYTES_IN_WORD, LOG_BITS_IN_ADDRESS, LOG_BITS_IN_BOOLEAN, LOG_BITS_IN_BYTE, LOG_BITS_IN_CHAR, LOG_BITS_IN_DOUBLE, LOG_BITS_IN_EXTENT, LOG_BITS_IN_FLOAT, LOG_BITS_IN_INT, LOG_BITS_IN_LONG, LOG_BITS_IN_OFFSET, LOG_BITS_IN_PAGE, LOG_BITS_IN_SHORT, LOG_BITS_IN_WORD, LOG_BYTES_IN_ADDRESS, LOG_BYTES_IN_BOOLEAN, LOG_BYTES_IN_BYTE, LOG_BYTES_IN_CHAR, LOG_BYTES_IN_DOUBLE, LOG_BYTES_IN_EXTENT, LOG_BYTES_IN_FLOAT, LOG_BYTES_IN_INT, LOG_BYTES_IN_LONG, LOG_BYTES_IN_OFFSET, LOG_BYTES_IN_PAGE, LOG_BYTES_IN_SHORT, LOG_BYTES_IN_WORD
 
Constructor Summary
private InterfaceMethodSignature(Atom name, Atom descriptor, int id)
           
 
Method Summary
 boolean equals(Object other)
           
static InterfaceMethodSignature findOrCreate(MemberReference ref)
          Find or create an interface method signature for the given method reference.
 Atom getDescriptor()
           
 int getId()
           
 Offset getIMTOffset()
          If using embedded IMTs, Get offset of interface method slot in TIB.
 Atom getName()
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

dictionary

private static final ImmutableEntryHashSetRVM<InterfaceMethodSignature> dictionary
Used to canonicalize InterfaceMethodSignatures


nextId

private static int nextId
Used to assign ids. Don't use id 0 to allow clients to use id 0 as a 'null'.


name

private final Atom name
Name of the interface method


descriptor

private final Atom descriptor
Descriptor of the interface method


id

private final int id
Id of this interface method signature (not used in hashCode or equals).

Constructor Detail

InterfaceMethodSignature

private InterfaceMethodSignature(Atom name,
                                 Atom descriptor,
                                 int id)
Method Detail

findOrCreate

public static InterfaceMethodSignature findOrCreate(MemberReference ref)
Find or create an interface method signature for the given method reference.

Parameters:
ref - A reference to a supposed interface method
Returns:
the interface method signature

getName

public Atom getName()
Returns:
name of the interface method

getDescriptor

public Atom getDescriptor()
Returns:
descriptor of hte interface method

getId

public int getId()
Returns:
the id of thie interface method signature.

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object

getIMTOffset

public Offset getIMTOffset()
If using embedded IMTs, Get offset of interface method slot in TIB. If using indirect IMTs, Get offset of interface method slot in IMT. Note that all methods with same name & descriptor map to the same slot.

TODO!! replace this stupid offset assignment algorithm with something more reasonable.

Returns:
offset in TIB/IMT