/* * Copyright (c) 2020, 2022, Oracle and/or its affiliates. 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. *
*/
staticvoid assert_epoch_identity(JavaThread* jt, u2 current_epoch) {
assert_precondition(jt); // Verify the epoch updates got written through also to the vthread object. const u2 epoch_raw = ThreadIdAccess::epoch(jt->vthread()); constbool excluded = epoch_raw & excluded_bit;
assert(!excluded, "invariant");
assert(!JfrThreadLocal::is_excluded(jt), "invariant"); const u2 vthread_epoch = epoch_raw & epoch_mask;
assert(vthread_epoch == current_epoch, "invariant");
} #endif// ASSERT
void* JfrIntrinsicSupport::write_checkpoint(JavaThread* jt) {
DEBUG_ONLY(assert_precondition(jt);)
assert(JfrThreadLocal::is_vthread(jt), "invariant"); const u2 vthread_thread_local_epoch = JfrThreadLocal::vthread_epoch(jt); const u2 current_epoch = ThreadIdAccess::current_epoch(); if (vthread_thread_local_epoch == current_epoch) { // After the epoch test in the intrinsic, the thread sampler interleaved // and suspended the thread. As part of taking a sample, it updated // the vthread object and the thread local "for us". We are good.
DEBUG_ONLY(assert_epoch_identity(jt, current_epoch);)
ThreadInVMfromJava transition(jt); return JfrJavaEventWriter::event_writer(jt);
} const traceid vthread_tid = JfrThreadLocal::vthread_id(jt); // Transition before reading the epoch generation anew, now as _thread_in_vm. Can safepoint here.
ThreadInVMfromJava transition(jt);
JfrThreadLocal::set_vthread_epoch(jt, vthread_tid, ThreadIdAccess::current_epoch()); return JfrJavaEventWriter::event_writer(jt);
}
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 und die Messung sind noch experimentell.