3 ms·
Machine language architecture is flawed. The assumption of alignment is in the machine language. Compilers can only use the instructions that are there. They h
by JoeAltmaier 3y ago
Machine language architecture is flawed. The assumption of alignment is in the machine language.
Compilers can only use the instructions that are there. They have a difficult choice: close their eyes and generate aligned-pointer moves, or use a sequence of tests and partial move instructions that is orders of magnitude less efficient.
We've needed machine instructions to load or move memory efficiently regardless of alignment, for decades.
- titzer 3y agoIn retrospect, too many crazy software dances are due to miserliness on the part of hardware designs. Saving a couple bits in the address lines and not needing to straddle cache lines? We're far past the point where that's a considerable cost, as all modern ISA implementations now attest.
- saagarjha 3y agoEveryone does this, but it’s definitely not trivial. Unaligned pointers have to deal with things like straddling pages.