RFR: 8296492: Remove ObjectLocker in JVMTI get_subgroups call
Alan Bateman
alanb at openjdk.org
Tue Nov 8 10:09:32 UTC 2022
On Tue, 8 Nov 2022 00:58:44 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
> The JVM code took a ThreadGroup lock before poking into ThreadGroup fields. Call a method in the ThreadGroup to call the synchronized method instead.
> Tested with tier 1-4.
src/java.base/share/classes/java/lang/ThreadGroup.java line 802:
> 800: int length = groups.size();
> 801: return groups.toArray(new ThreadGroup[length]);
> 802: }
Would you mind changing the comment to "Returns a snapshot of the subgroups as an array, used by JVMTI.", only to be consistent with the other methods that return subgroups as they all document it as a "snapshot". Also I think I would rename this to subgroupsAsArray as there isn't a "subgroups array".
If you want, `return groups.toArray(new ThreadGroup[0]);` will do the sizing for you.
Minor nit, you've additional blank lines after this method, I assume you only meant to add one.
-------------
PR: https://git.openjdk.org/jdk/pull/11033
More information about the hotspot-dev
mailing list