Skip to content

Commit 4f44cf6

Browse files
Vladimir IvanovDerek White
Vladimir Ivanov
authored and
Derek White
committed
8341481: [perf] vframeStreamCommon constructor may be optimized
Reviewed-by: sspitsyn
1 parent 390b205 commit 4f44cf6

File tree

5 files changed

+30
-20
lines changed

5 files changed

+30
-20
lines changed

src/hotspot/share/jfr/recorder/stacktrace/jfrStackTrace.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ static RegisterMap::WalkContinuation walk_continuation(JavaThread* jt) {
163163
}
164164

165165
JfrVframeStream::JfrVframeStream(JavaThread* jt, const frame& fr, bool stop_at_java_call_stub, bool async_mode) :
166-
vframeStreamCommon(RegisterMap(jt,
167-
RegisterMap::UpdateMap::skip,
168-
RegisterMap::ProcessFrames::skip,
169-
walk_continuation(jt))),
166+
vframeStreamCommon(jt,
167+
RegisterMap::UpdateMap::skip,
168+
RegisterMap::ProcessFrames::skip,
169+
walk_continuation(jt)),
170170
_vthread(JfrThreadLocal::is_vthread(jt)),
171171
_cont_entry(_vthread ? jt->last_continuation() : nullptr),
172172
_async_mode(async_mode) {

src/hotspot/share/prims/forte.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ static bool is_decipherable_interpreted_frame(JavaThread* thread,
9292
vframeStreamForte::vframeStreamForte(JavaThread *jt,
9393
frame fr,
9494
bool stop_at_java_call_stub)
95-
: vframeStreamCommon(RegisterMap(jt,
96-
RegisterMap::UpdateMap::skip,
97-
RegisterMap::ProcessFrames::skip,
98-
RegisterMap::WalkContinuation::skip)) {
95+
: vframeStreamCommon(jt,
96+
RegisterMap::UpdateMap::skip,
97+
RegisterMap::ProcessFrames::skip,
98+
RegisterMap::WalkContinuation::skip) {
9999
_reg_map.set_async(true);
100100
_stop_at_java_call_stub = stop_at_java_call_stub;
101101
_frame = fr;

src/hotspot/share/runtime/vframe.cpp

+11-6
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,11 @@ vframe* vframe::new_vframe(const frame* f, const RegisterMap* reg_map, JavaThrea
9494
}
9595

9696
vframe* vframe::sender() const {
97-
RegisterMap temp_map = *register_map();
9897
assert(is_top(), "just checking");
9998
if (_fr.is_empty()) return nullptr;
10099
if (_fr.is_entry_frame() && _fr.is_first_frame()) return nullptr;
100+
101+
RegisterMap temp_map = *register_map();
101102
frame s = _fr.real_sender(&temp_map);
102103
if (s.is_first_frame()) return nullptr;
103104
return vframe::new_vframe(&s, &temp_map, thread());
@@ -493,10 +494,10 @@ void vframeStreamCommon::found_bad_method_frame() const {
493494
#endif
494495

495496
vframeStream::vframeStream(JavaThread* thread, Handle continuation_scope, bool stop_at_java_call_stub)
496-
: vframeStreamCommon(RegisterMap(thread,
497-
RegisterMap::UpdateMap::include,
498-
RegisterMap::ProcessFrames::include,
499-
RegisterMap::WalkContinuation::include)) {
497+
: vframeStreamCommon(thread,
498+
RegisterMap::UpdateMap::include,
499+
RegisterMap::ProcessFrames::include,
500+
RegisterMap::WalkContinuation::include) {
500501

501502
_stop_at_java_call_stub = stop_at_java_call_stub;
502503
_continuation_scope = continuation_scope;
@@ -514,7 +515,7 @@ vframeStream::vframeStream(JavaThread* thread, Handle continuation_scope, bool s
514515
}
515516

516517
vframeStream::vframeStream(oop continuation, Handle continuation_scope)
517-
: vframeStreamCommon(RegisterMap(continuation, RegisterMap::UpdateMap::include)) {
518+
: vframeStreamCommon(continuation) {
518519

519520
_stop_at_java_call_stub = false;
520521
_continuation_scope = continuation_scope;
@@ -530,6 +531,10 @@ vframeStream::vframeStream(oop continuation, Handle continuation_scope)
530531
}
531532
}
532533

534+
vframeStreamCommon::vframeStreamCommon(oop continuation)
535+
: _reg_map(continuation, RegisterMap::UpdateMap::include), _cont_entry(nullptr) {
536+
_thread = _reg_map.thread();
537+
}
533538

534539
// Step back n frames, skip any pseudo frames in between.
535540
// This function is used in Class.forName, Class.newInstance, and Method.Invoke.

src/hotspot/share/runtime/vframe.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ class vframeStreamCommon : StackObj {
281281

282282
public:
283283
// Constructor
284-
inline vframeStreamCommon(RegisterMap reg_map);
284+
inline vframeStreamCommon(JavaThread* thread, RegisterMap::UpdateMap update_map, RegisterMap::ProcessFrames process_frames, RegisterMap::WalkContinuation walk_cont);
285+
vframeStreamCommon(oop continuation);
285286

286287
// Accessors
287288
Method* method() const { return _method; }

src/hotspot/share/runtime/vframe.inline.hpp

+9-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@
3434
#include "runtime/handles.inline.hpp"
3535
#include "runtime/javaThread.inline.hpp"
3636

37-
inline vframeStreamCommon::vframeStreamCommon(RegisterMap reg_map) : _reg_map(reg_map), _cont_entry(nullptr) {
37+
inline vframeStreamCommon::vframeStreamCommon(JavaThread* thread,
38+
RegisterMap::UpdateMap update_map,
39+
RegisterMap::ProcessFrames process_frames,
40+
RegisterMap::WalkContinuation walk_cont)
41+
: _reg_map(thread, update_map, process_frames, walk_cont), _cont_entry(nullptr) {
3842
_thread = _reg_map.thread();
3943
}
4044

@@ -109,10 +113,10 @@ inline void vframeStreamCommon::next() {
109113
}
110114

111115
inline vframeStream::vframeStream(JavaThread* thread, bool stop_at_java_call_stub, bool process_frame, bool vthread_carrier)
112-
: vframeStreamCommon(RegisterMap(thread,
113-
RegisterMap::UpdateMap::include,
114-
process_frame ? RegisterMap::ProcessFrames::include : RegisterMap::ProcessFrames::skip ,
115-
RegisterMap::WalkContinuation::include)) {
116+
: vframeStreamCommon(thread,
117+
RegisterMap::UpdateMap::include,
118+
process_frame ? RegisterMap::ProcessFrames::include : RegisterMap::ProcessFrames::skip ,
119+
RegisterMap::WalkContinuation::include) {
116120
_stop_at_java_call_stub = stop_at_java_call_stub;
117121

118122
if (!thread->has_last_Java_frame()) {

0 commit comments

Comments
 (0)