United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 4963452 RFE: 64 bit pointers needed
4963452 : RFE: 64 bit pointers needed

Details
Type:
Enhancement
Submit Date:
2003-12-04
Status:
Open
Updated Date:
2009-06-30
Project Name:
JDK
Resolved Date:
Component:
specification
OS:
solaris_9,windows_vista,linux,windows_2000
Sub-Component:
language
CPU:
itanium,x86,sparc
Priority:
P4
Resolution:
Unresolved
Affected Versions:
1.4.1,1.4.2,5.0,6u10
Targeted Versions:

Related Reports
Duplicate:
Relates:
Relates:

Sub Tasks

Description
Name: rmT116609			Date: 12/03/2003


A DESCRIPTION OF THE REQUEST :
As per the Java Language Specification, section 10.4, all array access in Java is done by using an int as index. Since an int is a signed 32bit value, this limits the total number of addressable elements of an array to 2**31 (about 2 billion). It should be possible to address an array using 64bit values.

JUSTIFICATION :
While having access to 2 billion entries may seem sufficient, there are very compelling performance reasons to be able to use more in a single array. As an example, consider a square n*n matrix, stored as an array (either row or column major, doesn't matter which). Since an array stores at most 2**31 entries, this means that n=sqrt(2**31)=46341, thus the matrix cannot be very large. For multidimensional arrays this is an even more severe limitation (3d Tensors could at most be of size 1290).

A workaround is to use an array of arrays (ie. double[][]). However there is no guarantee that successive rows will be laid of linearly in memory, and therefore performance may be severly penalized. Experimentally, performance may suffer by a factor of over 2, often far greater.

Also, most existing matrix packages (ie. LAPACK) assumes linear storage, and are thus incompatible with a double[][] storage (requires double[]). Calling a LAPACK routine with a jagged storage thus requires extra array copying and memory allocation, and can further decrease performance and increase memory requirements.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It should be possible to address arrays using 64bit integers (long?), as this provides a seamless transition for users of 64bit computers.
ACTUAL -
Cannot address more than 2**31 elements of an array.

CUSTOMER SUBMITTED WORKAROUND :
Use of array of array constructs (use double[][] instead of double[])
(Incident Review ID: 227911) 
======================================================================

                                    

Comments
EVALUATION

Fair enough.
                                     
2006-11-20



Hardware and Software, Engineered to Work Together