[WTF] Add WTF::unalignedLoad and WTF::unalignedStore
Created attachment 347421 [details] Patch
Created attachment 347423 [details] Patch
Created attachment 347455 [details] Patch
Comment on attachment 347455 [details] Patch How close does this put us to removing reinterpret_cast_ptr?
(In reply to Darin Adler from comment #4) > Comment on attachment 347455 [details] > Patch > > How close does this put us to removing reinterpret_cast_ptr? Nice catch. Currently, `reinterpret_cast_ptr<T>(ptr)` is used only when we ensure that the casted `ptr` has the expected alignment by `T`. It would be optimized way with CPUs without unaligned accesses support. But since the major CPUs like ARM64, X86, and X86_64 support unaligned accesses, always using `WTF::unalignedXXX` would be feasible. We should investigate each site of `reinterpret_cast_ptr` carefully to decide whether we can replace it with unalignedXXX helpers!
Committed r235018: <https://trac.webkit.org/changeset/235018>
I'm surprised. There are so many unaligned access. I thought unaligned memory access is slow. See https://github.com/spotify/linux/blob/master/Documentation/unaligned-memory-access.txt Are they really unaligned memory access? Or, actually aligned?
<rdar://problem/43534448>
(In reply to Fujii Hironori from comment #7) > I'm surprised. There are so many unaligned access. > I thought unaligned memory access is slow. > See > https://github.com/spotify/linux/blob/master/Documentation/unaligned-memory- > access.txt > > Are they really unaligned memory access? Or, actually aligned? Unaligned accesses reported by UBSan. They are typically filling/extracting an value into/from X86 machine code stream.