RFR: 8310332: Fix -Wconversion warnings in MethodData

Andrew Haley aph at openjdk.org
Tue Jun 20 12:53:44 UTC 2023


On Tue, 20 Jun 2023 12:29:17 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> Please review this change to narrow parameter and return types to avoid implicit casts, add casts where obvious, add checked_cast<> where not obvious and changed the size of a couple parameters to not cast to the smaller size.
> I didn't change TypeProfileWidth and BciProfileWidth because jvmci and SA care about the sizes.
> Tested tier1 all Oracle supported platforms, and tier1-4 linux + windows x64.

Looks reasonable. Bare narrowing casts, though, give me hives: they're an accident waiting to happen. Having said that, these look safe enough.

src/hotspot/share/oops/methodData.cpp line 483:

> 481:   for (uint row = 0; row < row_limit(); row++) {
> 482:     if (bci(row) == no_bci) {
> 483:       set_bci_displacement(row, (int)(mdp - dp()));

`checked_cast` here?

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

Marked as reviewed by aph (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/14557#pullrequestreview-1488078689
PR Review Comment: https://git.openjdk.org/jdk/pull/14557#discussion_r1235206488


More information about the hotspot-dev mailing list