use of org.vmmagic.unboxed.Offset in project JikesRVM by JikesRVM.
the class BaselineCompilerImpl method genSynchronizedMethodPrologue.
// Emit code to acquire method synchronization lock.
//
private void genSynchronizedMethodPrologue() {
if (method.isStatic()) {
// put java.lang.Class object into T0
Offset klassOffset = Offset.fromIntSignExtend(Statics.findOrCreateObjectLiteral(klass.getClassForType()));
asm.emitLAddrToc(T0, klassOffset);
} else {
// first local is "this" pointer
copyByLocation(ADDRESS_TYPE, getGeneralLocalLocation(0), ADDRESS_TYPE, T0.value());
}
// call out...
asm.emitLAddrOffset(S0, JTOC, Entrypoints.lockMethod.getOffset());
// ...of line lock
asm.emitMTCTR(S0);
asm.emitBCCTRL();
// after this instruction, the method has the monitor
lockOffset = BYTES_IN_INT * (asm.getMachineCodeIndex() - 1);
}
use of org.vmmagic.unboxed.Offset in project JikesRVM by JikesRVM.
the class BaselineCompilerImpl method genSynchronizedMethodEpilogue.
// Emit code to release method synchronization lock.
//
private void genSynchronizedMethodEpilogue() {
if (method.isStatic()) {
// put java.lang.Class for RVMType into T0
Offset klassOffset = Offset.fromIntSignExtend(Statics.findOrCreateObjectLiteral(klass.getClassForType()));
asm.emitLAddrToc(T0, klassOffset);
} else {
// first local is "this" pointer
copyByLocation(ADDRESS_TYPE, getGeneralLocalLocation(0), ADDRESS_TYPE, T0.value());
}
// call out...
asm.emitLAddrOffset(S0, JTOC, Entrypoints.unlockMethod.getOffset());
// ...of line lock
asm.emitMTCTR(S0);
asm.emitBCCTRL();
}
use of org.vmmagic.unboxed.Offset in project JikesRVM by JikesRVM.
the class BaselineCompilerImpl method emit_resolved_invokestatic.
@Override
protected void emit_resolved_invokestatic(MethodReference methodRef) {
Offset methodOffset = methodRef.peekResolvedMethod().getOffset();
asm.emitLAddrToc(T0, methodOffset);
asm.emitMTCTR(T0);
genMoveParametersToRegisters(false, methodRef);
asm.emitBCCTRL();
genPopParametersAndPushReturnValue(false, methodRef);
}
use of org.vmmagic.unboxed.Offset in project JikesRVM by JikesRVM.
the class GenerationContext method getLockObject.
/**
* Get the object for locking for synchronized methods.
* either the class object or the this ptr.
*
* @return an operand for the appropriate lock object
*/
private Operand getLockObject() {
if (method.isStatic()) {
Class<?> klass = method.getDeclaringClass().getClassForType();
Offset offs = Offset.fromIntSignExtend(Statics.findOrCreateObjectLiteral(klass));
return new ClassConstantOperand(klass, offs);
} else {
return makeLocal(0, arguments[0].getType());
}
}
use of org.vmmagic.unboxed.Offset in project JikesRVM by JikesRVM.
the class RVMArray method arraycopyNoCheckcast.
/**
* Perform an array copy for arrays of objects where the possibility
* of an ArrayStoreException being thrown <i>does not</i> exist.
* This may be done using direct byte copies, <i>however</i>, write
* barriers must be explicitly invoked (if required by the GC) since
* the write barrier associated with an explicit array store
* (aastore) will be bypassed.
*
* @param src The source array
* @param srcIdx The starting source index
* @param dst The destination array
* @param dstIdx The starting source index
* @param len The number of array elements to be copied
*/
private static void arraycopyNoCheckcast(Object[] src, int srcIdx, Object[] dst, int dstIdx, int len) {
Offset srcOffset = Offset.fromIntZeroExtend(srcIdx << LOG_BYTES_IN_ADDRESS);
Offset dstOffset = Offset.fromIntZeroExtend(dstIdx << LOG_BYTES_IN_ADDRESS);
int bytes = len << LOG_BYTES_IN_ADDRESS;
if (((src != dst) || (srcIdx > dstIdx)) && OBJECT_BULK_COPY_SUPPORTED) {
if (NEEDS_OBJECT_ASTORE_BARRIER || NEEDS_OBJECT_ALOAD_BARRIER) {
Barriers.objectBulkCopy(src, srcOffset, dst, dstOffset, bytes);
} else {
Memory.alignedWordCopy(Magic.objectAsAddress(dst).plus(dstOffset), Magic.objectAsAddress(src).plus(srcOffset), bytes);
}
} else {
arraycopyPiecemealNoCheckcast(src, dst, len, srcOffset, dstOffset, bytes);
}
}
Aggregations