| Summary: | [WTF] Add WTF::unalignedLoad and WTF::unalignedStore | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Yusuke Suzuki <ysuzuki> | ||||||||
| Component: | New Bugs | Assignee: | Yusuke Suzuki <ysuzuki> | ||||||||
| Status: | RESOLVED FIXED | ||||||||||
| Severity: | Normal | CC: | darin, Hironori.Fujii, mark.lam, saam, sam, webkit-bug-importer | ||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||
| Version: | WebKit Nightly Build | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Unspecified | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Yusuke Suzuki
2018-08-17 19:04:26 PDT
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? (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. |