org.jikesrvm.mm.mminterface
Class SpecializedScanMethod

java.lang.Object
  extended by org.jikesrvm.classloader.SpecializedMethod
      extended by org.jikesrvm.mm.mminterface.SpecializedScanMethod
All Implemented Interfaces:
JavaHeaderConstants, SizeConstants

public final class SpecializedScanMethod
extends SpecializedMethod
implements SizeConstants, JavaHeaderConstants

A method that scan objects and is specialized to a specific MMTk TransitiveClosure type.

In general as there may not be a 1-1 mapping between objects and the specialized methods this class is responsible for performing the mapping.

Specialized methods must have a static 'invoke' method that matches the given signature and return type.


Nested Class Summary
private static class SpecializedScanMethod.Names
          The atoms for the names of the specialized methods
 
Field Summary
static boolean ENABLED
          Use specialized scanning ?
private static int FALLBACK_PATTERN
          Fallback to a slower path that is not specialized
private static int MAX_SPECIALIZED_OFFSET
          Maximum field offset we can deal with
private static int NULL_PATTERN
          Objects with no references or primitive arrays
private static int PATTERNS
          The total number of patterns
private static int REFARRAY_PATTERN
          Reference arrays
private static TypeReference returnType
          The return type of this method: void
private static TypeReference[] signature
          This method's signature: the object to be scanned and the trace to use
private static int SPECIALIZED_PATTERNS
          Number of patterns we will specialize
private static Atom specializedMethodDescriptor
          The generic descriptor for the specialized methods
private  CompiledMethod[] specializedMethods
          We keep the specialized methods for key object reference patterns here.
private static TypeReference specializedScanMethodType
          Our type reference
private  TypeReference[] specializedSignature
          The specialized signature of the method
 
Fields inherited from class org.jikesrvm.classloader.SpecializedMethod
id
 
Fields inherited from interface org.jikesrvm.objectmodel.JavaHeaderConstants
ADDRESS_BASED_HASHING, ALIGNMENT_MASK, ALIGNMENT_VALUE, ALLOWS_LINEAR_SCAN, ARRAY_BASE_OFFSET, ARRAY_LENGTH_BYTES, ARRAY_LENGTH_OFFSET, DYNAMIC_HASH_OFFSET, FIELD_ZERO_OFFSET, FORWARDING_PTR_OVERLAYS_TIB, GC_HEADER_BYTES, GC_HEADER_OFFSET, HASH_STATE_HASHED, HASH_STATE_HASHED_AND_MOVED, HASH_STATE_MASK, HASH_STATE_UNHASHED, HASHCODE_BYTES, HASHCODE_OFFSET, JAVA_HEADER_BYTES, JAVA_HEADER_OFFSET, LOG_MIN_ALIGNMENT, MISC_HEADER_BYTES, MISC_HEADER_OFFSET, NUM_AVAILABLE_BITS, OTHER_HEADER_BYTES, SEGREGATE_ARRAYS_FOR_LINEAR_SCAN, STATUS_BYTES, TIB_BYTES
 
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
SpecializedScanMethod(int id, TypeReference specializedTrace)
           
 
Method Summary
static void fallback(Object object, TransitiveClosure trace)
          Fallback
private static int getPattern(RVMType type)
          Get the pattern index for a given type
 TypeReference getReturnType()
           
 TypeReference[] getSignature()
           
static void invoke(int id, Object object, TransitiveClosure trace)
          This method performs the scanning of a given object.
static void noReferences(Object object, TransitiveClosure trace)
          No Reference fields / Primitive Arrays
static void pattern(int pattern, Object object, TransitiveClosure trace)
          All patterns bottom out here
static void referenceArray(Object object, TransitiveClosure trace)
          Reference Arrays
static void scalar(Object object, TransitiveClosure trace)
          All Scalars
static void scalarNNNNNR(Object object, TransitiveClosure trace)
           
static void scalarNNNNRN(Object object, TransitiveClosure trace)
           
static void scalarNNNNRR(Object object, TransitiveClosure trace)
           
static void scalarNNNRNN(Object object, TransitiveClosure trace)
           
static void scalarNNNRNR(Object object, TransitiveClosure trace)
           
static void scalarNNNRRN(Object object, TransitiveClosure trace)
           
static void scalarNNNRRR(Object object, TransitiveClosure trace)
           
static void scalarNNRNNN(Object object, TransitiveClosure trace)
           
static void scalarNNRNNR(Object object, TransitiveClosure trace)
           
static void scalarNNRNRN(Object object, TransitiveClosure trace)
           
static void scalarNNRNRR(Object object, TransitiveClosure trace)
           
static void scalarNNRRNN(Object object, TransitiveClosure trace)
           
static void scalarNNRRNR(Object object, TransitiveClosure trace)
           
static void scalarNNRRRN(Object object, TransitiveClosure trace)
           
static void scalarNNRRRR(Object object, TransitiveClosure trace)
           
static void scalarNRNNNN(Object object, TransitiveClosure trace)
           
static void scalarNRNNNR(Object object, TransitiveClosure trace)
           
static void scalarNRNNRN(Object object, TransitiveClosure trace)
           
static void scalarNRNNRR(Object object, TransitiveClosure trace)
           
static void scalarNRNRNN(Object object, TransitiveClosure trace)
           
static void scalarNRNRNR(Object object, TransitiveClosure trace)
           
static void scalarNRNRRN(Object object, TransitiveClosure trace)
           
static void scalarNRNRRR(Object object, TransitiveClosure trace)
           
static void scalarNRRNNN(Object object, TransitiveClosure trace)
           
static void scalarNRRNNR(Object object, TransitiveClosure trace)
           
static void scalarNRRNRN(Object object, TransitiveClosure trace)
           
static void scalarNRRNRR(Object object, TransitiveClosure trace)
           
static void scalarNRRRNN(Object object, TransitiveClosure trace)
           
static void scalarNRRRNR(Object object, TransitiveClosure trace)
           
static void scalarNRRRRN(Object object, TransitiveClosure trace)
           
static void scalarNRRRRR(Object object, TransitiveClosure trace)
           
static void scalarRNNNNN(Object object, TransitiveClosure trace)
           
static void scalarRNNNNR(Object object, TransitiveClosure trace)
           
static void scalarRNNNRN(Object object, TransitiveClosure trace)
           
static void scalarRNNNRR(Object object, TransitiveClosure trace)
           
static void scalarRNNRNN(Object object, TransitiveClosure trace)
           
static void scalarRNNRNR(Object object, TransitiveClosure trace)
           
static void scalarRNNRRN(Object object, TransitiveClosure trace)
           
static void scalarRNNRRR(Object object, TransitiveClosure trace)
           
static void scalarRNRNNN(Object object, TransitiveClosure trace)
           
static void scalarRNRNNR(Object object, TransitiveClosure trace)
           
static void scalarRNRNRN(Object object, TransitiveClosure trace)
           
static void scalarRNRNRR(Object object, TransitiveClosure trace)
           
static void scalarRNRRNN(Object object, TransitiveClosure trace)
           
static void scalarRNRRNR(Object object, TransitiveClosure trace)
           
static void scalarRNRRRN(Object object, TransitiveClosure trace)
           
static void scalarRNRRRR(Object object, TransitiveClosure trace)
           
static void scalarRRNNNN(Object object, TransitiveClosure trace)
           
static void scalarRRNNNR(Object object, TransitiveClosure trace)
           
static void scalarRRNNRN(Object object, TransitiveClosure trace)
           
static void scalarRRNNRR(Object object, TransitiveClosure trace)
           
static void scalarRRNRNN(Object object, TransitiveClosure trace)
           
static void scalarRRNRNR(Object object, TransitiveClosure trace)
           
static void scalarRRNRRN(Object object, TransitiveClosure trace)
           
static void scalarRRNRRR(Object object, TransitiveClosure trace)
           
static void scalarRRRNNN(Object object, TransitiveClosure trace)
           
static void scalarRRRNNR(Object object, TransitiveClosure trace)
           
static void scalarRRRNRN(Object object, TransitiveClosure trace)
           
static void scalarRRRNRR(Object object, TransitiveClosure trace)
           
static void scalarRRRRNN(Object object, TransitiveClosure trace)
           
static void scalarRRRRNR(Object object, TransitiveClosure trace)
           
static void scalarRRRRRN(Object object, TransitiveClosure trace)
           
static void scalarRRRRRR(Object object, TransitiveClosure trace)
           
 ArchitectureSpecific.CodeArray specializeMethod(RVMType type)
          TODO: Lazily compile specialized methods?
private  Atom templateMethodName(int pattern)
          Find the template method name for a given pattern.
 
Methods inherited from class org.jikesrvm.classloader.SpecializedMethod
compileSpecializedMethod
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENABLED

public static final boolean ENABLED
Use specialized scanning ?

See Also:
Constant Field Values

signature

private static final TypeReference[] signature
This method's signature: the object to be scanned and the trace to use


returnType

private static final TypeReference returnType
The return type of this method: void


specializedScanMethodType

private static final TypeReference specializedScanMethodType
Our type reference


NULL_PATTERN

private static final int NULL_PATTERN
Objects with no references or primitive arrays

See Also:
Constant Field Values

SPECIALIZED_PATTERNS

private static final int SPECIALIZED_PATTERNS
Number of patterns we will specialize

See Also:
Constant Field Values

REFARRAY_PATTERN

private static final int REFARRAY_PATTERN
Reference arrays

See Also:
Constant Field Values

FALLBACK_PATTERN

private static final int FALLBACK_PATTERN
Fallback to a slower path that is not specialized

See Also:
Constant Field Values

PATTERNS

private static final int PATTERNS
The total number of patterns

See Also:
Constant Field Values

MAX_SPECIALIZED_OFFSET

private static final int MAX_SPECIALIZED_OFFSET
Maximum field offset we can deal with

See Also:
Constant Field Values

specializedMethods

private final CompiledMethod[] specializedMethods
We keep the specialized methods for key object reference patterns here.


specializedSignature

private final TypeReference[] specializedSignature
The specialized signature of the method


specializedMethodDescriptor

private static final Atom specializedMethodDescriptor
The generic descriptor for the specialized methods

Constructor Detail

SpecializedScanMethod

public SpecializedScanMethod(int id,
                             TypeReference specializedTrace)
Method Detail

getPattern

private static int getPattern(RVMType type)
Get the pattern index for a given type


specializeMethod

public ArchitectureSpecific.CodeArray specializeMethod(RVMType type)
TODO: Lazily compile specialized methods?

Specified by:
specializeMethod in class SpecializedMethod
Returns:
the specialized method for the given type.

getSignature

public TypeReference[] getSignature()
Specified by:
getSignature in class SpecializedMethod
Returns:
the method signature of the specialized method's invoke.

getReturnType

public TypeReference getReturnType()
Specified by:
getReturnType in class SpecializedMethod
Returns:
the return type of the specialized method's invoke

invoke

public static void invoke(int id,
                          Object object,
                          TransitiveClosure trace)
This method performs the scanning of a given object.

This is the method that (may) be hijacked by the compiler to call the specialized method.

It is safe for a compiler to ignore the potential gains and just use this method directly.

Parameters:
id - The specialized method id
object - The object to scan
trace - The trace to scan

fallback

public static void fallback(Object object,
                            TransitiveClosure trace)
Fallback


scalar

public static void scalar(Object object,
                          TransitiveClosure trace)
All Scalars


referenceArray

public static void referenceArray(Object object,
                                  TransitiveClosure trace)
Reference Arrays


noReferences

public static void noReferences(Object object,
                                TransitiveClosure trace)
No Reference fields / Primitive Arrays


pattern

public static void pattern(int pattern,
                           Object object,
                           TransitiveClosure trace)
All patterns bottom out here


templateMethodName

private Atom templateMethodName(int pattern)
Find the template method name for a given pattern.

Parameters:
pattern - The pattern to look for
Returns:
The method name that will be used.

scalarRNNNNN

public static void scalarRNNNNN(Object object,
                                TransitiveClosure trace)

scalarNRNNNN

public static void scalarNRNNNN(Object object,
                                TransitiveClosure trace)

scalarRRNNNN

public static void scalarRRNNNN(Object object,
                                TransitiveClosure trace)

scalarNNRNNN

public static void scalarNNRNNN(Object object,
                                TransitiveClosure trace)

scalarRNRNNN

public static void scalarRNRNNN(Object object,
                                TransitiveClosure trace)

scalarNRRNNN

public static void scalarNRRNNN(Object object,
                                TransitiveClosure trace)

scalarRRRNNN

public static void scalarRRRNNN(Object object,
                                TransitiveClosure trace)

scalarNNNRNN

public static void scalarNNNRNN(Object object,
                                TransitiveClosure trace)

scalarRNNRNN

public static void scalarRNNRNN(Object object,
                                TransitiveClosure trace)

scalarNRNRNN

public static void scalarNRNRNN(Object object,
                                TransitiveClosure trace)

scalarRRNRNN

public static void scalarRRNRNN(Object object,
                                TransitiveClosure trace)

scalarNNRRNN

public static void scalarNNRRNN(Object object,
                                TransitiveClosure trace)

scalarRNRRNN

public static void scalarRNRRNN(Object object,
                                TransitiveClosure trace)

scalarNRRRNN

public static void scalarNRRRNN(Object object,
                                TransitiveClosure trace)

scalarRRRRNN

public static void scalarRRRRNN(Object object,
                                TransitiveClosure trace)

scalarNNNNRN

public static void scalarNNNNRN(Object object,
                                TransitiveClosure trace)

scalarRNNNRN

public static void scalarRNNNRN(Object object,
                                TransitiveClosure trace)

scalarNRNNRN

public static void scalarNRNNRN(Object object,
                                TransitiveClosure trace)

scalarRRNNRN

public static void scalarRRNNRN(Object object,
                                TransitiveClosure trace)

scalarNNRNRN

public static void scalarNNRNRN(Object object,
                                TransitiveClosure trace)

scalarRNRNRN

public static void scalarRNRNRN(Object object,
                                TransitiveClosure trace)

scalarNRRNRN

public static void scalarNRRNRN(Object object,
                                TransitiveClosure trace)

scalarRRRNRN

public static void scalarRRRNRN(Object object,
                                TransitiveClosure trace)

scalarNNNRRN

public static void scalarNNNRRN(Object object,
                                TransitiveClosure trace)

scalarRNNRRN

public static void scalarRNNRRN(Object object,
                                TransitiveClosure trace)

scalarNRNRRN

public static void scalarNRNRRN(Object object,
                                TransitiveClosure trace)

scalarRRNRRN

public static void scalarRRNRRN(Object object,
                                TransitiveClosure trace)

scalarNNRRRN

public static void scalarNNRRRN(Object object,
                                TransitiveClosure trace)

scalarRNRRRN

public static void scalarRNRRRN(Object object,
                                TransitiveClosure trace)

scalarNRRRRN

public static void scalarNRRRRN(Object object,
                                TransitiveClosure trace)

scalarRRRRRN

public static void scalarRRRRRN(Object object,
                                TransitiveClosure trace)

scalarNNNNNR

public static void scalarNNNNNR(Object object,
                                TransitiveClosure trace)

scalarRNNNNR

public static void scalarRNNNNR(Object object,
                                TransitiveClosure trace)

scalarNRNNNR

public static void scalarNRNNNR(Object object,
                                TransitiveClosure trace)

scalarRRNNNR

public static void scalarRRNNNR(Object object,
                                TransitiveClosure trace)

scalarNNRNNR

public static void scalarNNRNNR(Object object,
                                TransitiveClosure trace)

scalarRNRNNR

public static void scalarRNRNNR(Object object,
                                TransitiveClosure trace)

scalarNRRNNR

public static void scalarNRRNNR(Object object,
                                TransitiveClosure trace)

scalarRRRNNR

public static void scalarRRRNNR(Object object,
                                TransitiveClosure trace)

scalarNNNRNR

public static void scalarNNNRNR(Object object,
                                TransitiveClosure trace)

scalarRNNRNR

public static void scalarRNNRNR(Object object,
                                TransitiveClosure trace)

scalarNRNRNR

public static void scalarNRNRNR(Object object,
                                TransitiveClosure trace)

scalarRRNRNR

public static void scalarRRNRNR(Object object,
                                TransitiveClosure trace)

scalarNNRRNR

public static void scalarNNRRNR(Object object,
                                TransitiveClosure trace)

scalarRNRRNR

public static void scalarRNRRNR(Object object,
                                TransitiveClosure trace)

scalarNRRRNR

public static void scalarNRRRNR(Object object,
                                TransitiveClosure trace)

scalarRRRRNR

public static void scalarRRRRNR(Object object,
                                TransitiveClosure trace)

scalarNNNNRR

public static void scalarNNNNRR(Object object,
                                TransitiveClosure trace)

scalarRNNNRR

public static void scalarRNNNRR(Object object,
                                TransitiveClosure trace)

scalarNRNNRR

public static void scalarNRNNRR(Object object,
                                TransitiveClosure trace)

scalarRRNNRR

public static void scalarRRNNRR(Object object,
                                TransitiveClosure trace)

scalarNNRNRR

public static void scalarNNRNRR(Object object,
                                TransitiveClosure trace)

scalarRNRNRR

public static void scalarRNRNRR(Object object,
                                TransitiveClosure trace)

scalarNRRNRR

public static void scalarNRRNRR(Object object,
                                TransitiveClosure trace)

scalarRRRNRR

public static void scalarRRRNRR(Object object,
                                TransitiveClosure trace)

scalarNNNRRR

public static void scalarNNNRRR(Object object,
                                TransitiveClosure trace)

scalarRNNRRR

public static void scalarRNNRRR(Object object,
                                TransitiveClosure trace)

scalarNRNRRR

public static void scalarNRNRRR(Object object,
                                TransitiveClosure trace)

scalarRRNRRR

public static void scalarRRNRRR(Object object,
                                TransitiveClosure trace)

scalarNNRRRR

public static void scalarNNRRRR(Object object,
                                TransitiveClosure trace)

scalarRNRRRR

public static void scalarRNRRRR(Object object,
                                TransitiveClosure trace)

scalarNRRRRR

public static void scalarNRRRRR(Object object,
                                TransitiveClosure trace)

scalarRRRRRR

public static void scalarRRRRRR(Object object,
                                TransitiveClosure trace)