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

Hannes Greule hgreule at openjdk.org
Mon Jun 2 11:36:54 UTC 2025


On Mon, 2 Jun 2025 11:01:29 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Hannes Greule has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add randomized test
>
> src/hotspot/share/opto/divnode.cpp line 1247:
> 
>> 1245:   // JVMS lrem bytecode: "the magnitude of the result is always less than the magnitude of the divisor"
>> 1246:   // "less than" means we can subtract 1 to get an inclusive upper bound in [0, 2^63-1]
>> 1247:   jlong hi = static_cast<jlong>(divisor_magnitude - 1);
> 
> Hmm, this also looks confusing for the `T_INT` case. What about `-5`, does that then not become `max_julong - 5`, but it should have been `max_juint - 1`?

We use `g_uabs()` to get the absolute value, that should't exceed 2^31 for int values (i.e., `g_uabs(min_jint) == 2^31`). So we should get into the right range here again. But I guess I can expand the comment to better explain that part.

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

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


More information about the hotspot-compiler-dev mailing list