Re:What is gained and lost with 63-bit integers? (2014)
by Joker_vD on Saturday August 12, 2023 @09:58AM
(#37100235)
Honestly, it's a shame that the appropriate lower bits aren't automatically masked off by the CPU before the atual load/store.
[ Parent
| on HN ]
Re:What is gained and lost with 63-bit integers? (2014)
by gpderetta on Saturday August 12, 2023 @10:10AM
(#37100361)
That's by design. Implicit masking used to be the norm in older architectures, but programs would store data there with impunity and it would make it harder to extend the address space, so AMD64 requires most significant bits of an address to be either all 1 or all 0.
Re:What is gained and lost with 63-bit integers? (2014)
by Joker_vD on Saturday August 12, 2023 @10:23AM
(#37100495)
Yeah, but I'm talking about lower bits, not the upper bits.
Off-tangent: virtual pointers on AMD64 are effectively signed numbers and yet most low-level intro-level programming books keep saying that "pointers are unsigned ints because it doesn't make sense for pointers to be negative, bla-bla". Hell, I believe xv6 book has this passage and the passage about pointers' upper-bits on AMD64 being either all 1 or 0 on the same page!
Re:What is gained and lost with 63-bit integers? (2014)
by gpderetta on Saturday August 12, 2023 @10:49AM
(#37100750)
Ah, ok, but now you can't do subword aligned read/writes. That was a costly mistake that Alpha originally made and most architectures have avoided since.
Re:What is gained and lost with 63-bit integers? (2014)
by Joker_vD on Saturday August 12, 2023 @11:17AM
(#37101039)
That depends on ISA's details, honestly. For example, Knuth's MMIX has 64-bit words and has separate intructions to load/store 8-, 16-, 32-, or 64-bit wide chunks of data to/from memory — which are forced to be naturally aligned because 0, 1, 2, or 3 lower bits of the address are masked, depending on the data access's width. So there you go, you have aligned access for all "natural" subword sizes.