WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
179518
Increase the alignment requirement of WKObject's wrapped C++ object
https://bugs.webkit.org/show_bug.cgi?id=179518
Summary
Increase the alignment requirement of WKObject's wrapped C++ object
Tim Horton
Reported
2017-11-09 18:41:21 PST
Increase the alignment requirement of WKObject's wrapped C++ object
Attachments
Patch
(7.65 KB, patch)
2017-11-09 18:41 PST
,
Tim Horton
buildbot
: commit-queue-
Details
Formatted Diff
Diff
Archive of layout-test-results from ews107 for mac-elcapitan-wk2
(752.78 KB, application/zip)
2017-11-09 19:30 PST
,
Build Bot
no flags
Details
Archive of layout-test-results from ews126 for ios-simulator-wk2
(2.81 MB, application/zip)
2017-11-09 20:01 PST
,
Build Bot
no flags
Details
Patch
(7.00 KB, patch)
2017-11-10 15:36 PST
,
Tim Horton
no flags
Details
Formatted Diff
Diff
Patch
(7.00 KB, patch)
2017-11-11 01:19 PST
,
Tim Horton
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Tim Horton
Comment 1
2017-11-09 18:41:36 PST
Created
attachment 326529
[details]
Patch
Build Bot
Comment 2
2017-11-09 19:30:05 PST
Comment on
attachment 326529
[details]
Patch
Attachment 326529
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
http://webkit-queues.webkit.org/results/5172330
Number of test failures exceeded the failure limit.
Build Bot
Comment 3
2017-11-09 19:30:06 PST
Created
attachment 326535
[details]
Archive of layout-test-results from ews107 for mac-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-elcapitan-wk2 Platform: Mac OS X 10.11.6
Build Bot
Comment 4
2017-11-09 20:01:21 PST
Comment on
attachment 326529
[details]
Patch
Attachment 326529
[details]
did not pass ios-sim-ews (ios-simulator-wk2): Output:
http://webkit-queues.webkit.org/results/5172450
Number of test failures exceeded the failure limit.
Build Bot
Comment 5
2017-11-09 20:01:22 PST
Created
attachment 326537
[details]
Archive of layout-test-results from ews126 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews126 Port: ios-simulator-wk2 Platform: Mac OS X 10.12.6
Tim Horton
Comment 6
2017-11-10 15:36:30 PST
Created
attachment 326643
[details]
Patch
Ryosuke Niwa
Comment 7
2017-11-10 15:44:53 PST
Comment on
attachment 326643
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=326643&action=review
> Source/WebKit/Shared/Cocoa/APIObject.mm:86 > +static const size_t minimumObjectAlignment = 8; > +static const size_t maximumExtraSpaceForAlignment = minimumObjectAlignment - alignof(void*); > +static_assert(minimumObjectAlignment >= alignof(void*), "Objects should always be at least pointer-aligned.");
Do we really always want to do this alignment? Or just in some platform?
mitz
Comment 8
2017-11-11 00:07:05 PST
Comment on
attachment 326643
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=326643&action=review
> Source/WebKit/Shared/Cocoa/APIObject.mm:87 > +
I'd put the assertion before the subtraction it's guarding against underflow.
> Source/WebKit/Shared/Cocoa/APIObject.mm:111 > + void* api = object_getIndexedIvars(obj); > + api = std::align(minimumObjectAlignment, size, api, spaceAvailable); > + return *static_cast<API::Object*>(api);
I’d have probably written this entire function as just two statements. Can you at least combine 109 with 110, or is there something about std::align that makes that impossible?
Tim Horton
Comment 9
2017-11-11 01:12:50 PST
Comment on
attachment 326643
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=326643&action=review
>> Source/WebKit/Shared/Cocoa/APIObject.mm:86 >> +static_assert(minimumObjectAlignment >= alignof(void*), "Objects should always be at least pointer-aligned."); > > Do we really always want to do this alignment? Or just in some platform?
We do, as mentioned on IRC.
>> Source/WebKit/Shared/Cocoa/APIObject.mm:87 >> + > > I'd put the assertion before the subtraction it's guarding against underflow.
Seems reasonable.
>> Source/WebKit/Shared/Cocoa/APIObject.mm:111 >> + return *static_cast<API::Object*>(api); > > I’d have probably written this entire function as just two statements. Can you at least combine 109 with 110, or is there something about std::align that makes that impossible?
For whatever reason, std::align is void* align( std::size_t, std::size_t, void*&, std::size_t&); so I /think/ the best I can do is merge the last two lines.
Tim Horton
Comment 10
2017-11-11 01:13:46 PST
(In reply to Tim Horton from
comment #9
)
> Comment on
attachment 326643
[details]
> Patch > >> Source/WebKit/Shared/Cocoa/APIObject.mm:111 > >> + return *static_cast<API::Object*>(api); > > > > I’d have probably written this entire function as just two statements. Can you at least combine 109 with 110, or is there something about std::align that makes that impossible? > > For whatever reason, std::align is void* align( std::size_t, std::size_t, > void*&, std::size_t&); so I /think/ the best I can do is merge the last two > lines.
Otherwise, lots of "non-const lvalue reference cannot bind to a temporary..."
Tim Horton
Comment 11
2017-11-11 01:19:10 PST
Created
attachment 326686
[details]
Patch
WebKit Commit Bot
Comment 12
2017-11-11 01:42:10 PST
Comment on
attachment 326686
[details]
Patch Clearing flags on attachment: 326686 Committed
r224729
: <
https://trac.webkit.org/changeset/224729
>
WebKit Commit Bot
Comment 13
2017-11-11 01:42:11 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 14
2017-11-15 09:38:18 PST
<
rdar://problem/35562125
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug