RFR: 8276545: Fix handling of trap count overflow in Parse::Parse() [v3]

Dhamoder Nalla duke at openjdk.org
Mon Sep 26 20:59:38 UTC 2022


> 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.

Dhamoder Nalla has updated the pull request incrementally with one additional commit since the last revision:

  address CR comments

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/10187/files
  - new: https://git.openjdk.org/jdk/pull/10187/files/f1f8fc50..dc9d713b

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10187&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10187&range=01-02

  Stats: 2 lines in 1 file changed: 0 ins; 1 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/10187.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10187/head:pull/10187

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


More information about the hotspot-compiler-dev mailing list