From 016cc4f333d1a59a7cd534cb7ee4c373087efd10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gr=C3=B6nlund?= Date: Wed, 28 May 2025 13:51:24 +0000 Subject: [PATCH] 8357830: JfrVframeStream::_cont_entry shadows super-class field Reviewed-by: egahlin --- .../recorder/stacktrace/jfrVframeStream.cpp | 55 ------------------- .../recorder/stacktrace/jfrVframeStream.hpp | 4 +- .../stacktrace/jfrVframeStream.inline.hpp | 34 ++++++++++++ 3 files changed, 36 insertions(+), 57 deletions(-) delete mode 100644 src/hotspot/share/jfr/recorder/stacktrace/jfrVframeStream.cpp diff --git a/src/hotspot/share/jfr/recorder/stacktrace/jfrVframeStream.cpp b/src/hotspot/share/jfr/recorder/stacktrace/jfrVframeStream.cpp deleted file mode 100644 index 22f103959cc..00000000000 --- a/src/hotspot/share/jfr/recorder/stacktrace/jfrVframeStream.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2011, 2025, 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. - * - */ - -#include "jfr/recorder/stacktrace/jfrVframeStream.inline.hpp" -#include "runtime/javaThread.inline.hpp" -#include "runtime/registerMap.hpp" -#include "runtime/stackWatermarkSet.inline.hpp" - -static inline RegisterMap::WalkContinuation walk_continuation(JavaThread* jt) { - // NOTE: WalkContinuation::skip, because of interactions with ZGC relocation - // and load barriers. This code is run while generating stack traces for - // the ZPage allocation event, even when ZGC is relocating objects. - // When ZGC is relocating, it is forbidden to run code that performs - // load barriers. With WalkContinuation::include, we visit heap stack - // chunks and could be using load barriers. - // - // NOTE: Shenandoah GC also seems to require this check - actual details as to why - // is unknown but to be filled in by others. - return ((UseZGC || UseShenandoahGC) && !StackWatermarkSet::processing_started(jt)) - ? RegisterMap::WalkContinuation::skip - : RegisterMap::WalkContinuation::include; -} - -JfrVframeStream::JfrVframeStream(JavaThread* jt, const frame& fr, bool in_continuation, bool stop_at_java_call_stub) : - vframeStreamCommon(jt, RegisterMap::UpdateMap::skip, RegisterMap::ProcessFrames::skip, walk_continuation(jt)), - _vthread(in_continuation), _cont_entry(_vthread ? jt->last_continuation() : nullptr) { - assert(!_vthread || JfrThreadLocal::is_vthread(jt), "invariant"); - assert(!_vthread || _cont_entry != nullptr, "invariant"); - _frame = fr; - _stop_at_java_call_stub = stop_at_java_call_stub; - while (!fill_from_frame()) { - _frame = _frame.sender(&_reg_map); - } -} diff --git a/src/hotspot/share/jfr/recorder/stacktrace/jfrVframeStream.hpp b/src/hotspot/share/jfr/recorder/stacktrace/jfrVframeStream.hpp index 32910739f4d..5da1a90db4e 100644 --- a/src/hotspot/share/jfr/recorder/stacktrace/jfrVframeStream.hpp +++ b/src/hotspot/share/jfr/recorder/stacktrace/jfrVframeStream.hpp @@ -30,9 +30,9 @@ class JfrVframeStream : public vframeStreamCommon { private: bool _vthread; - const ContinuationEntry* _cont_entry; - void step_to_sender(); + void next_frame(); + static RegisterMap::WalkContinuation walk_continuation(JavaThread* jt); public: JfrVframeStream(JavaThread* jt, const frame& fr, bool in_continuation, bool stop_at_java_call_stub); void next_vframe(); diff --git a/src/hotspot/share/jfr/recorder/stacktrace/jfrVframeStream.inline.hpp b/src/hotspot/share/jfr/recorder/stacktrace/jfrVframeStream.inline.hpp index 1f8b75e57ce..8495c7172c7 100644 --- a/src/hotspot/share/jfr/recorder/stacktrace/jfrVframeStream.inline.hpp +++ b/src/hotspot/share/jfr/recorder/stacktrace/jfrVframeStream.inline.hpp @@ -26,9 +26,43 @@ #define SHARE_JFR_RECORDER_STACKTRACE_JFRVFRAMESTREAM_INLINE_HPP #include "jfr/recorder/stacktrace/jfrVframeStream.hpp" + #include "runtime/continuationEntry.inline.hpp" +#include "runtime/javaThread.hpp" +#include "runtime/registerMap.hpp" +#include "runtime/stackWatermarkSet.inline.hpp" #include "runtime/vframe.inline.hpp" +inline RegisterMap::WalkContinuation JfrVframeStream::walk_continuation(JavaThread* jt) { + // NOTE: WalkContinuation::skip, because of interactions with ZGC relocation + // and load barriers. This code is run while generating stack traces for + // the ZPage allocation event, even when ZGC is relocating objects. + // When ZGC is relocating, it is forbidden to run code that performs + // load barriers. With WalkContinuation::include, we visit heap stack + // chunks and could be using load barriers. + // + // NOTE: Shenandoah GC also seems to require this check - actual details as to why + // is unknown but to be filled in by others. + return ((UseZGC || UseShenandoahGC) && !StackWatermarkSet::processing_started(jt)) + ? RegisterMap::WalkContinuation::skip + : RegisterMap::WalkContinuation::include; +} + +inline JfrVframeStream::JfrVframeStream(JavaThread* jt, const frame& fr, bool in_continuation, bool stop_at_java_call_stub) : + vframeStreamCommon(jt, RegisterMap::UpdateMap::skip, RegisterMap::ProcessFrames::skip, walk_continuation(jt)), + _vthread(in_continuation) { + assert(!_vthread || JfrThreadLocal::is_vthread(jt), "invariant"); + if (in_continuation) { + _cont_entry = jt->last_continuation(); + assert(_cont_entry != nullptr, "invariant"); + } + _frame = fr; + _stop_at_java_call_stub = stop_at_java_call_stub; + while (!fill_from_frame()) { + _frame = _frame.sender(&_reg_map); + } +} + inline void JfrVframeStream::next_frame() { do { if (_vthread && Continuation::is_continuation_enterSpecial(_frame)) {