Search in sources :

Example 61 with Word

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

the class JavaHeader method setAvailableBit.

/**
 * Sets argument bit to 1 if value is true, 0 if value is false
 *
 * @param o the object whose bit will be set
 * @param idx the index in the bits
 * @param flag {@code true} for 1, {@code false} for 0
 */
public static void setAvailableBit(Object o, int idx, boolean flag) {
    Word status = Magic.getWordAtOffset(o, STATUS_OFFSET);
    if (flag) {
        Word mask = Word.fromIntSignExtend(1 << idx);
        Magic.setWordAtOffset(o, STATUS_OFFSET, status.or(mask));
    } else {
        Word mask = Word.fromIntSignExtend(1 << idx).not();
        Magic.setWordAtOffset(o, STATUS_OFFSET, status.and(mask));
    }
}
Also used : Word(org.vmmagic.unboxed.Word)

Example 62 with Word

use of org.vmmagic.unboxed.Word 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)

Aggregations

Word (org.vmmagic.unboxed.Word)62 Inline (org.vmmagic.pragma.Inline)15 Address (org.vmmagic.unboxed.Address)14 NoInline (org.vmmagic.pragma.NoInline)11 Offset (org.vmmagic.unboxed.Offset)10 AddressConstantOperand (org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand)8 BranchProfileOperand (org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand)8 CodeConstantOperand (org.jikesrvm.compilers.opt.ir.operand.CodeConstantOperand)8 ConditionOperand (org.jikesrvm.compilers.opt.ir.operand.ConditionOperand)8 ConstantOperand (org.jikesrvm.compilers.opt.ir.operand.ConstantOperand)8 IntConstantOperand (org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand)8 LongConstantOperand (org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand)8 MethodOperand (org.jikesrvm.compilers.opt.ir.operand.MethodOperand)8 NullConstantOperand (org.jikesrvm.compilers.opt.ir.operand.NullConstantOperand)8 ObjectConstantOperand (org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand)8 Operand (org.jikesrvm.compilers.opt.ir.operand.Operand)8 RegisterOperand (org.jikesrvm.compilers.opt.ir.operand.RegisterOperand)8 TIBConstantOperand (org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand)8 TrapCodeOperand (org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand)8 TrueGuardOperand (org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand)8