RFR: 8209976: Improve iteration over non-JavaThreads

David Holmes david.holmes at oracle.com
Mon Sep 3 06:44:31 UTC 2018


Hi Kim,

I know this has been pushed now but if we're going to re-jiggle the 
Thread hierarchy then we can maybe do better. I never liked the 
introduction of NamedThread and it seems even more superfluous now - all 
threads can/should have names, there's really no reason why the 
WatcherThread or JfrSamplerThread should be special in this regard.

Arguably you don't need NonJavaThread as if you don't derive from 
JavaThread then you are by definition a non-JavaThread - but if this 
classification makes things easier so be it.

IIRC we only use is_Java_thread() due to a lack of RTTI in our C++ 
usage. Is that likely to change going forward?

Meanwhile should is_Java_thread() be pure virtual in Thread and 
overridden in JavaThread and NonJavaThread ?

Cheers,
David

On 27/08/2018 9:09 AM, Kim Barrett wrote:
> Please review this change to improve the iteration over
> non-JavaThreads.  This change introduces a new base class
> NonJavaThread, which should be a base for any Thread class that isn't
> a JavaThread.  The recently introduced iteration over NamedThreads
> (JDK-8209850) is moved to this new class.  This allows the
> re-implementation of Threads::non_java_threads_do using that list.
> 
> Note: Perhaps CollectedHeap::gc_threads_do could be replaced by a
> Threads::gc_threads_do that is implemented as an iteration over the
> non-JavaThreads with a filter to select GC-related thread types.  That
> isn't being done as part of this change though.
> 
> CR:
> https://bugs.openjdk.java.net/browse/JDK-8209850
> 
> Webrev:
> http://cr.openjdk.java.net/~kbarrett/8209976/open.00/
> 
> Testing:
> mach5 tier1-3, hs-tier4-5 in conjunction with a fix for JDK-8209975.
> Local testing of just this change.
> 


More information about the hotspot-dev mailing list