JDK-8356813 : Improve Mod(I|L)Node::Value
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-05-12
  • Updated: 2025-09-23
  • Resolved: 2025-09-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 26
26 b16Fixed
Related Reports
Causes :  
Relates :  
Relates :  
Description
The current implementations of Mod(I|L)Node::Value are very conservative:
- if either input is bottom, it returns bottom
- only if both inputs are >= 0, the returned range is Type(Int|Long)::POS, otherwise the full range is returned (besides constants)

I suggest the following improvements, closely related to what the JVMS already mentions about the irem/lrem instructions:
- The result is either zero or has the same sign as the dividend
- The result's magnitude is always less than the magnitude of the divisor
- The result is always either equal to or closer to zero than the dividend
- These improvements work even if one input has type bottom.

There is an additional improvement, but I think it belongs to Identity instead:
- If the magnitude of the divisor is known to be greater than the magnitude of the dividend, the dividend is the result
Comments
[~mbaesken] might indeed be related, I'm looking into it.
18-09-2025

Is this change related to https://bugs.openjdk.org/browse/JDK-8367967 ?
18-09-2025

Changeset: c7f014ed Branch: master Author: Hannes Greule <hgreule@openjdk.org> Date: 2025-09-16 12:33:32 +0000 URL: https://git.openjdk.org/jdk/commit/c7f014ed494409cdf9fc925fe98de08346606408
16-09-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/25254 Date: 2025-05-15 15:13:18 +0000
15-05-2025