Search in sources :

Example 6 with EspressoLock

use of com.oracle.truffle.espresso.blocking.EspressoLock in project graal by oracle.

the class EspressoReferenceDrainer method doWaitForReferencePendingList.

@TruffleBoundary
private void doWaitForReferencePendingList() {
    try {
        EspressoLock pLock = getLock();
        pLock.lock();
        try {
            // Wait until the reference drain updates the list.
            while (!hasReferencePendingList()) {
                pLock.await(0L);
            }
        } finally {
            pLock.unlock();
        }
    } catch (GuestInterruptedException e) {
    /*
             * The guest handler thread will attempt emptying the reference list by re-obtaining it.
             * If the list is not null, then everything will proceed as normal. In the case it is
             * empty, the guest handler will simply loop back into waiting. This looping back into
             * waiting done in guest code gives us a chance to reach an espresso safe point (a back
             * edge), thus giving us the possibility to stop this thread when tearing down the VM.
             */
    }
}
Also used : GuestInterruptedException(com.oracle.truffle.espresso.blocking.GuestInterruptedException) EspressoLock(com.oracle.truffle.espresso.blocking.EspressoLock) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)

Aggregations

EspressoLock (com.oracle.truffle.espresso.blocking.EspressoLock)6 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)1 TruffleLanguage (com.oracle.truffle.api.TruffleLanguage)1 GuestInterruptedException (com.oracle.truffle.espresso.blocking.GuestInterruptedException)1 SuppressFBWarnings (com.oracle.truffle.espresso.impl.SuppressFBWarnings)1 Meta (com.oracle.truffle.espresso.meta.Meta)1 EspressoReference (com.oracle.truffle.espresso.ref.EspressoReference)1 EspressoContext (com.oracle.truffle.espresso.runtime.EspressoContext)1