3 ms·
This is the only answer. Java is intended to be right once, run anywhere. "Anywhere" will include 32 bit address spaces for the forseeable future.
by copsarebastards 11y ago
This is the only answer.
Java is intended to be right once, run anywhere. "Anywhere" will include 32 bit address spaces for the forseeable future.
- hobo_mark 11y agoThat is a lovely typo.
- RobIII 11y agoIt was so good my brain corrected it several times before spotting it :D
- copsarebastards 11y agoToo late to edit, I'm committed!
- MichaelGG 11y ago64 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.
- copsarebastards 11y ago> 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?
- MichaelGG 11y agoSure. 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.