Search in sources :

Example 21 with Offset

use of org.vmmagic.unboxed.Offset in project JikesRVM by JikesRVM.

the class Barriers method intArrayRead.

/**
 * Barrier for loads of ints from fields of arrays (i.e. iaload).
 *
 * @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 int intArrayRead(int[] ref, int index) {
    if (NEEDS_INT_GC_READ_BARRIER) {
        ObjectReference array = ObjectReference.fromObject(ref);
        Offset offset = Offset.fromIntZeroExtend(index << LOG_BYTES_IN_INT);
        return Selected.Mutator.get().intRead(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)

Example 22 with Offset

use of org.vmmagic.unboxed.Offset in project JikesRVM by JikesRVM.

the class Barriers method longArrayRead.

/**
 * Barrier for loads of longs from fields of arrays (i.e. laload).
 *
 * @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 long longArrayRead(long[] ref, int index) {
    if (NEEDS_LONG_GC_READ_BARRIER) {
        ObjectReference array = ObjectReference.fromObject(ref);
        Offset offset = Offset.fromIntZeroExtend(index << LOG_BYTES_IN_LONG);
        return Selected.Mutator.get().longRead(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)

Example 23 with Offset

use of org.vmmagic.unboxed.Offset in project JikesRVM by JikesRVM.

the class Barriers method doubleArrayWrite.

/**
 * Barrier for writes of doubles into arrays (i.e. dastore).
 *
 * @param ref the array which is the subject of the astore
 * @param index the index into the array where the new reference
 * resides.  The index is the "natural" index into the array, for
 * example a[index].
 * @param value the value to be stored.
 */
@Inline
@Entrypoint
public static void doubleArrayWrite(double[] ref, int index, double value) {
    if (NEEDS_DOUBLE_GC_WRITE_BARRIER) {
        ObjectReference array = ObjectReference.fromObject(ref);
        Offset offset = Offset.fromIntZeroExtend(index << LOG_BYTES_IN_DOUBLE);
        Selected.Mutator.get().doubleWrite(array, array.toAddress().plus(offset), value, offset.toWord(), Word.zero(), ARRAY_ELEMENT);
    } else if (VM.VerifyAssertions)
        VM._assert(VM.NOT_REACHED);
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) Offset(org.vmmagic.unboxed.Offset) Entrypoint(org.vmmagic.pragma.Entrypoint) Inline(org.vmmagic.pragma.Inline)

Example 24 with Offset

use of org.vmmagic.unboxed.Offset in project JikesRVM by JikesRVM.

the class Barriers method booleanArrayWrite.

/**
 * Barrier for writes of booleans into arrays (i.e. bastore).
 *
 * @param ref the array which is the subject of the astore
 * @param index the index into the array where the new reference
 * resides.  The index is the "natural" index into the array, for
 * example a[index].
 * @param value the value to be stored.
 */
@Inline
@Entrypoint
public static void booleanArrayWrite(boolean[] ref, int index, boolean value) {
    if (NEEDS_BOOLEAN_GC_WRITE_BARRIER) {
        ObjectReference array = ObjectReference.fromObject(ref);
        Offset offset = Offset.fromIntZeroExtend(index << LOG_BYTES_IN_BOOLEAN);
        Selected.Mutator.get().booleanWrite(array, array.toAddress().plus(offset), value, offset.toWord(), Word.zero(), ARRAY_ELEMENT);
    } else if (VM.VerifyAssertions)
        VM._assert(VM.NOT_REACHED);
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) Offset(org.vmmagic.unboxed.Offset) Entrypoint(org.vmmagic.pragma.Entrypoint) Inline(org.vmmagic.pragma.Inline)

Example 25 with Offset

use of org.vmmagic.unboxed.Offset in project JikesRVM by JikesRVM.

the class Barriers method intArrayWrite.

/**
 * Barrier for writes of ints into arrays (i.e. iastore).
 *
 * @param ref the array which is the subject of the astore
 * @param index the index into the array where the new reference
 * resides.  The index is the "natural" index into the array, for
 * example a[index].
 * @param value the value to be stored.
 */
@Inline
@Entrypoint
public static void intArrayWrite(int[] ref, int index, int value) {
    if (NEEDS_INT_GC_WRITE_BARRIER) {
        ObjectReference array = ObjectReference.fromObject(ref);
        Offset offset = Offset.fromIntZeroExtend(index << LOG_BYTES_IN_INT);
        Selected.Mutator.get().intWrite(array, array.toAddress().plus(offset), value, offset.toWord(), Word.zero(), ARRAY_ELEMENT);
    } else if (VM.VerifyAssertions)
        VM._assert(VM.NOT_REACHED);
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) Offset(org.vmmagic.unboxed.Offset) Entrypoint(org.vmmagic.pragma.Entrypoint) Inline(org.vmmagic.pragma.Inline)

Aggregations

Offset (org.vmmagic.unboxed.Offset)215 Address (org.vmmagic.unboxed.Address)48 Inline (org.vmmagic.pragma.Inline)38 Entrypoint (org.vmmagic.pragma.Entrypoint)32 ObjectReference (org.vmmagic.unboxed.ObjectReference)21 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)20 TypeReference (org.jikesrvm.classloader.TypeReference)17 RVMField (org.jikesrvm.classloader.RVMField)14 ForwardReference (org.jikesrvm.compilers.common.assembler.ForwardReference)13 OptCompiledMethod (org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod)13 NoInline (org.vmmagic.pragma.NoInline)13 RVMMethod (org.jikesrvm.classloader.RVMMethod)11 RegisterOperand (org.jikesrvm.compilers.opt.ir.operand.RegisterOperand)10 Word (org.vmmagic.unboxed.Word)10 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)9 IntConstantOperand (org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand)9 RVMType (org.jikesrvm.classloader.RVMType)8 Register (org.jikesrvm.compilers.opt.ir.Register)8 RVMClass (org.jikesrvm.classloader.RVMClass)7 Operand (org.jikesrvm.compilers.opt.ir.operand.Operand)7