Showing posts from April, 2011

Improving Java support for 64-bit.

Overview There are a number of features in Java which are limited to 32-bit. Some of these are limitations of the language, some are limitations of the byte-code. As servers are getting larger, some have 1 TB of main memory, I believe these limitations will have to be addressed soon. 32-bit features in Java and its libraries These feature/libraries use int type for sizes. array.length This limitation is in the language and the defintion of the byte code. The biggest problem to changing this is to support backward compatibility. One way around this it to provide two arraylength instructions. The existing one would throw a RuntimeException if the length is greater than Integer.MAX_VALUE, as a second one which would return the length as a long. New code can use the long length while existing code would work, provided it is only given arrays which it can handle. In Oracle Java 6 the only way to allocate a large chunk of memory is to use Unsafe.allocateMemory() Unsafe unsafe