WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
55088
To COMPILE_ASSERT bitfields are packed with expected size
https://bugs.webkit.org/show_bug.cgi?id=55088
Summary
To COMPILE_ASSERT bitfields are packed with expected size
Yong Li
Reported
2011-02-23 15:00:31 PST
How bitfields are packed relies on compiler implementation. For example: struct { int x : 31; bool y : 1; }; Above struct consumes 8 bytes in MSVC, where we probably expect it uses only 4 bytes (otherwise why do we even use bitfields?). Unfortunately, we are widely using this pattern in webkit. More information:
http://msdn.microsoft.com/en-us/library/hx1b6kkd.aspx
"Adjacent bit fields are packed into the same 1-, 2-, or 4-byte allocation unit if the integral types are the same size and if the next bit field fits into the current allocation unit without crossing the boundary imposed by the common alignment requirements of the bit fields. " Ideally, we should be able to assert bitfields are packed with expected size at compile time. Also it would be nice if check-webkit-style can detect such issues.
Attachments
Add attachment
proposed patch, testcase, etc.
Eric Seidel (no email)
Comment 1
2011-03-22 16:28:40 PDT
I suspect there may be a bunch of perf on the table for Safari Win due to these.
Eric Seidel (no email)
Comment 2
2011-03-22 16:29:28 PDT
See related
bug 17217
for wider deployment of these COMPILE_ASSERTs.
Adam Roben (:aroben)
Comment 3
2011-03-23 08:25:08 PDT
It seems like there are two bugs here: 1) There are places in WebKit that have suboptimal bitfield packing 2) We would like to assert that bitfield packing is optimal (2) seems very similar to
bug 17217
. (1) probably needs to be split out into multiple bugs.
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