8341481: [perf] vframeStreamCommon constructor may be optimized

Reviewed-by: sspitsyn
This commit is contained in:
Vladimir Ivanov 2024-12-17 17:00:53 +00:00 committed by Derek White
parent 390b20537d
commit 4f44cf6bf2
5 changed files with 30 additions and 20 deletions

View File

@ -163,10 +163,10 @@ static RegisterMap::WalkContinuation walk_continuation(JavaThread* jt) {
}
JfrVframeStream::JfrVframeStream(JavaThread* jt, const frame& fr, bool stop_at_java_call_stub, bool async_mode) :
vframeStreamCommon(RegisterMap(jt,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::skip,
walk_continuation(jt))),
vframeStreamCommon(jt,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::skip,
walk_continuation(jt)),
_vthread(JfrThreadLocal::is_vthread(jt)),
_cont_entry(_vthread ? jt->last_continuation() : nullptr),
_async_mode(async_mode) {

View File

@ -92,10 +92,10 @@ static bool is_decipherable_interpreted_frame(JavaThread* thread,
vframeStreamForte::vframeStreamForte(JavaThread *jt,
frame fr,
bool stop_at_java_call_stub)
: vframeStreamCommon(RegisterMap(jt,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::skip,
RegisterMap::WalkContinuation::skip)) {
: vframeStreamCommon(jt,
RegisterMap::UpdateMap::skip,
RegisterMap::ProcessFrames::skip,
RegisterMap::WalkContinuation::skip) {
_reg_map.set_async(true);
_stop_at_java_call_stub = stop_at_java_call_stub;
_frame = fr;

View File

@ -94,10 +94,11 @@ vframe* vframe::new_vframe(const frame* f, const RegisterMap* reg_map, JavaThrea
}
vframe* vframe::sender() const {
RegisterMap temp_map = *register_map();
assert(is_top(), "just checking");
if (_fr.is_empty()) return nullptr;
if (_fr.is_entry_frame() && _fr.is_first_frame()) return nullptr;
RegisterMap temp_map = *register_map();
frame s = _fr.real_sender(&temp_map);
if (s.is_first_frame()) return nullptr;
return vframe::new_vframe(&s, &temp_map, thread());
@ -493,10 +494,10 @@ void vframeStreamCommon::found_bad_method_frame() const {
#endif
vframeStream::vframeStream(JavaThread* thread, Handle continuation_scope, bool stop_at_java_call_stub)
: vframeStreamCommon(RegisterMap(thread,
RegisterMap::UpdateMap::include,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::include)) {
: vframeStreamCommon(thread,
RegisterMap::UpdateMap::include,
RegisterMap::ProcessFrames::include,
RegisterMap::WalkContinuation::include) {
_stop_at_java_call_stub = stop_at_java_call_stub;
_continuation_scope = continuation_scope;
@ -514,7 +515,7 @@ vframeStream::vframeStream(JavaThread* thread, Handle continuation_scope, bool s
}
vframeStream::vframeStream(oop continuation, Handle continuation_scope)
: vframeStreamCommon(RegisterMap(continuation, RegisterMap::UpdateMap::include)) {
: vframeStreamCommon(continuation) {
_stop_at_java_call_stub = false;
_continuation_scope = continuation_scope;
@ -530,6 +531,10 @@ vframeStream::vframeStream(oop continuation, Handle continuation_scope)
}
}
vframeStreamCommon::vframeStreamCommon(oop continuation)
: _reg_map(continuation, RegisterMap::UpdateMap::include), _cont_entry(nullptr) {
_thread = _reg_map.thread();
}
// Step back n frames, skip any pseudo frames in between.
// This function is used in Class.forName, Class.newInstance, and Method.Invoke.

View File

@ -281,7 +281,8 @@ class vframeStreamCommon : StackObj {
public:
// Constructor
inline vframeStreamCommon(RegisterMap reg_map);
inline vframeStreamCommon(JavaThread* thread, RegisterMap::UpdateMap update_map, RegisterMap::ProcessFrames process_frames, RegisterMap::WalkContinuation walk_cont);
vframeStreamCommon(oop continuation);
// Accessors
Method* method() const { return _method; }

View File

@ -34,7 +34,11 @@
#include "runtime/handles.inline.hpp"
#include "runtime/javaThread.inline.hpp"
inline vframeStreamCommon::vframeStreamCommon(RegisterMap reg_map) : _reg_map(reg_map), _cont_entry(nullptr) {
inline vframeStreamCommon::vframeStreamCommon(JavaThread* thread,
RegisterMap::UpdateMap update_map,
RegisterMap::ProcessFrames process_frames,
RegisterMap::WalkContinuation walk_cont)
: _reg_map(thread, update_map, process_frames, walk_cont), _cont_entry(nullptr) {
_thread = _reg_map.thread();
}
@ -109,10 +113,10 @@ inline void vframeStreamCommon::next() {
}
inline vframeStream::vframeStream(JavaThread* thread, bool stop_at_java_call_stub, bool process_frame, bool vthread_carrier)
: vframeStreamCommon(RegisterMap(thread,
RegisterMap::UpdateMap::include,
process_frame ? RegisterMap::ProcessFrames::include : RegisterMap::ProcessFrames::skip ,
RegisterMap::WalkContinuation::include)) {
: vframeStreamCommon(thread,
RegisterMap::UpdateMap::include,
process_frame ? RegisterMap::ProcessFrames::include : RegisterMap::ProcessFrames::skip ,
RegisterMap::WalkContinuation::include) {
_stop_at_java_call_stub = stop_at_java_call_stub;
if (!thread->has_last_Java_frame()) {