RFR: 8253180: ZGC: Implementation of JEP 376: ZGC: Concurrent Thread-Stack Processing [v6]

Albert Mingkun Yang ayang at openjdk.java.net
Mon Sep 28 12:14:15 UTC 2020


On Mon, 28 Sep 2020 11:54:17 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:

>> Thank you for the comments and diagrams; they make the code much more digestible. From that diagram, I get the
>> impression that the watermark is associated with stack pointer, so it should be 1:1 relation, but `class Thread`
>> contains multiple watermarks, `StackWatermarks _stack_watermarks;`. I think some high level description on the relation
>> between the thread and a list of watermarks belong to that thread could be beneficial.
>>> The first time it reaches past the last frame it will report true, and the second time it will report false.
>> 
>> Why so? As I see it, once a stream becomes "done", it stays in that state forever. Am I missing sth?
>> inline bool StackFrameStream::is_done() {
>>   return (_is_done) ? true : (_is_done = _fr.is_first_frame(), false);
>> }
>
>> Thank you for the comments and diagrams; they make the code much more digestible. From that diagram, I get the
>> impression that the watermark is associated with stack pointer, so it should be 1:1 relation, but `class Thread`
>> contains multiple watermarks, `StackWatermarks _stack_watermarks;`. I think some high level description on the relation
>> between the thread and a list of watermarks belong to that thread could be beneficial.
> 
> I added some further comments explaining this.
> 
>> > The first time it reaches past the last frame it will report true, and the second time it will report false.
>> 
>> Why so? As I see it, once a stream becomes "done", it stays in that state forever. Am I missing sth?
>> 
>> ```
>> inline bool StackFrameStream::is_done() {
>>   return (_is_done) ? true : (_is_done = _fr.is_first_frame(), false);
>> }
>> ```
> 
> When you step into the last frame of the iteration (first frame in the stack), the first time you ask is_done() it will
> report false, the next time it will report true, despite still being in the same frame. Therefore, the is_done()
> function is not idempotent, as I need it to be.

I see; thank you for the explanation.

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

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


More information about the serviceability-dev mailing list