3 ms·
That's interesting, do we know how big of a difference that makes for modern architectures? You do save some room for storing (and moving) pointers but you lose
by simias 8y ago
That's interesting, do we know how big of a difference that makes for modern architectures? You do save some room for storing (and moving) pointers but you lose by having more padding for your alignment constraints and extra-shifting to "decompress" the pointers.
More generally I suspect that this approach might make sense for a VM but I that it would lead to huge headaches in C code because the programmer would have to manage the "compressed" pointers explicitly in code unless the compiler was smart enough to handle it completely by itself (something that could be very tricky to do efficiently). It reminds me of the good old days of segmented memory with the mess surrounding near and far pointers.
Still, I would be curious to see actual performance numbers for these various "64bits ISA with 32bit pointers" ABIs, it is true that 64bit pointers are pretty wasteful for many applications.
- pjmlp 8y agoNot necessarily, it could be handled in the MMU, we are after all discussing about kernel support.
- simias 8y agoI don't understand what you're proposing, what could be handled by the MMU? If you're talking about the address shifting I don't think that would work since AFAIK MMUs don't typically have sufficient granularity to map pointers at that scale. If you're talking about x32-style mapping then of course that works but then you still only have 32bits of address space.
- pjmlp 8y agoNaturally I am talking about x32-style mapping. Having only 32bits of address space wouldn't be a problem, isn't after all the goal of x32 to reduce memory consumption of processes that don't require more than 4GB? The mapping would just simply take place on a per-process basis.
- hyperman1 8y agoIn Java, it was mostly a no brainer: Objects were already aligned on 16byte boundaries, the extra shift is mostly free on modern hardware, and the optimizer is smart enough to compute the base only once if multiple fields are accessed - the common situation. But that's Java. In C, pointer casting makes it impossible to do this without help from the programmer: You simply can't stop the programmer to cast an invalid value to a pointer. In theory, a mode where char is 2, 4 or 8 physical bytes, but in practice, a lot of software would break.