Search in sources :

Example 1 with Inline

use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.

the class VM method enableGC.

/**
 * enableGC(): Re-Enable GC if we're popping off the last
 * possibly-recursive {@link #disableGC} request.  This enforces a stack discipline;
 * we need it for the JNI Get*Critical and Release*Critical functions.
 * Should be matched with a preceding call to {@link #disableGC}.
 *
 * @param recursiveOK unused (!)
 */
@Inline
public static void enableGC(boolean recursiveOK) {
    RVMThread myThread = RVMThread.getCurrentThread();
    int gcDepth = myThread.getDisableGCDepth();
    if (VM.VerifyAssertions) {
        VM._assert(gcDepth >= 1);
        VM._assert(myThread.getDisallowAllocationsByThisThread());
    }
    gcDepth--;
    myThread.setDisableGCDepth(gcDepth);
    if (gcDepth > 0) {
        return;
    }
    // Now the actual work of re-enabling GC.
    myThread.clearDisallowAllocationsByThisThread();
    myThread.enableYieldpoints();
}
Also used : RVMThread(org.jikesrvm.scheduler.RVMThread) Entrypoint(org.vmmagic.pragma.Entrypoint) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

Example 2 with Inline

use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.

the class Class method newInstance.

// --- newInstance ---
@Inline(value = Inline.When.ArgumentsAreConstant, arguments = { 0 })
public T newInstance() throws IllegalAccessException, InstantiationException, ExceptionInInitializerError, SecurityException {
    // Basic checks
    checkMemberAccess(Member.PUBLIC);
    if (!type.isClassType())
        throw new InstantiationException();
    RVMClass cls = type.asClass();
    if (cls.isAbstract() || cls.isInterface())
        throw new InstantiationException();
    // Ensure that the class is initialized
    if (!cls.isInitialized()) {
        RuntimeEntrypoints.initializeClassForDynamicLink(cls);
    }
    // Find the defaultConstructor
    RVMMethod defaultConstructor = getDefaultConstructor();
    if (defaultConstructor == null)
        throw new InstantiationException();
    // Check that caller is allowed to access it
    if (!defaultConstructor.isPublic()) {
        RVMClass accessingClass = RVMClass.getClassFromStackFrame(1);
        VMCommonLibrarySupport.checkAccess(defaultConstructor, accessingClass);
    }
    // Allocate an uninitialized instance;
    // yes, we're giving an anonymous object a type.
    @SuppressWarnings("unchecked") T obj = (T) RuntimeEntrypoints.resolvedNewScalar(cls);
    // Run the default constructor on the it.
    Reflection.invoke(defaultConstructor, null, obj, null, true);
    return obj;
}
Also used : RVMMethod(org.jikesrvm.classloader.RVMMethod) RVMClass(org.jikesrvm.classloader.RVMClass) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

Example 3 with Inline

use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.

the class Class method forName.

// --- ForName ---
@Inline
public static Class<?> forName(String typeName) throws ClassNotFoundException {
    throwNPEWhenNameIsNull(typeName);
    ClassLoader parentCL = RVMClass.getClassLoaderFromStackFrame(1);
    return forNameInternal(typeName, true, parentCL);
}
Also used : BootstrapClassLoader(org.jikesrvm.classloader.BootstrapClassLoader) RVMClassLoader(org.jikesrvm.classloader.RVMClassLoader) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

Example 4 with Inline

use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.

the class Barriers method byteFieldWrite.

/**
 * Barrier for writes of bytes into fields of instances (i.e. putfield).
 *
 * @param ref the object which is the subject of the putfield
 * @param value the new value for the field
 * @param offset the offset of the field to be modified
 * @param locationMetadata an int that encodes the source location being modified
 */
@Inline
@Entrypoint
public static void byteFieldWrite(Object ref, byte value, Offset offset, int locationMetadata) {
    if (NEEDS_BYTE_GC_WRITE_BARRIER) {
        ObjectReference src = ObjectReference.fromObject(ref);
        Selected.Mutator.get().byteWrite(src, src.toAddress().plus(offset), value, offset.toWord(), Word.fromIntZeroExtend(locationMetadata), INSTANCE_FIELD);
    } else if (VM.VerifyAssertions)
        VM._assert(VM.NOT_REACHED);
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) Entrypoint(org.vmmagic.pragma.Entrypoint) Inline(org.vmmagic.pragma.Inline)

Example 5 with Inline

use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.

the class Barriers method floatArrayRead.

/**
 * Barrier for loads of floats from fields of arrays (i.e. faload).
 *
 * @param ref the array containing the reference.
 * @param index the index into the array were the reference resides.
 * @return the value read from the array
 */
@Inline
@Entrypoint
public static float floatArrayRead(float[] ref, int index) {
    if (NEEDS_FLOAT_GC_READ_BARRIER) {
        ObjectReference array = ObjectReference.fromObject(ref);
        Offset offset = Offset.fromIntZeroExtend(index << LOG_BYTES_IN_FLOAT);
        return Selected.Mutator.get().floatRead(array, array.toAddress().plus(offset), offset.toWord(), Word.zero(), ARRAY_ELEMENT);
    } else if (VM.VerifyAssertions)
        VM._assert(VM.NOT_REACHED);
    return 0;
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) Offset(org.vmmagic.unboxed.Offset) Entrypoint(org.vmmagic.pragma.Entrypoint) Inline(org.vmmagic.pragma.Inline)

Aggregations

Inline (org.vmmagic.pragma.Inline)110 NoInline (org.vmmagic.pragma.NoInline)42 Entrypoint (org.vmmagic.pragma.Entrypoint)40 Offset (org.vmmagic.unboxed.Offset)38 ObjectReference (org.vmmagic.unboxed.ObjectReference)35 Address (org.vmmagic.unboxed.Address)15 Word (org.vmmagic.unboxed.Word)15 TypeReference (org.jikesrvm.classloader.TypeReference)12 Uninterruptible (org.vmmagic.pragma.Uninterruptible)6 RVMType (org.jikesrvm.classloader.RVMType)5 RVMClass (org.jikesrvm.classloader.RVMClass)4 Unpreemptible (org.vmmagic.pragma.Unpreemptible)4 RVMClassLoader (org.jikesrvm.classloader.RVMClassLoader)3 TIB (org.jikesrvm.objectmodel.TIB)3 Extent (org.vmmagic.unboxed.Extent)3 MethodReference (org.jikesrvm.classloader.MethodReference)2 ForwardReference (org.jikesrvm.compilers.common.assembler.ForwardReference)2 RVMThread (org.jikesrvm.scheduler.RVMThread)2 CollectorContext (org.mmtk.plan.CollectorContext)2 NoNullCheck (org.vmmagic.pragma.NoNullCheck)2