[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-serviceability-dev
Subject: Integrated: 8295810: cleanup debug agent removeThread() api
From: Chris Plummer <cjplummer () openjdk ! org>
Date: 2022-10-25 16:32:37
Message-ID: AmmB4ubTR9EUvjmiEvmd7vu7t67uwItvg0lrpiG4GgI=.fa6cc67f-962e-42d7-93d4-76fc86874c7f () github ! com
[Download RAW message or body]
On Sat, 22 Oct 2022 03:05:07 GMT, Chris Plummer <cjplummer@openjdk.org> wrote:
> The implementation of removeThread() is currently:
>
>
> static void
> removeThread(JNIEnv *env, ThreadList *list, jthread thread)
> {
> ThreadNode *node;
>
> node = findThread(list, thread);
> if (node != NULL) {
> removeNode(list, node);
> clearThread(env, node);
> }
> }
>
> However, currently all callers already have the ThreadNode*, so they end up calling \
> like the following:
> ` removeThread(env, list, node->thread);`
>
> So we go from a ThreadNode* to a jthread, only to do a findThread() to get the \
> ThreadNode* again. Also, the list is stored in the ThreadNode. removeThread() can \
> instead be implemented as:
>
> static void
> removeThread(JNIEnv *env, ThreadNode *node)
> {
> JDI_ASSERT(node != NULL);
> removeNode(node->list, node);
> clearThread(env, node);
> }
>
>
> This is faster, although not by as much as you might think. TLS is used to map a \
> jthread to a ThreadNode*, so the findThread() call is actually already pretty fast. \
> The exception is when dealing with the otherThreads list. These threads have not \
> yet been started, so TLS cannot be used, but it is rare for threads to appear on \
> this list. Still, this is a good cleanup to do, and should be a bit faster.
> This cleanup was initially implemented as part of the work for \
> [JDK-8295376](https://bugs.openjdk.org/browse/JDK-8295376), but is being split out.
This pull request has now been integrated.
Changeset: 6289600f
Author: Chris Plummer <cjplummer@openjdk.org>
URL: https://git.openjdk.org/jdk/commit/6289600fe86bf1f8de160ea64cdba960b2d3e693
Stats: 16 lines in 1 file changed: 1 ins; 8 del; 7 mod
8295810: cleanup debug agent removeThread() api
Reviewed-by: kevinw, sspitsyn, amenkov
-------------
PR: https://git.openjdk.org/jdk/pull/10828
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic