Bug 13873 – 2.066.1 Compiling with -debug -inline generates huge files

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-12-17T14:44:00Z
Last change time
2015-01-28T20:46:25Z
Keywords
pull
Assigned to
nobody
Creator
dragoscarp
Blocks
14053

Comments

Comment #0 by dragoscarp — 2014-12-17T14:44:32Z
PR https://github.com/D-Programming-Language/dmd/pull/2561 introduced a regression when compiling with -debug AND -inline. This can be reproduced compiling a file foo.d that just imports std.algorithm. In my use case I have an executable that is 40MB compiled with 2.065.0 and 350MB with 2.066.1. master/HEAD has the same problem. > dmd foo.d -c -offoo.o && objdump -h foo.o | tail && ll foo.o 43 .group.d_dso 00000014 0000000000000000 0000000000000000 00000968 2**0 CONTENTS, READONLY, EXCLUDE, GROUP, LINK_ONCE_DISCARD 44 .data.d_dso_rec 00000008 0000000000000000 0000000000000000 00000980 2**3 CONTENTS, ALLOC, LOAD, DATA 45 .text.d_dso_init 00000030 0000000000000000 0000000000000000 00000988 2**3 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 46 .dtors.d_dso_dtor 00000008 0000000000000000 0000000000000000 000009b8 2**3 CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA 47 .ctors.d_dso_ctor 00000008 0000000000000000 0000000000000000 000009c0 2**3 CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA -rw-r--r-- 1 dcarp users 17K Dec 17 15:31 foo.o > dmd foo.d -c -debug -offoo.o && objdump -h foo.o | tail && ll foo.o 49 .group.d_dso 00000014 0000000000000000 0000000000000000 00000ba8 2**0 CONTENTS, READONLY, EXCLUDE, GROUP, LINK_ONCE_DISCARD 50 .data.d_dso_rec 00000008 0000000000000000 0000000000000000 00000bc0 2**3 CONTENTS, ALLOC, LOAD, DATA 51 .text.d_dso_init 00000030 0000000000000000 0000000000000000 00000bc8 2**3 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 52 .dtors.d_dso_dtor 00000008 0000000000000000 0000000000000000 00000bf8 2**3 CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA 53 .ctors.d_dso_ctor 00000008 0000000000000000 0000000000000000 00000c00 2**3 CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA -rw-r--r-- 1 dcarp users 20K Dec 17 15:34 foo.o > dmd foo.d -c -inline -offoo.o && objdump -h foo.o | tail && ll foo.o 185 .group.d_dso 00000014 0000000000000000 0000000000000000 00003a48 2**0 CONTENTS, READONLY, EXCLUDE, GROUP, LINK_ONCE_DISCARD 186 .data.d_dso_rec 00000008 0000000000000000 0000000000000000 00003a60 2**3 CONTENTS, ALLOC, LOAD, DATA 187 .text.d_dso_init 00000030 0000000000000000 0000000000000000 00003a68 2**3 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 188 .dtors.d_dso_dtor 00000008 0000000000000000 0000000000000000 00003a98 2**3 CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA 189 .ctors.d_dso_ctor 00000008 0000000000000000 0000000000000000 00003aa0 2**3 CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA -rw-r--r-- 1 dcarp users 119K Dec 17 15:35 foo.o > dmd foo.d -c -debug -inline -offoo.o && objdump -h foo.o | tail && ll foo.o 2824 .group.d_dso 00000014 0000000000000000 0000000000000000 000865c4 2**0 CONTENTS, READONLY, EXCLUDE, GROUP, LINK_ONCE_DISCARD 2825 .data.d_dso_rec 00000008 0000000000000000 0000000000000000 000865d8 2**3 CONTENTS, ALLOC, LOAD, DATA 2826 .text.d_dso_init 00000030 0000000000000000 0000000000000000 000865e0 2**3 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 2827 .dtors.d_dso_dtor 00000008 0000000000000000 0000000000000000 00086610 2**3 CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA 2828 .ctors.d_dso_ctor 00000008 0000000000000000 0000000000000000 00086618 2**3 CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA -rw-r--r-- 1 dcarp users 2.8M Dec 17 15:37 foo.o
Comment #1 by code — 2015-01-12T16:08:21Z
This doesn't affect linked binaries. It seems that more modules are imported in debug mode when generating code for inlined functions. The underlying problem here is that the inline pass simply runs semantic3 on all imported functions. It should do that for the ones that are actually used.
Comment #2 by k.hara.pg — 2015-01-28T12:51:58Z
Comment #3 by github-bugzilla — 2015-01-28T20:46:24Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/df11f21be6873a944ee32cc3a664dd84387999b9 fix Issue 13873 - 2.066.1 Compiling with -debug -inline generates huge files https://github.com/D-Programming-Language/dmd/commit/199829c645d476bf3aec2d8af8ad97066b0cc428 Merge pull request #4353 from 9rnsr/fix13873 [REG2.066] Issue 13873 - 2.066.1 Compiling with -debug -inline generates huge files