Bug 183311 - dump-class-layout mishandles duplicates base classes and miscomputes padding
Summary: dump-class-layout mishandles duplicates base classes and miscomputes padding
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords:
Depends on:
Blocks: 183939
  Show dependency treegraph
 
Reported: 2018-03-03 02:38 PST by Joseph Pecoraro
Modified: 2018-05-19 11:42 PDT (History)
6 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (3.41 KB, patch)
2018-03-03 02:40 PST, Joseph Pecoraro
simon.fraser: review+
commit-queue: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2018-03-03 02:38:10 PST
dump-class-layout mishandles duplicates base classes and miscomputes padding

INPUT: (I want to see the layout of Target)

> class VirtualBaseOne {
> public:
>     virtual ~VirtualBaseOne() {}
> };
> 
> class VirtualBaseTwo {
> public:
>     virtual ~VirtualBaseTwo() {}
> };
> 
> class OtherBase {};
> class OtherOtherBase : public OtherBase {};
> 
> class ThingWithData {
>     void* inputs[16];
>     unsigned count;
> };
> 
> class Base : virtual public VirtualBaseOne, virtual public VirtualBaseTwo, virtual protected OtherOtherBase {
> public:
>     virtual ~Base() {};
>     bool x;
>     ThingWithData data;
> };
> 
> class Target : public Base {
>     int a;
>     int b;
>     int c;
>     int d;
> };
> 
> int main() {
>     Target x;
>     return 0;
> }

BEFORE:

> Found 1 types matching "Target" in "/tmp/a.out" for systemArch
>   +0 {176} Target
>   +0 {160}     Base
>   +0 {  8}         VirtualBaseOne
>   +0 <  8>             __vtbl_ptr_type * _vptr;
>   +0 {  1}         OtherOtherBase
>   +0 {  1}             OtherBase
>   +0 {  8}         VirtualBaseOne
>   +0 <  8>             __vtbl_ptr_type * _vptr;
>   +0 {  1}         OtherOtherBase
>   +0 {  1}             OtherBase
>   +1 <  7>         <PADDING>
>   +8 <  1>         bool x;
>   +9 <  7>         <PADDING>
>  +16 <136>         ThingWithData data;
>  +16 <128>             void *[16] inputs;
> +144 <  4>             unsigned int count;
> +148 <  4>         <PADDING>
> +152 {  8}         VirtualBaseTwo
> +152 <  8>             __vtbl_ptr_type * _vptr;
> +152 {  8}         VirtualBaseTwo
> +152 <  8>             __vtbl_ptr_type * _vptr;
>   +0 {  8}     VirtualBaseOne
>   +0 <  8>         __vtbl_ptr_type * _vptr;
>   +0 {  1}     OtherOtherBase
>   +0 {  1}         OtherBase
>   +1 <151>     <PADDING>
> +152 <  4>     int a;
> +156 <  4>     int b;
> +160 <  4>     int c;
> +164 <  4>     int d;
> +168 {  8}     VirtualBaseTwo
> +168 <  8>         __vtbl_ptr_type * _vptr;
> Total byte size: 176
> Total pad bytes: 169
> Padding percentage: 96.02 %

AFTER:

> Found 1 types matching "Target" in "/tmp/a.out" for systemArch
>   +0 {176} Target
>   +0 {160}     Base
>   +0 {  8}         VirtualBaseOne
>   +0 <  8>             __vtbl_ptr_type * _vptr;
>   +0 {  1}         OtherOtherBase
>   +0 {  1}             OtherBase
>   +1 <  7>         <PADDING>
>   +8 <  1>         bool x;
>   +9 <  7>         <PADDING>
>  +16 <136>         ThingWithData data;
>  +16 <128>             void *[16] inputs;
> +144 <  4>             unsigned int count;
> +148 <  4>         <PADDING>
> +152 {  8}         VirtualBaseTwo
> +152 <  8>             __vtbl_ptr_type * _vptr;
> +152 <  4>     int a;
> +156 <  4>     int b;
> +160 <  4>     int c;
> +164 <  4>     int d;
> +168 {  8}     VirtualBaseTwo
> +168 <  8>         __vtbl_ptr_type * _vptr;
> Total byte size: 176
> Total pad bytes: 18
> Padding percentage: 10.23 %
Comment 1 Joseph Pecoraro 2018-03-03 02:40:54 PST
Created attachment 334953 [details]
[PATCH] Proposed Fix
Comment 2 WebKit Commit Bot 2018-03-05 11:40:31 PST
Comment on attachment 334953 [details]
[PATCH] Proposed Fix

Rejecting attachment 334953 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'land-attachment', '--force-clean', '--non-interactive', '--parent-command=commit-queue', 334953, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

Last 500 characters of output:
rdparty/autoinstalled/mechanize/_urllib2_fork.py", line 332, in _call_chain
    result = func(*args)
  File "/Volumes/Data/EWS/WebKit/Tools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_urllib2_fork.py", line 1170, in https_open
    return self.do_open(conn_factory, req)
  File "/Volumes/Data/EWS/WebKit/Tools/Scripts/webkitpy/thirdparty/autoinstalled/mechanize/_urllib2_fork.py", line 1118, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 60] Operation timed out>

Full output: http://webkit-queues.webkit.org/results/6815059
Comment 3 Simon Fraser (smfr) 2018-05-19 11:42:34 PDT
This fix isn't right: bug 185801