RFR: 8278871: [JVMCI] assert((uint)reason < 2* _trap_hist_limit) failed: oob [v3]

Doug Simon dnsimon at openjdk.java.net
Sat Dec 18 06:53:01 UTC 2021


> This PR fixes a discrepancy between `MethodData::_trap_hist_list` and `Deoptimization::Reason_LIMIT` in terms of JVMCI specific usage.
> 
> JVMCI doubles the size of the deopt history for a method so that it can distinguish deopts in a normal method compilation from deopts in an OSR compilation:
> 
>     union {
>       intptr_t _align;
>       u1 _array[JVMCI_ONLY(2 *) MethodData::_trap_hist_limit];
>     } _trap_hist;
> 
> 
> To access the history for OSR deopts, the index for a deopt reason needs to be adjusted to the upper half of the history array. The amount used for the adjustment was incorrect and this PR fixes it:
> 
> 
>   if (update_total_trap_count) {
>     uint idx = reason;
> #if INCLUDE_JVMCI
>     if (is_osr) {
>       idx += Reason_TRAP_HISTORY_LENGTH;
>     }
> #endif
> 
> 
> I introduced `Reason_TRAP_HISTORY_LENGTH` as a replacement for `25 JVMCI_ONLY(+5),  // decoupled from Deoptimization::Reason_LIMIT` as this decoupling is unnecessary (as dangerous) as far as I can see.

Doug Simon has updated the pull request incrementally with one additional commit since the last revision:

  fixed spelling in comment

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/6855/files
  - new: https://git.openjdk.java.net/jdk/pull/6855/files/c07e1778..b1561afa

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=6855&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=6855&range=01-02

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6855.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6855/head:pull/6855

PR: https://git.openjdk.java.net/jdk/pull/6855


More information about the hotspot-dev mailing list