FWIK Java can run on 64-bit system, no problem. I'd like to know how Java support 64-bit features, e.g., System.identityHashCode() returns a 32-bit int, it's common to see the object pointer (memory address) is returned. Should 64-bit Java returns long instead? If not, how would Java scale to 64-bit systems?
|
|
|||||
|
Correct.
Java supports 64 bit in a way that introduces no behavioural differences. A Java program will run on 32 bit or 64 bit platforms without change. All of the primitive types are the identical, the class library APIs are identical, the bytecode formats are the same. As far as the program is concerned, the only difference is that you can allocate more things before your heap fills up.
Inaccurate. What you see is a value that may or may not be related to the object's memory address at some time in the object's lifetime. Even if it is a memory address, it can't be used as one. There's no way to turn the An identity hashcode is a "uniquish" number. That's all.
No. That would make the class libraries different for 32 bit and 64 bit Java and prevent the same code from running on either platform.
It just does. There are one or two "issues". For instance array sizes and string lengths are limited to 32-bit The |
|||||||||||||
|
|
The basic understanding of the JVM is incorrect. The behaviour of the JVM is very strictly defined in the Java Language Specification and the exact details of the underlying platform is irrelevant as long as the JVM behaves as specified. Basically you can expect any well-written Java program to run on any JVM, being it 32-bit or 64-bit without any difference in behaviour as the JVM behaves the same. The primary differences you need to be aware of between 32-bit and 64-bit on the same platform is
In other words, your programs should run unchanged. Note: If your program happens to use native code you need to consider this a separate, new platform. One example is using Eclipse SWT instead of Swing. |
|||
|
|