use of org.vmmagic.pragma.Unpreemptible in project JikesRVM by JikesRVM.
the class ThinLock method inlineLock.
@Inline
@NoNullCheck
@Unpreemptible
@Entrypoint
public static void inlineLock(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)) {
Word changed = old.plus(TL_LOCK_COUNT_UNIT);
if (!changed.and(TL_LOCK_COUNT_MASK).isZero()) {
setDedicatedU16(o, lockOffset, changed);
Magic.combinedLoadBarrier();
return;
}
} else if (id.EQ(TL_STAT_THIN)) {
// lock is thin and not held by anyone
if (Magic.attemptWord(o, lockOffset, old, old.or(tid))) {
if (!VM.MagicAttemptImpliesStoreLoadBarrier)
Magic.fence();
return;
}
}
lock(o, lockOffset);
}
use of org.vmmagic.pragma.Unpreemptible in project JikesRVM by JikesRVM.
the class RVMThread method yieldpointFromEpilogue.
/**
* Yieldpoint taken in epilogue.
*/
@BaselineSaveLSRegisters
// Save all non-volatile registers in prologue
@NoOptCompile
@NoInline
// TODO fix this -- related to SaveVolatile
@Entrypoint
@Unpreemptible("Becoming another thread interrupts the current thread, avoid preemption in the process")
public static void yieldpointFromEpilogue() {
Address fp = Magic.getFramePointer();
yieldpoint(EPILOGUE, fp);
}
use of org.vmmagic.pragma.Unpreemptible in project JikesRVM by JikesRVM.
the class RVMThread method unblockAllMutatorsForGC.
/**
* Unblock all mutators blocked for GC.
*/
@NoCheckStore
@Unpreemptible
public static void unblockAllMutatorsForGC() {
RVMThread.handshakeLock.lockNoHandshake();
RVMThread.acctLock.lockNoHandshake();
int numToHandshake = 0;
for (int i = 0; i < RVMThread.numThreads; i++) {
RVMThread t = RVMThread.threads[i];
if (!t.isCollectorThread() && !t.ignoreHandshakesAndGC()) {
RVMThread.handshakeThreads[numToHandshake++] = t;
}
}
RVMThread.acctLock.unlock();
for (int i = 0; i < numToHandshake; i++) {
RVMThread.handshakeThreads[i].unblock(RVMThread.gcBlockAdapter);
// Help GC
RVMThread.handshakeThreads[i] = null;
}
RVMThread.handshakeLock.unlock();
}
use of org.vmmagic.pragma.Unpreemptible in project JikesRVM by JikesRVM.
the class Lock method unlockHeavy.
/**
* Releases this heavy-weight lock on the indicated object.
*
* @param o the object to be unlocked
*/
@Unpreemptible
public void unlockHeavy(Object o) {
boolean deflated = false;
// Note: thread switching is not allowed while mutex is held.
mutex.lock();
RVMThread me = RVMThread.getCurrentThread();
if (ownerId != me.getLockingId()) {
// thread-switching benign
mutex.unlock();
raiseIllegalMonitorStateException("heavy unlocking", o);
}
recursionCount--;
if (0 < recursionCount) {
// thread-switching benign
mutex.unlock();
return;
}
if (STATS)
unlockOperations++;
ownerId = 0;
RVMThread toAwaken = entering.dequeue();
if (toAwaken == null && entering.isEmpty() && waiting.isEmpty()) {
// heavy lock can be deflated
// Possible project: decide on a heuristic to control when lock should be deflated
Offset lockOffset = Magic.getObjectType(o).getThinLockOffset();
if (!lockOffset.isMax()) {
// deflate heavy lock
deflate(o, lockOffset);
deflated = true;
}
}
// does a Magic.sync(); (thread-switching benign)
mutex.unlock();
if (toAwaken != null) {
toAwaken.monitor().lockedBroadcastNoHandshake();
}
}
use of org.vmmagic.pragma.Unpreemptible in project JikesRVM by JikesRVM.
the class OnStackReplacementTrigger method trigger.
@NoInline
@Unpreemptible
public static void trigger(int ypTakenInCMID, Offset tsFromFPoff, Offset ypTakenFPoff, int whereFrom) {
RVMThread thread = RVMThread.getCurrentThread();
CompiledMethod ypTakenInCM = CompiledMethods.getCompiledMethod(ypTakenInCMID);
RVMMethod ypTakenInMethod = ypTakenInCM.getMethod();
boolean isInBootImage = ypTakenInMethod.getDeclaringClass().isInBootImage();
if (isInBootImage)
return;
OnStackReplacementEvent event = (OnStackReplacementEvent) thread.onStackReplacementEvent;
event.suspendedThread = thread;
event.whereFrom = whereFrom;
event.CMID = ypTakenInCMID;
event.tsFromFPoff = tsFromFPoff;
event.ypTakenFPoff = ypTakenFPoff;
thread.monitor().lockNoHandshake();
thread.requesting_osr = true;
thread.monitor().unlock();
Controller.osrOrganizer.activate();
// PNT: Assumes that OSR doesn't need access to our context regs
thread.monitor().lockNoHandshake();
while (!thread.osr_done) {
thread.monitor().waitWithHandshake();
}
thread.osr_done = false;
thread.monitor().unlock();
}
Aggregations