RFR: 8318383: Remove duplicated checks in os::get_native_stack() in posix implementation

Zhengyu Gu zgu at openjdk.org
Wed Oct 18 15:06:57 UTC 2023


On Wed, 18 Oct 2023 14:27:36 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> Hi Zhengyu,
> 
> This is not trivial :)
> 
> let A=> fp == null B=> cb != null C=> sender-pc == null D=> is_first_frame
> 
> Old: if (A || B || C || D) break; if (!C && !D) get_sender_for...;
> 
> New: if (A || B || C || D) break; get_sender...
> 
> Not sure if that is correct, but it is at least not equivalent, so not a simple cleanup.
> 
> (note that I support any cleanup, the old code is terrible).

I agree it is confusing, I stared at it for quite a long while. I think I copied it from somewhere.

In the old code, when it arrives to the second check, it must have:

`fr.send_pc() != nullptr` and `os::is_first_C_frame(&fr) == false`

so `if (fr.sender_pc() && !os::is_first_C_frame(&fr))` check is always `true`, no?

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

PR Comment: https://git.openjdk.org/jdk/pull/16232#issuecomment-1768661478


More information about the hotspot-runtime-dev mailing list