News for hackers. Stuff that matters.
Re:Do we really still need a 32-bit JVM? by MichaelGG on Wednesday May 27, 2015 @12:51AM (#9609412)
64 bit JVM can target 32-bit address space just fine. In fact if you know you're doing that, then with 4 byte alignment, you only need 30 bits for a pointer, leaving 2 for other optimizations. Maybe.

See also: X32.

Re:Do we really still need a 32-bit JVM? by copsarebastards on Wednesday May 27, 2015 @06:55AM (#9610479)
> In fact if you know you're doing that, then with 4 byte alignment, you only need 30 bits for a pointer, leaving 2 for other optimizations.

Could you explain how this works?

Re:Do we really still need a 32-bit JVM? by MichaelGG on Wednesday May 27, 2015 @10:49PM (#9615812)
Sure. Suppose you have an 8 byte address space. You'll need 3 bits to address them (0,1,..6,7). But, if the only objects you store must fall on a 4 byte boundary, there's only two valid addresses: 0 and 4. You can represent that with one bit, just multiply the value by 4 (0->0, 1->4).

Same for any other size. Got 32 bit address space, 4GB? Well with 4 byte alignment, you shave off two bits, just multiply every pointer by 4 (left shift it by 2).

With the two highest bits, you're free to encode other information for whatever little things you need to keep track of in the runtime.

The JVM already does this on x64 so that instead of 8 byte pointers, they're only 4 bytes. But alignment bumps up the range from 4 to 16(?) GB - or something like that? Compresssed object pointers I think is the name if you wanna look up more.