Search in sources :

Example 91 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 floats.
 *
 * @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(float[] src, int srcIdx, float[] 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) && FLOAT_BULK_COPY_SUPPORTED) {
            if (NEEDS_FLOAT_ASTORE_BARRIER || NEEDS_FLOAT_ALOAD_BARRIER) {
                Offset srcOffset = Offset.fromIntZeroExtend(srcIdx << LOG_BYTES_IN_FLOAT);
                Offset dstOffset = Offset.fromIntZeroExtend(dstIdx << LOG_BYTES_IN_FLOAT);
                Barriers.floatBulkCopy(src, srcOffset, dst, dstOffset, len << LOG_BYTES_IN_FLOAT);
            } else {
                Memory.arraycopy32Bit(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 92 with Inline

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

the class Barriers method putfieldStoreBarrierHelper.

/**
 * Private helper method for primitive putfields
 *
 * @param asm the assembler to generate the code in
 * @param compiler the compiler instance to ensure correct parameter passing
 * @param fieldOffset offset of the field
 * @param locationMetadata meta-data about the location
 * @param barrier the barrier method to call
 */
@Inline
private static void putfieldStoreBarrierHelper(Assembler asm, BaselineCompilerImpl compiler, Offset fieldOffset, int locationMetadata, NormalMethod barrier) {
    // on entry the java stack contains... |object|value|
    asm.emitPUSH_Imm(fieldOffset.toInt());
    asm.emitPUSH_Imm(locationMetadata);
    // Use the correct calling convention to pass parameters by register and the stack
    // (size of value varies by type of putfield)
    MethodReference method = barrier.getMemberRef().asMethodReference();
    compiler.genParameterRegisterLoad(method, false);
    genNullCheck(asm, T0);
    asm.generateJTOCcall(barrier.getOffset());
}
Also used : MethodReference(org.jikesrvm.classloader.MethodReference) Inline(org.vmmagic.pragma.Inline)

Example 93 with Inline

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

the class BaselineCompilerImpl method genNullCheck.

/**
 * Generate an explicit null check (compare to zero).
 *
 * @param asm the assembler to generate into
 * @param objRefReg the register containing the reference
 */
@Inline
private static void genNullCheck(Assembler asm, GPR objRefReg) {
    // compare to zero
    asm.emitTEST_Reg_Reg(objRefReg, objRefReg);
    // Jmp around trap if index is OK
    asm.emitBranchLikelyNextInstruction();
    ForwardReference fr = asm.forwardJcc(NE);
    // trap
    asm.emitINT_Imm(RuntimeEntrypoints.TRAP_NULL_POINTER + RVM_TRAP_BASE);
    fr.resolve(asm);
}
Also used : ForwardReference(org.jikesrvm.compilers.common.assembler.ForwardReference) Inline(org.vmmagic.pragma.Inline)

Example 94 with Inline

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

the class Barriers method booleanFieldWrite.

/**
 * Barrier for writes of booleans 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 booleanFieldWrite(Object ref, boolean value, Offset offset, int locationMetadata) {
    if (NEEDS_BOOLEAN_GC_WRITE_BARRIER) {
        ObjectReference src = ObjectReference.fromObject(ref);
        Selected.Mutator.get().booleanWrite(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 95 with Inline

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

the class Barriers method byteArrayRead.

/**
 * Barrier for loads of bytes from fields of arrays (i.e. baload).
 *
 * @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 byte byteArrayRead(byte[] ref, int index) {
    if (NEEDS_BYTE_GC_READ_BARRIER) {
        ObjectReference array = ObjectReference.fromObject(ref);
        Offset offset = Offset.fromIntZeroExtend(index);
        return Selected.Mutator.get().byteRead(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