UNCONFIRMED56247
Alignement problem (list of CPU types requiring alignment is too short)
https://bugs.webkit.org/show_bug.cgi?id=56247
Summary Alignement problem (list of CPU types requiring alignment is too short)
Martin Husemann
Reported 2011-03-12 04:24:19 PST
Created attachment 85584 [details] Possible extension of the cpu type list WebCore/platform/text/StringHash.h and WebCore/platform/text/AtomicString.cpp have a hard coded list of cpu types requiring alignment. This list is too short. Actually it would probably be preferable to create the inverse list of cpu types where unaligned 32bit access is both allowed AND faster than single byte access - I would guess this to be pretty short.
Attachments
Possible extension of the cpu type list (780 bytes, patch)
2011-03-12 04:24 PST, Martin Husemann
no flags
same change for a copy&pasted location (671 bytes, patch)
2011-03-12 04:25 PST, Martin Husemann
no flags
Martin Husemann
Comment 1 2011-03-12 04:25:20 PST
Created attachment 85585 [details] same change for a copy&pasted location
Alexey Proskuryakov
Comment 2 2011-03-12 10:42:01 PST
Thank you for tackling this. Please follow the steps in <http://www.webkit.org/coding/contributing.html> precisely to have this landed. Specifically, - The patch must be marked for review. That makes EWS bots build the patch on several platforms to ensure that it doesn't break the build. - Please add a properly formatted ChangeLog entry. If you don't write it, who will? Note that prepare-ChangeLog script helps with preparing those. - Please use svn-create-patch script to make a diff against trunk. A patch that doesn't apply to tip of tree cleanly cannot be landed via commit queue, which automatically verifies that a patch doesn't break the build or regression tests, and generally saves a lot of effort. - Please land one patch per bugzilla bug. That makes it easier to land via commit queue. I think that both changes you propose can be made in one patch, there is no need to split them. Your patch is made against some unspecified branch - any fixes need to go to trunk first, and be backported to branches that need it later. Where does the list of processors that require alignment come from? I'm particularly unsure if we want to include PowerPC.
Martin Husemann
Comment 3 2011-03-12 13:44:54 PST
Thanks for the hints - I'll follow the procedure. The list of CPUs I made up out of thin air - I always associate "alignement required" with RISC in general, but you are right, ppc is the oddball risc platform and does allow it. So remove ppc and ppc64, add alpha and hppa. I wonder if it is worth to split the loop into three parts, head and tail doing slow unaligned compares, but the main part doing 32bit compares. This could be used on all cpus, and should be faster if the main loop dominates the length, even on x86/amd64 cpus.
Alexey Proskuryakov
Comment 4 2011-03-12 17:44:01 PST
I'm curious why we are not just using memcmp. Maybe svn history has the answer.
Alexey Proskuryakov
Comment 5 2011-03-12 17:50:05 PST
Note that alignment problems on SPARC specifically were discussed in bug 19775. Several factors contributed to difficult history of that bug, but there might be useful information in comments. I'm not suggesting closing this one as a duplicate.
Martin Husemann
Comment 6 2011-03-15 12:50:33 PDT
I'll provide a patch in the requested format against trunk; I don't care for which of the two bugs, nor closing this one as a duplicate. For the record: I've been told that only some powerpc cpus do implement the unaligned access.
Note You need to log in before you can comment on or make changes to this bug.