use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.
the class ThinLock method getLockIndex.
/**
* Return the lock index for a given lock word. Assert valid index
* ranges, that the fat lock bit is set, and that the lock entry
* exists.
*
* @param lockWord The lock word whose lock index is being established
* @return the lock index corresponding to the lock workd.
*/
@Inline
@Uninterruptible
public static int getLockIndex(Word lockWord) {
int index = lockWord.and(TL_LOCK_ID_MASK).rshl(TL_LOCK_ID_SHIFT).toInt();
if (VM.VerifyAssertions) {
if (!(index > 0 && index < Lock.numLocks())) {
VM.sysWriteln("Lock index out of range! Word: ", lockWord);
VM.sysWrite(" index: ", index);
VM.sysWrite(" locks: ", Lock.numLocks());
VM.sysWriteln();
}
// index is in range
VM._assert(index > 0 && index < Lock.numLocks());
// fat lock bit is set
VM._assert(lockWord.and(TL_STAT_MASK).EQ(TL_STAT_FAT));
}
return index;
}
use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.
the class ThinLock method inlineUnlock.
@Inline
@NoNullCheck
@Unpreemptible
@Entrypoint
public static void inlineUnlock(Object o, Offset lockOffset) {
// FIXME: bad for PPC?
Word old = Magic.prepareWord(o, lockOffset);
Word id = old.and(TL_THREAD_ID_MASK.or(TL_STAT_MASK));
Word tid = Word.fromIntSignExtend(RVMThread.getCurrentThread().getLockingId());
if (id.EQ(tid)) {
if (!old.and(TL_LOCK_COUNT_MASK).isZero()) {
setDedicatedU16(o, lockOffset, old.minus(TL_LOCK_COUNT_UNIT));
Magic.fence();
return;
}
} else if (old.xor(tid).rshl(TL_LOCK_COUNT_SHIFT).EQ(TL_STAT_THIN.rshl(TL_LOCK_COUNT_SHIFT))) {
Magic.combinedLoadBarrier();
if (Magic.attemptWord(o, lockOffset, old, old.and(TL_UNLOCK_MASK).or(TL_STAT_THIN))) {
if (!VM.MagicAttemptImpliesStoreLoadBarrier)
Magic.fence();
return;
}
}
unlock(o, lockOffset);
}
use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.
the class ObjectModel method copyScalar.
@Inline
private ObjectReference copyScalar(ObjectReference from, TIB tib, RVMClass type, int allocator) {
int bytes = org.jikesrvm.objectmodel.ObjectModel.bytesRequiredWhenCopied(from.toObject(), type);
int align = org.jikesrvm.objectmodel.ObjectModel.getAlignment(type, from.toObject());
int offset = org.jikesrvm.objectmodel.ObjectModel.getOffsetForAlignment(type, from);
CollectorContext context = VM.activePlan.collector();
allocator = context.copyCheckAllocator(from, bytes, align, allocator);
Address region = MemoryManager.allocateSpace(context, bytes, align, offset, allocator, from);
Object toObj = org.jikesrvm.objectmodel.ObjectModel.moveObject(region, from.toObject(), bytes, type);
ObjectReference to = ObjectReference.fromObject(toObj);
context.postCopy(to, ObjectReference.fromObject(tib), bytes, allocator);
return to;
}
use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.
the class ObjectModel method isAcyclic.
@Override
@Inline
public boolean isAcyclic(ObjectReference typeRef) {
TIB tib = Magic.addressAsTIB(typeRef.toAddress());
RVMType type = tib.getType();
return type.isAcyclicReference();
}
use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.
the class ObjectModel method copyArray.
@Inline
private ObjectReference copyArray(ObjectReference from, TIB tib, RVMArray type, int allocator) {
int elements = Magic.getArrayLength(from.toObject());
int bytes = org.jikesrvm.objectmodel.ObjectModel.bytesRequiredWhenCopied(from.toObject(), type, elements);
int align = org.jikesrvm.objectmodel.ObjectModel.getAlignment(type, from.toObject());
int offset = org.jikesrvm.objectmodel.ObjectModel.getOffsetForAlignment(type, from);
CollectorContext context = VM.activePlan.collector();
allocator = context.copyCheckAllocator(from, bytes, align, allocator);
Address region = MemoryManager.allocateSpace(context, bytes, align, offset, allocator, from);
Object toObj = org.jikesrvm.objectmodel.ObjectModel.moveObject(region, from.toObject(), bytes, type);
ObjectReference to = ObjectReference.fromObject(toObj);
context.postCopy(to, ObjectReference.fromObject(tib), bytes, allocator);
if (type == RVMType.CodeArrayType) {
// sync all moved code arrays to get icache and dcache in sync
// immediately.
int dataSize = bytes - org.jikesrvm.objectmodel.ObjectModel.computeHeaderSize(Magic.getObjectType(toObj));
org.jikesrvm.runtime.Memory.sync(to.toAddress(), dataSize);
}
return to;
}
Aggregations