RFR: 8356813: Improve Mod(I|L)Node::Value [v5]

Emanuel Peter epeter at openjdk.org
Mon Jun 16 06:45:34 UTC 2025


On Mon, 16 Jun 2025 06:32:10 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Hannes Greule has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 13 additional commits since the last revision:
>> 
>>  - Address more comments
>>  - Merge branch 'master' into improve-mod-value
>>  - Add randomized test
>>  - Use BasicType for shared implementation
>>  - Update ModL comment
>>  - Use TOP instead of ZERO
>>  - Apply suggested test changes
>>  - adapt uabs -> g_uabs name change
>>  - change range of mod by 0 for PhaseCCP
>>  - Improve ModLNode::Value
>>  - ... and 3 more: https://git.openjdk.org/jdk/compare/2453dbbb...77134c1a
>
> src/hotspot/share/opto/divnode.cpp line 1244:
> 
>> 1242:   // The magnitude of the divisor is in range [1, 2^31] or [1, 2^63], depending on the BasicType.
>> 1243:   // We know it isn't 0 as we handled that above.
>> 1244:   // That means at least one value is nonzero, so its absolute value is bigger than zero.
> 
> I'm actually struggling to follow this here. Can you define "magnitude" for the reader? Maybe there is some JVMS definition you can mention. And which "value" are you refering to, that is nonzero here?

Suggestion:

  // We checked that t2 is not the zero constant. Hence at least i2->_lo or i2->_hi must be non-zero,
  // and hence its its absoute value is bigger than zero. Hence, the magnitude of the divisor (i.e. the
  // largest absolute value for any value in i2) must be in the  range [1, 2^31] or [1, 2^63], depending
  // on the BasicType.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25254#discussion_r2149153165


More information about the hotspot-compiler-dev mailing list