Search in sources :

Example 1 with RVMMember

use of org.jikesrvm.classloader.RVMMember in project JikesRVM by JikesRVM.

the class BootImageWriter method disableObjectAddressRemapper.

/**
 * Stop recording objects referenced by RVM classes during
 * loading/resolution/instantiation.
 */
private static void disableObjectAddressRemapper() {
    Magic.setObjectAddressRemapper(null);
    // Remove bootimage writer's remapper object that was present when JTOC
    // was populated with JDK objects. It's not part of the bootimage and we
    // don't want to see warning messages about it when the bootimage is
    // written.
    RVMMember remapper = Entrypoints.magicObjectRemapperField;
    Statics.setSlotContents(remapper.getOffset(), 0);
}
Also used : RVMMember(org.jikesrvm.classloader.RVMMember)

Example 2 with RVMMember

use of org.jikesrvm.classloader.RVMMember in project JikesRVM by JikesRVM.

the class EntrypointHelper method getMember.

/**
 * Get description of virtual machine component (field or method).
 * <p>
 * Note: This is method is intended for use only by VM classes that need
 * to address their own fields and methods in the runtime virtual machine
 * image.  It should not be used for general purpose class loading.
 * @param classDescriptor  class  descriptor - something like "Lorg/jikesrvm/RuntimeEntrypoints;"
 * @param memberName       member name       - something like "invokestatic"
 * @param memberDescriptor member descriptor - something like "()V"
 * @return corresponding RVMMember object
 */
private static RVMMember getMember(String classDescriptor, String memberName, String memberDescriptor) {
    Atom clsDescriptor = Atom.findOrCreateAsciiAtom(classDescriptor);
    Atom memName = Atom.findOrCreateAsciiAtom(memberName);
    Atom memDescriptor = Atom.findOrCreateAsciiAtom(memberDescriptor);
    try {
        TypeReference tRef = TypeReference.findOrCreate(BootstrapClassLoader.getBootstrapClassLoader(), clsDescriptor);
        RVMClass cls = (RVMClass) tRef.resolve();
        cls.resolve();
        RVMMember member;
        if ((member = cls.findDeclaredField(memName, memDescriptor)) != null) {
            verifyThatFieldIsNotFinal((RVMField) member);
            verifyPresenceOfEntrypointAnnotation(member);
            return member;
        }
        if ((member = cls.findDeclaredMethod(memName, memDescriptor)) != null) {
            verifyPresenceOfEntrypointAnnotation(member);
            return member;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    // The usual causes for getMember() to fail are:
    // 1. you mispelled the class name, member name, or member signature
    // 2. the class containing the specified member didn't get compiled
    // 
    VM.sysWriteln("Entrypoints.getMember: can't resolve class=" + classDescriptor + " member=" + memberName + " desc=" + memberDescriptor);
    if (VM.VerifyAssertions)
        VM._assert(VM.NOT_REACHED);
    return null;
}
Also used : RVMMember(org.jikesrvm.classloader.RVMMember) TypeReference(org.jikesrvm.classloader.TypeReference) Atom(org.jikesrvm.classloader.Atom) RVMClass(org.jikesrvm.classloader.RVMClass)

Aggregations

RVMMember (org.jikesrvm.classloader.RVMMember)2 Atom (org.jikesrvm.classloader.Atom)1 RVMClass (org.jikesrvm.classloader.RVMClass)1 TypeReference (org.jikesrvm.classloader.TypeReference)1