JDK-8000313 : C2 should use jlong for 64bit values
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-10-01
  • Updated: 2013-06-26
  • Resolved: 2012-10-08
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 7 JDK 8 Other
7u40Fixed 8Fixed hs24Fixed
On 9/30/12 8:45 PM, John Rose wrote:
> I just noticed this code in loopTransform:
>      // Use longs to avoid integer overflow.
>      int stride_con  = cl->stride_con();
>      long init_con   = cl->init_trip()->get_int();
>      long limit_con  = cl->limit()->get_int();
>      int stride_m    = stride_con - (stride_con>  0 ? 1 : -1);
>      long trip_count = (limit_con - init_con + stride_m)/stride_con;
> (It has your name on it.)  Don't you want jlong in such code instead of plain long?
> ��� John 

Yes, you are absolutely right. Maybe we should redefine 'long' so that compilers will complain about its usage. We need to find all usages of naked long (which some C++ compilers treats as 32-bit value) and replace it with jlong (which is defined in Hotspot as always 64-bit value).