Search in sources :

Example 41 with NoInline

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

the class MemoryManager method allocateCode.

/**
 * Allocate a CodeArray into a code space.
 * Currently the interface is fairly primitive;
 * just the number of instructions in the code array and a boolean
 * to indicate hot or cold code.
 * @param numInstrs number of instructions
 * @param isHot is this a request for hot code space allocation?
 * @return The  array
 */
@NoInline
@Interruptible
public static CodeArray allocateCode(int numInstrs, boolean isHot) {
    RVMArray type = RVMType.CodeArrayType;
    int headerSize = ObjectModel.computeArrayHeaderSize(type);
    int align = ObjectModel.getAlignment(type);
    int offset = ObjectModel.getOffsetForAlignment(type, false);
    int width = type.getLogElementSize();
    TIB tib = type.getTypeInformationBlock();
    int allocator = isHot ? Plan.ALLOC_HOT_CODE : Plan.ALLOC_COLD_CODE;
    return (CodeArray) allocateArray(numInstrs, width, headerSize, tib, allocator, align, offset, Plan.DEFAULT_SITE);
}
Also used : CodeArray(org.jikesrvm.compilers.common.CodeArray) RVMArray(org.jikesrvm.classloader.RVMArray) TIB(org.jikesrvm.objectmodel.TIB) Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible) NoInline(org.vmmagic.pragma.NoInline)

Example 42 with NoInline

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

the class JavaHeader method installHashCode.

@NoInline
@Interruptible
protected static int installHashCode(Object o) {
    Word hashCode;
    do {
        hashCodeGenerator = hashCodeGenerator.plus(Word.one().lsh(HASH_CODE_SHIFT));
        hashCode = hashCodeGenerator.and(HASH_CODE_MASK);
    } while (hashCode.isZero());
    while (true) {
        Word statusWord = Magic.prepareWord(o, STATUS_OFFSET);
        if (!(statusWord.and(HASH_CODE_MASK).isZero())) {
            // some other thread installed a hashcode
            return statusWord.and(HASH_CODE_MASK).rshl(HASH_CODE_SHIFT).toInt();
        }
        if (Magic.attemptWord(o, STATUS_OFFSET, statusWord, statusWord.or(hashCode))) {
            // we installed the hash code
            return hashCode.rshl(HASH_CODE_SHIFT).toInt();
        }
    }
}
Also used : Word(org.vmmagic.unboxed.Word) Interruptible(org.vmmagic.pragma.Interruptible) NoInline(org.vmmagic.pragma.NoInline)

Example 43 with NoInline

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

the class TIB method initializeInternalLazyCompilationTrampoline.

/**
 * Initialize the lazy method invoker trampoline for this tib.
 */
@NoInline
public void initializeInternalLazyCompilationTrampoline() {
    CodeArray source = LazyCompilationTrampoline.getInstructions();
    int targetSlot = lazyMethodInvokerTrampolineIndex();
    int logIPW = LOG_BYTES_IN_ADDRESS - ArchConstants.getLogInstructionWidth();
    int logIPI = LOG_BYTES_IN_INT - ArchConstants.getLogInstructionWidth();
    if (VM.VerifyAssertions)
        VM._assert(ArchConstants.getLogInstructionWidth() <= LOG_BYTES_IN_INT);
    int mask = 0xFFFFFFFF >>> (((1 << logIPI) - 1) << LOG_BITS_IN_BYTE);
    for (int i = 0; i < lazyMethodInvokerTrampolineWords(); i++) {
        Word currentWord = Word.zero();
        int base = i << logIPW;
        for (int j = 0; j < (1 << logIPW) && (base + j) < source.length(); j++) {
            Word currentEntry = Word.fromIntZeroExtend(source.get(base + j) & mask);
            currentEntry = currentEntry.lsh(((VM.LittleEndian ? j : (1 << logIPW) - (j + 1)) << ArchConstants.getLogInstructionWidth()) << LOG_BITS_IN_BYTE);
            currentWord = currentWord.or(currentEntry);
        }
        set(targetSlot + i, currentWord);
    }
}
Also used : CodeArray(org.jikesrvm.compilers.common.CodeArray) Word(org.vmmagic.unboxed.Word) NoInline(org.vmmagic.pragma.NoInline)

Example 44 with NoInline

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

the class MemoryManager method newNonMovingWordArray.

/**
 * Allocates a non moving word array.
 *
 * @param size The size of the array
 * @return the new non moving word array
 */
@NoInline
@Interruptible
public static WordArray newNonMovingWordArray(int size) {
    if (!VM.runningVM) {
        return WordArray.create(size);
    }
    RVMArray arrayType = RVMType.WordArrayType;
    int headerSize = ObjectModel.computeArrayHeaderSize(arrayType);
    int align = ObjectModel.getAlignment(arrayType);
    int offset = ObjectModel.getOffsetForAlignment(arrayType, false);
    int width = arrayType.getLogElementSize();
    TIB arrayTib = arrayType.getTypeInformationBlock();
    return (WordArray) allocateArray(size, width, headerSize, arrayTib, Plan.ALLOC_NON_MOVING, align, offset, Plan.DEFAULT_SITE);
}
Also used : RVMArray(org.jikesrvm.classloader.RVMArray) WordArray(org.vmmagic.unboxed.WordArray) TIB(org.jikesrvm.objectmodel.TIB) Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible) NoInline(org.vmmagic.pragma.NoInline)

Example 45 with NoInline

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

the class MemoryManager method newNonMovingDoubleArray.

/**
 * Allocates a non moving double array.
 *
 * @param size The size of the array
 * @return the new non moving double array
 */
@NoInline
@Interruptible
public static double[] newNonMovingDoubleArray(int size) {
    if (!VM.runningVM) {
        return new double[size];
    }
    RVMArray arrayType = RVMArray.DoubleArray;
    int headerSize = ObjectModel.computeArrayHeaderSize(arrayType);
    int align = ObjectModel.getAlignment(arrayType);
    int offset = ObjectModel.getOffsetForAlignment(arrayType, false);
    int width = arrayType.getLogElementSize();
    TIB arrayTib = arrayType.getTypeInformationBlock();
    return (double[]) allocateArray(size, width, headerSize, arrayTib, Plan.ALLOC_NON_MOVING, align, offset, Plan.DEFAULT_SITE);
}
Also used : RVMArray(org.jikesrvm.classloader.RVMArray) TIB(org.jikesrvm.objectmodel.TIB) Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible) NoInline(org.vmmagic.pragma.NoInline)

Aggregations

NoInline (org.vmmagic.pragma.NoInline)46 Entrypoint (org.vmmagic.pragma.Entrypoint)23 Address (org.vmmagic.unboxed.Address)22 Unpreemptible (org.vmmagic.pragma.Unpreemptible)10 TIB (org.jikesrvm.objectmodel.TIB)9 Interruptible (org.vmmagic.pragma.Interruptible)9 RVMArray (org.jikesrvm.classloader.RVMArray)8 Word (org.vmmagic.unboxed.Word)6 NoOptCompile (org.vmmagic.pragma.NoOptCompile)5 Offset (org.vmmagic.unboxed.Offset)5 MethodReference (org.jikesrvm.classloader.MethodReference)4 CodeArray (org.jikesrvm.compilers.common.CodeArray)4 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)4 AbstractRegisters (org.jikesrvm.architecture.AbstractRegisters)3 RVMMethod (org.jikesrvm.classloader.RVMMethod)3 BaselineCompiledMethod (org.jikesrvm.compilers.baseline.BaselineCompiledMethod)3 OptCompiledMethod (org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod)3 BaselineSaveLSRegisters (org.vmmagic.pragma.BaselineSaveLSRegisters)3 RVMType (org.jikesrvm.classloader.RVMType)2 RVMThread (org.jikesrvm.scheduler.RVMThread)2