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