On 25 June 2017 at 12:18, Mike via D.gnu <d.gnu@puremagic.com> wrote: > This is just an experience report for those who might be interested. > > Given this pull request (https://github.com/D-Programming-GDC/GDC/pull/456) > I thought I'd try testing a more recent GDC with my STM32 demo > (https://github.com/JinShil/stm32f42_discovery_demo) and see what the state > of things is. Here are my results. > > TypeInfo Stubs > =============== > I was able to reduce object.d down to the following: > > -- object.d -- > module object; > > alias size_t = typeof(int.sizeof); > alias ptrdiff_t = typeof(cast(void*)0 - cast(void*)0); > > alias string = immutable(char)[]; > > class Object > { } > > class TypeInfo > { } > > class TypeInfo_Const : TypeInfo > { > size_t getHash(in void *p) const nothrow { return 0; } > } > ---------------------- > > I wasn't able to completely omit TypeInfo because for some reason the > compiler is still looking for `getHash` in `TypeInfo_Const`. > > -- output from gdc -- > object.d:1:1: error: class object.TypeInfo_Const is forward referenced when > looking for 'getHash' > module object; > ^ > cc1d: error: no property 'getHash' for type 'object.TypeInfo_Const'
This would be coming from the front-end. The only functions that gdc itself generates are for ModuleInfo, all other artificial data and routines are emitted because the compiler was told to. > ----------------------- > > But, most of the `TypeInfo` stubs are no longer required. > > TypeInfo Bloat > =============== > Unfortunately the TypeInfo bloat documented here > (https://issues.dlang.org/show_bug.cgi?id=14758) is still there. I suppose > that's to be expected as it appears the aforementioned pull request only > removed the need to write `TypeInfo` stubs. > > Binary size for the STM32 demo is about 600kB when it should be more like > 6kB. > Out of curiosity, is that the original built binary, or post trimming (strip / --gc-sections)? There might be a size optimization possibility putting the TypeInfo in comdat, perhaps we could give that a go. There's also https://github.com/D-Programming-GDC/GDC/pull/100 - perhaps there should be a revival of that. > Compile Speed > ============= > It takes about 1 minute 30 seconds to build and link the STM32 demo > resulting in a 6kB binary. That's pretty bad, but I suspect that's a DMD > CTFE problem. > Thanks for the update. Iain.