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();
}
}
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());
}
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);
}
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);
}
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;
}
Aggregations