Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8249004: Reduce ThreadsListHandle overhead in relation to direct handshakes #4677

Closed
wants to merge 14 commits into from
Closed
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1560,7 +1560,7 @@ JvmtiEnv::GetThreadListStackTraces(jint thread_count, const jthread* thread_list
}

GetSingleStackTraceClosure op(this, current_thread, *thread_list, max_frame_count);
Handshake::execute(&op, java_thread);
Handshake::execute(&op, &tlh, java_thread);
err = op.result();
if (err == JVMTI_ERROR_NONE) {
*stack_info_ptr = op.stack_info();
@@ -342,13 +342,17 @@ void Handshake::execute(HandshakeClosure* hs_cl) {
}

void Handshake::execute(HandshakeClosure* hs_cl, JavaThread* target) {
ThreadsListHandle tlh;
Handshake::execute(hs_cl, &tlh, target);
}

void Handshake::execute(HandshakeClosure* hs_cl, ThreadsListHandle* tlh_p, JavaThread* target) {
Copy link
Member

@dholmes-ora dholmes-ora Nov 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: can we drop the _p part of tlh_p please.

Copy link
Contributor

@robehn robehn Nov 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please.

Copy link
Member Author

@dcubed-ojdk dcubed-ojdk Nov 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in handshake.[ch]pp.

JavaThread* self = JavaThread::current();
HandshakeOperation op(hs_cl, target, Thread::current());

jlong start_time_ns = os::javaTimeNanos();

ThreadsListHandle tlh;
if (tlh.includes(target)) {
if (tlh_p->includes(target)) {
target->handshake_state()->add_operation(&op);
} else {
char buf[128];
@@ -36,6 +36,7 @@ class HandshakeOperation;
class JavaThread;
class SuspendThreadHandshake;
class ThreadSelfSuspensionHandshake;
class ThreadsListHandle;

// A handshake closure is a callback that is executed for a JavaThread
// while it is in a safepoint/handshake-safe state. Depending on the
@@ -65,6 +66,7 @@ class Handshake : public AllStatic {
// Execution of handshake operation
static void execute(HandshakeClosure* hs_cl);
static void execute(HandshakeClosure* hs_cl, JavaThread* target);
static void execute(HandshakeClosure* hs_cl, ThreadsListHandle* tlh_p, JavaThread* target);
static void execute(AsyncHandshakeClosure* hs_cl, JavaThread* target);
};