RFR: 8299414: JVMTI FollowReferences should support references from VirtualThread stack [v7]

Chris Plummer cjplummer at openjdk.org
Thu Apr 13 07:15:39 UTC 2023


On Wed, 12 Apr 2023 14:55:59 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Alex Menkov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fixed indent in collect_vthread_stack_roots
>
> In the spec for FollowReferences, it says that the heap roots include "references from thread stacks". There is a similar sentence in the deprecated IterateOverReachableObjects function. We should decide whether these sentences need to be changed to say "platform thread stacks".

> @AlanBateman as virtual threads have already been defined to not be GC roots aka "heap roots" then it would seem the spec does need adjusting to say "platform threads".

I know the implementation of virtual threads in hotspot does not treat virtual threads as GC roots w.r.t. garbage collection. However, that's a JVM implementation detail, and I'm not so sure I would extend that to imply that "virtual threads have already been defined to not be GC roots" from a spec perspective. Do we actually say that anywhere in a spec? We have a similar situation with hprof, and the current plan is to include a `HPROF_GC_ROOT_THREAD_OBJ` record for each virtual thread (and accompanying set of `HPROF_GC_ROOT_JAVA_FRAME` records for the stack). In other words, virtual threads will be GC roots for any tool doing analysis of the hprof heap dump. Note that decisions in this area are very much in flux, and we are also considering making it optional whether or not hprof treats virtual threads in this manner. My point isn't to hash out hprof in this discussion, but just to make sure we differentiate between spec and implementation when it comes to treating virtual threads 
 as roots.

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

PR Comment: https://git.openjdk.org/jdk/pull/13254#issuecomment-1506465610


More information about the serviceability-dev mailing list