/* * Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
class AsyncExceptionHandshake : public AsyncHandshakeClosure {
OopHandle _exception; public:
AsyncExceptionHandshake(OopHandle& o, constchar* name = "AsyncExceptionHandshake")
: AsyncHandshakeClosure(name), _exception(o) { }
~AsyncExceptionHandshake() {
Thread* current = Thread::current(); // Can get here from the VMThread via install_async_exception() bail out. if (current->is_Java_thread()) {
guarantee(JavaThread::cast(current)->is_oop_safe(), "JavaThread cannot touch oops after its GC barrier is detached.");
}
assert(!_exception.is_empty(), "invariant");
_exception.release(Universe::vm_global());
}
inline JavaThread::NoAsyncExceptionDeliveryMark::NoAsyncExceptionDeliveryMark(JavaThread *t) : _target(t) {
assert(!_target->handshake_state()->async_exceptions_blocked(), "Nesting is not supported");
_target->handshake_state()->set_async_exceptions_blocked(true);
} inline JavaThread::NoAsyncExceptionDeliveryMark::~NoAsyncExceptionDeliveryMark() {
_target->handshake_state()->set_async_exceptions_blocked(false);
}
inline JavaThreadState JavaThread::thread_state() const { #ifdefined(PPC64) || defined (AARCH64) || defined(RISCV64) // Use membars when accessing volatile _thread_state. See // Threads::create_vm() for size checks. return Atomic::load_acquire(&_thread_state); #else return Atomic::load(&_thread_state); #endif
}
inlinevoid JavaThread::set_thread_state(JavaThreadState s) {
assert(current_or_null() == NULL || current_or_null() == this, "state change should only be called by the current thread"); #ifdefined(PPC64) || defined (AARCH64) || defined(RISCV64) // Use membars when accessing volatile _thread_state. See // Threads::create_vm() for size checks.
Atomic::release_store(&_thread_state, s); #else
Atomic::store(&_thread_state, s); #endif
}
const ContinuationEntry* JavaThread::vthread_continuation() const { for (ContinuationEntry* c = last_continuation(); c != nullptr; c = c->parent()) { if (c->is_virtual_thread()) return c;
} return nullptr;
}
void JavaThread::enter_critical() {
assert(Thread::current() == this ||
(Thread::current()->is_VM_thread() &&
SafepointSynchronize::is_synchronizing()), "this must be current thread or synchronizing");
_jni_active_critical++;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.