Integrated: 8276545: Fix handling of trap count overflow in Parse::Parse()

Dhamoder Nalla duke at openjdk.org
Fri Sep 30 18:41:28 UTC 2022


On Tue, 6 Sep 2022 22:17:09 GMT, Dhamoder Nalla <duke at openjdk.org> wrote:

> The API trap_count(reason) returns (uint)-1 == 0xFFFFFFFF in case of trap count overflow,
> trap_count_limit()) returns (jubyte)-1 == 0xFF which leads to the failure of overflow check
> if (md_count == md->trap_count_limit()) (which is 0xFFFFFFFF == 0xFF).
> 
>          uint md_count = md->trap_count(reason);
>          if (md_count != 0) {
>                    **if (md_count == md->trap_count_limit())**  // Trap count is overflown 
> Trap count value is computed as 0xFFFFFFFF + overflowcount (diff after 0xFF) which is wrong.
> md_count += md->overflow_trap_count();
> 
> Fix:
> 
> Overflow check should be either of below
> if (md_count >= md->trap_count_limit()) or if (md_count == (uint)-1)
> 
> Total trap count as
> md_count = md->trap_count_limit() + md->overflow_trap_count();
> 
> Test: local JTReg test for hotspot_all group.

This pull request has now been integrated.

Changeset: da4e96d5
Author:    Dhamoder Nalla <dhanalla at microsoft.com>
Committer: Vladimir Kozlov <kvn at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/da4e96d5960e9a8fd8f6d91ac51932e9f7aec38e
Stats:     3 lines in 1 file changed: 1 ins; 0 del; 2 mod

8276545: Fix handling of trap count overflow in Parse::Parse()

Reviewed-by: thartmann, kvn

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

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


More information about the hotspot-compiler-dev mailing list