RFR: 8286302: Port JEP 425 to PPC64 [v3]

Richard Reingruber rrich at openjdk.org
Wed Nov 16 10:06:04 UTC 2022


On Mon, 7 Nov 2022 22:15:15 GMT, Tyler Steele <tsteele at openjdk.org> wrote:

> Your change here looks good, but the assertion condition seems incorrect. If `(sp() == stack_size()) == false` and `(sp() >= stack_size() - argsize() - frame::metadata_words_at_top) == false`, then the assertion passes. Unless there is a case for this behaviour, I think it's safe to change this comparison to logical AND.

That's intended.

The assertion checks the equivalence of

`sp() == stack_size()` and `sp() >= stack_size() - argsize() - frame::metadata_words_at_top`

If the first predicate is false (meaning the stack is not empty) then the 2nd predicate must be false also.

Note there is an alternative `is_empty()` method that uses the 2nd predicate: https://github.com/openjdk/jdk/blob/499406c764ba0ce57079b1f612297be5b148e5bb/src/hotspot/share/runtime/continuationFreezeThaw.cpp#L437-L441



Maybe the following diagram of the stack in the StackChunk is useful:



                          Offset: stack_size()
      ===================
      |                 |
      | Stack Arguments |
      | to Bottom Frame | Offset: stack_size() - argsize()
      |-----------------|
      |                 |
      | metadata at top    |
      |                 | Offset: stack_size() - argsize() - frame::metadata_words_at_top
      ===================
      | Bottom Frame    |
      |                 |
      |                 |
      ===================
      |                 |
      :                 :
      : FRAMES          :
      :                 :
      |                 |
      ===================
      | Top Frame       |
      |                 |
      |                 |
      |-----------------|
      |                 |
      | metadata at top    |
      |                 | Offset: sp()
      ===================
      :                 :
      :                 :
      : Free Space      :
      :                 :
      :                 :
      :                 : Offset: 0
      ...................
      
Offsets are relative to stackChunkOopDesc::start_of_stack()

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

PR: https://git.openjdk.org/jdk/pull/10961


More information about the hotspot-compiler-dev mailing list