JDK-8248901 : Signed immediate support in .../share/assembler.hpp is broken.
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 8,11,16
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2020-07-07
  • Updated: 2024-11-07
  • Resolved: 2020-07-20
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 11 JDK 16 JDK 8 Other
11.0.11-oracleFixed 16 b07Fixed 8u291Fixed openjdk8u312Fixed
Related Reports
Relates :  
Relates :  
Description
Min/Max values are undefined for nbit > 32 (and nbit < 0) in:

static int min_simm(int nbits) { return -(intptr_t(1) << (nbits - 1)) ; }
static int max_simm(int nbits) { return  (intptr_t(1) << (nbits - 1)) - 1; }
 // Test if x is within signed immediate range for nbits
 static bool is_simm(intptr_t x, int nbits) { return min_simm(nbits) <= x && x <= max_simm(nbits); }

The max/min_simm* versions are unused (with one exception).

Unsigned version is not provided.
Comments
[~mdoerr], it seems this backport to 11u included https://bugs.openjdk.java.net/browse/JDK-8215144 but this was not credited in the changeset?
23-06-2021

Fix Request (8u) I would like to backport this patch to openjdk8u for parity with Oracle 8u291, and it is also a pre-requisition for JDK-8247766 backport. The original patch does not apply cleanly, 8u patch has been reviewed.
23-06-2021

8u code review: https://mail.openjdk.java.net/pipermail/jdk8u-dev/2021-June/014003.html
22-06-2021

Fix Request Should get backported for parity with 11.0.11-oracle. Applies cleanly, but needs a small addition. Review thread: http://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-December/004485.html
21-12-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/ce8fb40c9174 User: phedlin Date: 2020-07-20 14:02:05 +0000
20-07-2020

[open/src/hotspot/share/asm/assembler.hpp] ....... // min and max values for signed immediate ranges 303 static int min_simm(int nbits) { return -(intptr_t(1) << (nbits - 1)) ; } 304 static int max_simm(int nbits) { return (intptr_t(1) << (nbits - 1)) - 1; } 305 306 // Define some: 307 static int min_simm10() { return min_simm(10); } 308 static int min_simm13() { return min_simm(13); } 309 static int min_simm16() { return min_simm(16); } 310 311 // Test if x is within signed immediate range for nbits 312 static bool is_simm(intptr_t x, int nbits) { return min_simm(nbits) <= x && x <= max_simm(nbits); } 313 314 // Define some: 315 static bool is_simm5( intptr_t x) { return is_simm(x, 5 ); } 316 static bool is_simm8( intptr_t x) { return is_simm(x, 8 ); } ......... 323 static bool is_simm32(intptr_t x) { return is_simm(x, 32); } ............. Found usages of min_simm, max_simm only in above assembler.hpp And currently all usages of is_simm - in above and in [open/src/hotspot/cpu/ppc/], [open/src/hotspot/cpu/s390/] sources seems to be for within 32 bits. So for now can this task to changed to Enhancement ? - of existing support, maybe new unsigned version support as mentioned, proper source comments etc. ILW = MLH = P4
08-07-2020

Like to have these definitions for use in JDK-8247766.
07-07-2020