org.jikesrvm.compilers.opt.specialization
Class SpecializationDatabase

java.lang.Object
  extended by org.jikesrvm.compilers.opt.specialization.SpecializationDatabase

public final class SpecializationDatabase
extends Object

Database to store multiple specialized versions for a given method.

The overall design is very similar to that of the InvalidationDatabase (see InvalidationDatabase.java) In this database, the key is the RVMMethod object of the source method and the value is a method set. The method set is a list of specialized versions of the method pointed by the key. Specialized versions are represented by using the SpecializedMethod class. There is no provision for removing/deleting method versions as classes are never unloaded and the ClassLoader.compiledMethods[] is never cleaned.


Nested Class Summary
(package private) static class SpecializationDatabase.MethodSet<T>
          The following defines a set of methods that share a common "key"
 
Field Summary
private static HashSetRVM<SpecializedMethod> deferredMethods
           
private static boolean specializationInProgress
           
private static ImmutableEntryHashMapRVM<RVMMethod,SpecializationDatabase.MethodSet<RVMMethod>> specialVersionsHash
           
 
Constructor Summary
SpecializationDatabase()
           
 
Method Summary
static void doDeferredSpecializations()
          Drain the queue of methods waiting for specialized code generation.
private static
<T> SpecializationDatabase.MethodSet<T>
findOrCreateMethodSet(ImmutableEntryHashMapRVM<T,SpecializationDatabase.MethodSet<T>> hash, T key)
          Look up the MethodSet corresponding to a given key in the database If none found, create one.
(package private) static int getSpecialVersionCount(RVMMethod m)
           
(package private) static Iterator<SpecializedMethod> getSpecialVersions(RVMMethod m)
          Return an iteration of SpecializedMethods that represents specialized compiled versions of the method pointed by RVMMethod
private static void registerCompiledMethod(SpecializedMethod m)
           
(package private) static void registerSpecialVersion(SpecializedMethod spMethod)
          Record a new specialized method in this database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

specializationInProgress

private static boolean specializationInProgress

deferredMethods

private static final HashSetRVM<SpecializedMethod> deferredMethods

specialVersionsHash

private static final ImmutableEntryHashMapRVM<RVMMethod,SpecializationDatabase.MethodSet<RVMMethod>> specialVersionsHash
Constructor Detail

SpecializationDatabase

public SpecializationDatabase()
Method Detail

doDeferredSpecializations

public static void doDeferredSpecializations()
Drain the queue of methods waiting for specialized code generation.


registerCompiledMethod

private static void registerCompiledMethod(SpecializedMethod m)

getSpecialVersions

static Iterator<SpecializedMethod> getSpecialVersions(RVMMethod m)
Return an iteration of SpecializedMethods that represents specialized compiled versions of the method pointed by RVMMethod

Returns:
null if no specialized versions

getSpecialVersionCount

static int getSpecialVersionCount(RVMMethod m)

registerSpecialVersion

static void registerSpecialVersion(SpecializedMethod spMethod)
Record a new specialized method in this database. Also remember that this method will need to be compiled later, at the next call to doDeferredSpecializations()


findOrCreateMethodSet

private static <T> SpecializationDatabase.MethodSet<T> findOrCreateMethodSet(ImmutableEntryHashMapRVM<T,SpecializationDatabase.MethodSet<T>> hash,
                                                                             T key)
Look up the MethodSet corresponding to a given key in the database If none found, create one.