Search in sources :

Example 86 with Inline

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

the class ObjectModel method copy.

@Override
@Inline
public ObjectReference copy(ObjectReference from, int allocator) {
    TIB tib = org.jikesrvm.objectmodel.ObjectModel.getTIB(from);
    RVMType type = Magic.objectAsType(tib.getType());
    if (type.isClassType())
        return copyScalar(from, tib, type.asClass(), allocator);
    else
        return copyArray(from, tib, type.asArray(), allocator);
}
Also used : RVMType(org.jikesrvm.classloader.RVMType) TIB(org.jikesrvm.objectmodel.TIB) Inline(org.vmmagic.pragma.Inline)

Example 87 with Inline

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

the class ScanThread method processCodeLocation.

/**
 * Push a code pointer location onto the code locations deque,
 * optionally performing a sanity check first.<p>
 *
 * @param code The code object into which this interior pointer points
 * @param ipLoc The location of the pointer into this code object
 */
@Inline
private void processCodeLocation(ObjectReference code, Address ipLoc) {
    if (VALIDATE_REFS) {
        Address ip = ipLoc.loadAddress();
        Offset offset = ip.diff(code.toAddress());
        if (offset.sLT(Offset.zero()) || offset.sGT(Offset.fromIntZeroExtend(ObjectModel.getObjectSize(code)))) {
            Log.writeln("ERROR: Suspiciously large offset of interior pointer from object base");
            Log.writeln("       object base = ", code);
            Log.writeln("       interior reference = ", ip);
            Log.writeln("       offset = ", offset);
            Log.writeln("       interior ref loc = ", ipLoc);
            if (!failed)
                failed = true;
        }
    }
    trace.processInteriorEdge(code, ipLoc, true);
}
Also used : Address(org.vmmagic.unboxed.Address) Offset(org.vmmagic.unboxed.Offset) Inline(org.vmmagic.pragma.Inline)

Example 88 with Inline

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

the class RVMArray method arraycopy.

/**
 * Perform an array copy for arrays of doubles.
 *
 * @param src The source array
 * @param srcIdx The starting source index
 * @param dst The destination array
 * @param dstIdx The starting destination index
 * @param len The number of array elements to be copied
 */
@Inline(value = Inline.When.ArgumentsAreConstant, arguments = { 1, 3, 4 })
public static void arraycopy(double[] src, int srcIdx, double[] dst, int dstIdx, int len) {
    // are in error
    if (srcIdx >= 0 && dstIdx >= 0 && len >= 0 && (srcIdx + len) >= 0 && (srcIdx + len) <= src.length && (dstIdx + len) >= 0 && (dstIdx + len) <= dst.length) {
        if ((src != dst || srcIdx > dstIdx) && DOUBLE_BULK_COPY_SUPPORTED) {
            if (NEEDS_DOUBLE_ASTORE_BARRIER || NEEDS_DOUBLE_ALOAD_BARRIER) {
                Offset srcOffset = Offset.fromIntZeroExtend(srcIdx << LOG_BYTES_IN_DOUBLE);
                Offset dstOffset = Offset.fromIntZeroExtend(dstIdx << LOG_BYTES_IN_DOUBLE);
                Barriers.doubleBulkCopy(src, srcOffset, dst, dstOffset, len << LOG_BYTES_IN_DOUBLE);
            } else {
                Memory.arraycopy64Bit(src, srcIdx, dst, dstIdx, len);
            }
        } else {
            arraycopyPiecemeal(src, srcIdx, dst, dstIdx, len);
        }
    } else {
        failWithIndexOutOfBoundsException();
    }
}
Also used : Offset(org.vmmagic.unboxed.Offset) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

Example 89 with Inline

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

the class RVMArray method arraycopy.

/**
 * Perform an array copy for arrays of longs.
 *
 * @param src The source array
 * @param srcIdx The starting source index
 * @param dst The destination array
 * @param dstIdx The starting destination index
 * @param len The number of array elements to be copied
 */
@Inline(value = Inline.When.ArgumentsAreConstant, arguments = { 1, 3, 4 })
public static void arraycopy(long[] src, int srcIdx, long[] dst, int dstIdx, int len) {
    // are in error
    if (srcIdx >= 0 && dstIdx >= 0 && len >= 0 && (srcIdx + len) >= 0 && (srcIdx + len) <= src.length && (dstIdx + len) >= 0 && (dstIdx + len) <= dst.length) {
        if ((src != dst || srcIdx > dstIdx) && LONG_BULK_COPY_SUPPORTED) {
            if (NEEDS_LONG_ASTORE_BARRIER || NEEDS_LONG_ALOAD_BARRIER) {
                Offset srcOffset = Offset.fromIntZeroExtend(srcIdx << LOG_BYTES_IN_LONG);
                Offset dstOffset = Offset.fromIntZeroExtend(dstIdx << LOG_BYTES_IN_LONG);
                Barriers.longBulkCopy(src, srcOffset, dst, dstOffset, len << LOG_BYTES_IN_LONG);
            } else {
                Memory.arraycopy64Bit(src, srcIdx, dst, dstIdx, len);
            }
        } else {
            arraycopyPiecemeal(src, srcIdx, dst, dstIdx, len);
        }
    } else {
        failWithIndexOutOfBoundsException();
    }
}
Also used : Offset(org.vmmagic.unboxed.Offset) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

Example 90 with Inline

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

the class RVMArray method arraycopy.

/**
 * Perform an array copy for arrays of booleans.
 *
 * @param src The source array
 * @param srcIdx The starting source index
 * @param dst The destination array
 * @param dstIdx The starting destination index
 * @param len The number of array elements to be copied
 */
@Inline(value = Inline.When.ArgumentsAreConstant, arguments = { 1, 3, 4 })
public static void arraycopy(boolean[] src, int srcIdx, boolean[] dst, int dstIdx, int len) {
    // are in error
    if (srcIdx >= 0 && dstIdx >= 0 && len >= 0 && (srcIdx + len) >= 0 && (srcIdx + len) <= src.length && (dstIdx + len) >= 0 && (dstIdx + len) <= dst.length) {
        if ((src != dst || srcIdx >= (dstIdx + BYTES_IN_ADDRESS / BYTES_IN_BOOLEAN)) && BOOLEAN_BULK_COPY_SUPPORTED) {
            if (NEEDS_BOOLEAN_ASTORE_BARRIER || NEEDS_BOOLEAN_ALOAD_BARRIER) {
                Offset srcOffset = Offset.fromIntZeroExtend(srcIdx << LOG_BYTES_IN_BOOLEAN);
                Offset dstOffset = Offset.fromIntZeroExtend(dstIdx << LOG_BYTES_IN_BOOLEAN);
                Barriers.booleanBulkCopy(src, srcOffset, dst, dstOffset, len);
            } else {
                Memory.arraycopy8Bit(src, srcIdx, dst, dstIdx, len);
            }
        } else {
            arraycopyPiecemeal(src, srcIdx, dst, dstIdx, len);
        }
    } else {
        failWithIndexOutOfBoundsException();
    }
}
Also used : Offset(org.vmmagic.unboxed.Offset) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

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