On 10/16/07, Bert Freudenberg bert@freudenbergs.de wrote:
On Oct 16, 2007, at 10:36 , Andrew Gaylard wrote:
- What are the advantages/disadvantages to using 64-bits?
- The first advantage is that your image size can be enormous.
If you need the size of your VM code + in-memory image to exceed 4 GB, then 64-bits is for you. Note that it will take ages to write out an image that's this big to disk. The sort of applications that need this are those which load a small(ish) image, and run code that creates millions of objects, but don't save them back to disk in the image.
However, the garbage collector really is not up to the task of collecting multiple gigabytes of garbage.
OK
- Another advantage is that when the 64-bit-VM is built, the C
compiler knows the ABI is different from the 32-bit ABI. The x86-64 case is an important example: the old i386 ABI offered few registers, used i387 floating-point, and passed parameters on the stack. The x86-64 ABI has may more registers, has SSE, SSE2, etc for FP, and passes parameters in registers where possible. It also has additional instructions (MMX et al). All of this makes for a VM that runs faster if the compiler is able to make use of it (and is told to at compile-time).
I doubt that, you need to profile. I have not heard anyone reporting the 64 bit VM to be faster than the 32 bit version, on any machine.
I've found that the new registers and instructions can make a difference when building apps 32-bit. (No, I don't have numbers.) However, the loss of backward-compatibility across the x86 range normally precludes this for normal usage. When moving to 64-bits, I suspect that this gain in performance is outweighed by the cost of larger pointers. So, yes, we shouldn't make this point unless we have made some measurements and have some hard data.
- Why isn't there an officially-released 64-bit image?
Watch this space!
Because nobody needs it (yet), and therefore nobody feels an urge to provide and maintain one.
Actually, two years ago I was involved in a project that needed an estimated 6GB of object-space in RAM. (The project got cancelled due to a fear of languages that don't have curly braces. But that's another story.) There really are some people -- though not many -- who do have real-world problems which require 64-bit addressing. So it's not true to say that "nobody" needs it. But it's not a common need, I do agree.
Anyway, writing this up for future reference is needed, thanks for
doing this. One thing you should watch out for though is to distinguish between a 64 bit VM and a 64 bit image, which are independent.
Ah. Yes. Good that you pointed this out. So would it be correct to say "a 64-bit VM is needed only if you have an architecture which can't run 32-bit apps, or if you have a need for an enormous number of objects, in which case you'll also need a 64-bit image"?
Thanks for the input.
Andrew