Bug 55368 - Fix alignment warnings in ARMv7
Summary: Fix alignment warnings in ARMv7
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Rob Buis
URL:
Keywords:
: 60690 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-02-28 05:49 PST by Xan Lopez
Modified: 2012-02-03 12:59 PST (History)
13 users (show)

See Also:


Attachments
alignment.diff (11.23 KB, patch)
2011-02-28 06:11 PST, Xan Lopez
no flags Details | Formatted Diff | Diff
Patch (3.95 KB, patch)
2012-01-15 19:16 PST, Rob Buis
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Xan Lopez 2011-02-28 05:49:07 PST
ToT in ARMv7 has a lot of alignment related warnings, which makes really difficult any other kind of warning in the build. Attached patch uses reinterpret_cast_ptr macro in wtf/StdLibExtras to get rid of most of them, since in ARM this adjusts the alignment properly.
Comment 1 Xan Lopez 2011-02-28 06:11:05 PST
Created attachment 84048 [details]
alignment.diff
Comment 2 Xan Lopez 2011-03-01 05:39:06 PST
Comment on attachment 84048 [details]
alignment.diff

OK, this fails in a few places in debug builds because there's an ASSERT checking the correctness of the cast that uses __alignof__, which needs the size of the class, which is not available in many places (since we forward declare instead of including the header). I'll see if I can either fix it for good or at least attach a patch with the easy fixes.
Comment 3 Rob Buis 2012-01-09 07:48:04 PST
Xan, any update? This seems useful since it may obscure more important warnings, like not returning a value in a method that should return a value.
Comment 4 Rob Buis 2012-01-15 19:16:11 PST
Created attachment 122580 [details]
Patch
Comment 5 Rob Buis 2012-01-15 19:18:25 PST
Adapted patch to compile against HEAD. The use of reinterpret_cast_ptr for debug builds everywhere turned out to be hard (at the very least intrusive) to fix (the __alignof__ problem), so I chose static_cast in a few places.
Comment 6 Ryuan Choi 2012-01-15 19:25:21 PST
*** Bug 60690 has been marked as a duplicate of this bug. ***
Comment 7 Filip Pizlo 2012-02-03 12:39:37 PST
Comment on attachment 122580 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=122580&action=review

> Source/JavaScriptCore/heap/HandleTypes.h:38
> +    static ExternalType getFromSlot(HandleSlot slot) { return (slot && *slot) ? reinterpret_cast<ExternalType>(static_cast<void*>(slot->asCell())) : 0; }

What, exactly, are you getting by putting in this static_cast?
Comment 8 Rob Buis 2012-02-03 12:55:26 PST
(In reply to comment #7)
> (From update of attachment 122580 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=122580&action=review
> 
> > Source/JavaScriptCore/heap/HandleTypes.h:38
> > +    static ExternalType getFromSlot(HandleSlot slot) { return (slot && *slot) ? reinterpret_cast<ExternalType>(static_cast<void*>(slot->asCell())) : 0; }
> 
> What, exactly, are you getting by putting in this static_cast?

I am trying to emulate reinterpret_cast_ptr, which implicitly casts to void*, because actually using it and including StdLibExtras.h for these two files would mean including a lot more include files to fix build problems. In fact I gave up on that approach simply because there were so many files to fix.
Cheers,

Rob.
Comment 9 WebKit Review Bot 2012-02-03 12:59:14 PST
Comment on attachment 122580 [details]
Patch

Clearing flags on attachment: 122580

Committed r106686: <http://trac.webkit.org/changeset/106686>
Comment 10 WebKit Review Bot 2012-02-03 12:59:20 PST
All reviewed patches have been landed.  Closing bug.