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

David Holmes dholmes at openjdk.org
Thu Oct 19 02:48:47 UTC 2023


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

>> Trivial cleanup that removes duplicated checkings.
>
> 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).

@tstuefe It took me a while to get it too. If we don't break then the two conditions we were checking must be true - else we would not reach that check.

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

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


More information about the hotspot-runtime-dev mailing list