org.jikesrvm.classloader
Class RVMClassLoader

java.lang.Object
  extended by org.jikesrvm.classloader.RVMClassLoader
All Implemented Interfaces:
ClassLoaderConstants, Constants, HeapLayoutConstants, ThinLockConstants, TIBLayoutConstants, SizeConstants

public class RVMClassLoader
extends Object
implements Constants, ClassLoaderConstants

Manufacture type descriptions as needed by the running virtual machine.


Field Summary
(package private) static Atom annotationDefaultAttributeName
          AnnotationDefault
private static ClassLoader appCL
           
private static boolean appCLReady
          Is the application class loader ready for use?
private static String applicationRepositories
           
private static boolean assertionsEnabled
          Are Java 1.4 style assertions enabled?
(package private) static Atom codeAttributeName
          Code
(package private) static Atom constantValueAttributeName
          ConstantValue
private static boolean DBG_APP_CL
           
(package private) static Atom deprecatedAttributeName
          Deprecated
private static String[] disabledAssertionStrings
          String describing packages and classes to disable assertions on (of the form ":...
private static String[] enabledAssertionStrings
          String describing packages and classes to enable assertions on (of the form ":...
(package private) static Atom enclosingMethodAttributeName
          EnclosingMethod
(package private) static Atom exceptionsAttributeName
          Exceptions
private static int gettingAppCL
          Are we getting the application CL?
(package private) static Atom innerClassesAttributeName
          InnerClasses
(package private) static Atom lineNumberTableAttributeName
          LineNumberTable
(package private) static Atom localVariableTableAttributeName
          LocalVariableTable
(package private) static Atom runtimeInvisibleAnnotationsAttributeName
          RuntimeInvisibleAnnotations
(package private) static Atom runtimeInvisibleParameterAnnotationsAttributeName
          RuntimeInvisibleParameterAnnotations
(package private) static Atom runtimeVisibleAnnotationsAttributeName
          RuntimeVisibleAnnotations
(package private) static Atom runtimeVisibleParameterAnnotationsAttributeName
          RuntimeVisibleParameterAnnotations
(package private) static Atom signatureAttributeName
          Signature
(package private) static Atom sourceFileAttributeName
          SourceFile
static Atom StandardClassInitializerMethodDescriptor
          "()V"
static Atom StandardClassInitializerMethodName
          <clinit>
static Atom StandardObjectFinalizerMethodDescriptor
          ()V
static Atom StandardObjectFinalizerMethodName
          finalize
static Atom StandardObjectInitializerHelperMethodName
          this
static Atom StandardObjectInitializerMethodDescriptor
          ()V
static Atom StandardObjectInitializerMethodName
          <init>
(package private) static Atom syntheticAttributeName
          Synthetic
 
Fields inherited from interface org.jikesrvm.Constants
NOT_REACHED, REFLECTION_FPRS_BITS, REFLECTION_FPRS_MASK, REFLECTION_GPRS_BITS, REFLECTION_GPRS_MASK
 
Fields inherited from interface org.jikesrvm.objectmodel.ThinLockConstants
TL_DEDICATED_U16_OFFSET, TL_DEDICATED_U16_SHIFT, TL_LOCK_COUNT_MASK, TL_LOCK_COUNT_SHIFT, TL_LOCK_COUNT_UNIT, TL_LOCK_ID_MASK, TL_LOCK_ID_SHIFT, TL_NUM_BITS_RC, TL_NUM_BITS_STAT, TL_NUM_BITS_TID, TL_STAT_BIASABLE, TL_STAT_FAT, TL_STAT_MASK, TL_STAT_SHIFT, TL_STAT_THIN, TL_THREAD_ID_MASK, TL_THREAD_ID_SHIFT, TL_UNLOCK_MASK
 
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
 
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.HeapLayoutConstants
BAD_MAP_COMPRESSION, BOOT_IMAGE_CODE_END, BOOT_IMAGE_CODE_SIZE, BOOT_IMAGE_CODE_START, BOOT_IMAGE_DATA_END, BOOT_IMAGE_DATA_SIZE, BOOT_IMAGE_DATA_START, BOOT_IMAGE_END, BOOT_IMAGE_RMAP_END, BOOT_IMAGE_RMAP_START, MAX_BOOT_IMAGE_RMAP_SIZE, MAXIMUM_MAPPABLE
 
Fields inherited from interface org.jikesrvm.classloader.ClassLoaderConstants
ACC_ABSTRACT, ACC_ANNOTATION, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VOLATILE, APPLICABLE_TO_CLASSES, APPLICABLE_TO_FIELDS, APPLICABLE_TO_METHODS, ArrayTypeCode, BooleanTypeCode, BRIDGE, ByteTypeCode, CharTypeCode, CLASS_INITIALIZED, CLASS_INITIALIZER_FAILED, CLASS_INITIALIZING, CLASS_INSTANTIATED, CLASS_LOADED, CLASS_RESOLVED, CLASS_VACANT, ClassTypeCode, CP_CLASS, CP_DOUBLE, CP_FLOAT, CP_INT, CP_LONG, CP_MEMBER, CP_STRING, CP_UTF, DoubleTypeCode, FloatTypeCode, IntTypeCode, LongTypeCode, ShortTypeCode, TAG_DOUBLE, TAG_FIELDREF, TAG_FLOAT, TAG_INT, TAG_INTERFACE_METHODREF, TAG_LONG, TAG_MEMBERNAME_AND_DESCRIPTOR, TAG_METHODREF, TAG_STRING, TAG_TYPEREF, TAG_UNUSED, TAG_UTF, VARARGS, VoidTypeCode
 
Constructor Summary
RVMClassLoader()
           
 
Method Summary
static void boot()
          Initialize at boot time.
static void declareApplicationClassLoaderIsReady()
           
static RVMType defineClassInternal(String className, byte[] classRep, int offset, int length, ClassLoader classloader)
           
static RVMType defineClassInternal(String className, InputStream is, ClassLoader classloader)
           
static ClassLoader findWorkableClassloader(Atom clazz)
          An unpleasant hack to deal with the problem of replaying work when using dynamic classloaders (whose identity will vary from run to run).
static ClassLoader getApplicationClassLoader()
           
static String getApplicationRepositories()
          Get list of places currently being searched for application classes and resources.
private static TypeReference getClassTypeRef(DataInputStream input, ClassLoader cl)
           
(package private) static boolean getDesiredAssertionStatus(RVMClass klass)
          Calculate the desired assertion status for a freshly loaded class
static void init(String bootstrapClasspath)
          Initialize for boot image writing
static void setApplicationRepositories(String classpath)
          Set list of places to be searched for application classes and resources.
static void stashApplicationRepositories(String classpath)
          Set list of places to be searched for application classes and resources.
static void stashDisableAssertionArg(String arg)
          Remember the given disable assertions string
static void stashEnableAssertionArg(String arg)
          Remember the given enable assertions string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DBG_APP_CL

private static final boolean DBG_APP_CL
See Also:
Constant Field Values

appCL

private static ClassLoader appCL

assertionsEnabled

private static boolean assertionsEnabled
Are Java 1.4 style assertions enabled?


enabledAssertionStrings

private static String[] enabledAssertionStrings
String describing packages and classes to enable assertions on (of the form ":...|:")


disabledAssertionStrings

private static String[] disabledAssertionStrings
String describing packages and classes to disable assertions on (of the form ":...|:")


gettingAppCL

private static int gettingAppCL
Are we getting the application CL? Access is synchronized via the Class object. Probably not necessary, but doesn't hurt, or shouldn't. Used for sanity checks.


appCLReady

private static boolean appCLReady
Is the application class loader ready for use? Don't leak it out until it is!


applicationRepositories

private static String applicationRepositories

StandardClassInitializerMethodName

public static final Atom StandardClassInitializerMethodName
<clinit>


StandardClassInitializerMethodDescriptor

public static final Atom StandardClassInitializerMethodDescriptor
"()V"


StandardObjectInitializerMethodName

public static final Atom StandardObjectInitializerMethodName
<init>


StandardObjectInitializerMethodDescriptor

public static final Atom StandardObjectInitializerMethodDescriptor
()V


StandardObjectInitializerHelperMethodName

public static final Atom StandardObjectInitializerHelperMethodName
this


StandardObjectFinalizerMethodName

public static final Atom StandardObjectFinalizerMethodName
finalize


StandardObjectFinalizerMethodDescriptor

public static final Atom StandardObjectFinalizerMethodDescriptor
()V


codeAttributeName

static final Atom codeAttributeName
Code


constantValueAttributeName

static final Atom constantValueAttributeName
ConstantValue


lineNumberTableAttributeName

static final Atom lineNumberTableAttributeName
LineNumberTable


exceptionsAttributeName

static final Atom exceptionsAttributeName
Exceptions


sourceFileAttributeName

static final Atom sourceFileAttributeName
SourceFile


localVariableTableAttributeName

static final Atom localVariableTableAttributeName
LocalVariableTable


deprecatedAttributeName

static final Atom deprecatedAttributeName
Deprecated


innerClassesAttributeName

static final Atom innerClassesAttributeName
InnerClasses


syntheticAttributeName

static final Atom syntheticAttributeName
Synthetic


enclosingMethodAttributeName

static final Atom enclosingMethodAttributeName
EnclosingMethod


signatureAttributeName

static final Atom signatureAttributeName
Signature


runtimeVisibleAnnotationsAttributeName

static final Atom runtimeVisibleAnnotationsAttributeName
RuntimeVisibleAnnotations


runtimeInvisibleAnnotationsAttributeName

static final Atom runtimeInvisibleAnnotationsAttributeName
RuntimeInvisibleAnnotations


runtimeVisibleParameterAnnotationsAttributeName

static final Atom runtimeVisibleParameterAnnotationsAttributeName
RuntimeVisibleParameterAnnotations


runtimeInvisibleParameterAnnotationsAttributeName

static final Atom runtimeInvisibleParameterAnnotationsAttributeName
RuntimeInvisibleParameterAnnotations


annotationDefaultAttributeName

static final Atom annotationDefaultAttributeName
AnnotationDefault

Constructor Detail

RVMClassLoader

public RVMClassLoader()
Method Detail

stashApplicationRepositories

public static void stashApplicationRepositories(String classpath)
Set list of places to be searched for application classes and resources. Do NOT set the java.class.path property; it is probably too early in the VM's booting cycle to set properties.

Parameters:
classpath - path specification in standard "classpath" format

stashEnableAssertionArg

public static void stashEnableAssertionArg(String arg)
Remember the given enable assertions string

Parameters:
arg - String of the form ":...|:"

stashDisableAssertionArg

public static void stashDisableAssertionArg(String arg)
Remember the given disable assertions string

Parameters:
arg - String of the form ":...|:"

getDesiredAssertionStatus

static boolean getDesiredAssertionStatus(RVMClass klass)
Calculate the desired assertion status for a freshly loaded class

Parameters:
klass - to check against command line argument
Returns:
whether assertions should be enabled on class

setApplicationRepositories

public static void setApplicationRepositories(String classpath)
Set list of places to be searched for application classes and resources.

Our Jikes RVM classloader can not handle having the class path reset after it's been set up. Unfortunately, it is stashed by classes in GNU Classpath.

Parameters:
classpath - path specification in standard "classpath" format

getApplicationRepositories

public static String getApplicationRepositories()
Get list of places currently being searched for application classes and resources.

Returns:
names of directories, .zip files, and .jar files

declareApplicationClassLoaderIsReady

public static void declareApplicationClassLoaderIsReady()

getApplicationClassLoader

public static ClassLoader getApplicationClassLoader()

boot

public static void boot()
Initialize at boot time.


init

public static void init(String bootstrapClasspath)
Initialize for boot image writing


defineClassInternal

public static RVMType defineClassInternal(String className,
                                          byte[] classRep,
                                          int offset,
                                          int length,
                                          ClassLoader classloader)
                                   throws ClassFormatError
Throws:
ClassFormatError

defineClassInternal

public static RVMType defineClassInternal(String className,
                                          InputStream is,
                                          ClassLoader classloader)
                                   throws ClassFormatError
Throws:
ClassFormatError

getClassTypeRef

private static TypeReference getClassTypeRef(DataInputStream input,
                                             ClassLoader cl)
                                      throws IOException,
                                             ClassFormatError
Throws:
IOException
ClassFormatError

findWorkableClassloader

public static ClassLoader findWorkableClassloader(Atom clazz)
An unpleasant hack to deal with the problem of replaying work when using dynamic classloaders (whose identity will vary from run to run). When we can't find the classloader that was specified, see if there are any other (non-matching) classloaders that have the relevant class loaded.

Parameters:
clazz - The class we're after
Returns:
A usable classloader or null