RFR: 8271514: support JFR use of new ThreadsList::Iterator [v2]

Kim Barrett kbarrett at openjdk.java.net
Thu Aug 5 04:03:30 UTC 2021


On Wed, 4 Aug 2021 22:56:15 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

>> src/hotspot/share/jfr/utilities/jfrThreadIterator.hpp line 50:
>> 
>>> 48: class JfrJavaThreadIteratorAdapter {
>>> 49:  private:
>>> 50:   ThreadsListHandle _tlist;
>> 
>> Why do we need to store this?
>> 
>> It looks very suspiocious to have a member that is a stackObj, in a class that is not itself a stackObj. ??
>
> The _tlist is used locally in JfrJavaThreadIteratorAdapter constructor only, so it is possible to get rid of it for the price of complicating the constructor a little bit.

The `_tlist` is a handle that ensures the captured ThreadsList remains live while the iterator (or a copy) exists.  Dropping it would leave `_it` and `_end` potentially dangling.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4949


More information about the serviceability-dev mailing list