RFR: 8337958: Out-of-bounds array access in secondary_super_cache
Andrew Haley
aph at openjdk.org
Wed Aug 7 23:58:31 UTC 2024
On Wed, 7 Aug 2024 17:19:04 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> Silly questions:
>
> 1. Why is it `(u1)`, when we are comparing with `cmpw` (4 bytes)? Also, should it really be unsigned? x86 code uses signed `int32_t`.
Yeah, but AArch64 has a restricted rage of operand sizes. There's a very long thread where we discussed all of this, but we ended up defining `cmpw` for `(u1)`. This means we never see an overflow at runtime.
> 2. I was trying to see if there is anything special about `-2` here. Would it be a bit cleaner to say `GE` `Klass::SECONDARY_SUPERS_TABLE_SIZE - 1`?
Mmm, maybe, but it means the same to me. It's just a performance optimization that does a linear search when the table is almost full, because in measurements it's faster to do so.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20483#discussion_r1708141161
More information about the hotspot-dev
mailing list