On Mon, 3 Jun 2024 08:34:11 GMT, David Holmes <dhol...@openjdk.org> wrote:

>> I also find the duplication of the stack printing code unfortunate. It would 
>> be nice to reuse`JavaThread::print_vthread_stack_on`. I don't understand why 
>> it cannot be const?
>
>> I also find the duplication of the stack printing code unfortunate. It would 
>> be nice to reuse`JavaThread::print_vthread_stack_on`. I don't understand why 
>> it cannot be const?
> 
> Just what I was about to query :) I'm not sure what the const issue is. 
> Printing a stack certainly should not modify anything.

> > > * The format proposed by @dholmes-ora definitely makes sense
> > 
> > 
> > You will different get different opinions on how it is presented. Can you 
> > also try putting a new section that lists the mounted virtual threads and 
> > their stack trace. If the virtual thread has a name then it can be shown 
> > too.
> 
> That suggests to me that we have to iterate the list of all threads twice ?? 
> If so that seems not ideal.

I think that both approaches suggested by @AlanBateman would work, but I 
personally like the fact that having the virtual thread being displayed on top 
of the carrier thread allows seeing the full stack trace together. I've tried 
to preserve that approach while calling `print_vthread_stack_on` in 6a3b779f521.

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

PR Comment: https://git.openjdk.org/jdk/pull/19482#issuecomment-2144953866

Reply via email to