Search in sources :

Example 96 with Offset

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);
}
Also used : Offset(org.vmmagic.unboxed.Offset)

Example 97 with Offset

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();
}
Also used : Offset(org.vmmagic.unboxed.Offset)

Example 98 with Offset

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);
}
Also used : Offset(org.vmmagic.unboxed.Offset)

Example 99 with Offset

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());
    }
}
Also used : ClassConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ClassConstantOperand) Offset(org.vmmagic.unboxed.Offset)

Example 100 with Offset

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);
    }
}
Also used : Entrypoint(org.vmmagic.pragma.Entrypoint) Offset(org.vmmagic.unboxed.Offset)

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