Jump to page: 1 2
Thread overview
[Issue 14758] TypeInfo causes excessive binary bloat
Jul 02, 2015
Mike
Aug 20, 2015
Dmitry Olshansky
Aug 20, 2015
Mike
Aug 20, 2015
Sobirari Muhomori
Aug 20, 2015
Dmitry Olshansky
Aug 20, 2015
Sobirari Muhomori
Aug 20, 2015
Mike
Aug 20, 2015
Dmitry Olshansky
Aug 20, 2015
Sobirari Muhomori
Aug 20, 2015
Walter Bright
Aug 21, 2015
Martin Nowak
Aug 21, 2015
Johannes Pfau
Aug 21, 2015
Sobirari Muhomori
Aug 21, 2015
Mike
Nov 11, 2015
Mike
Aug 09, 2016
Mike
Aug 13, 2016
Iain Buclaw
Jun 19, 2017
Walter Bright
Jun 27, 2017
Mike
May 05, 2019
Mike Franklin
July 02, 2015
https://issues.dlang.org/show_bug.cgi?id=14758

Mike <slavo5150@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |bare-metal

--
August 20, 2015
https://issues.dlang.org/show_bug.cgi?id=14758

Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh@gmail.com

--- Comment #1 from Dmitry Olshansky <dmitry.olsh@gmail.com> ---
> I have modeled these statically with D's fantastic modelling features to produce an object-oriented, easily-navigable hierarchy of the hardware memory map (example: https://github.com/JinShil/stm32f42_discovery_demo/blob/master/source/stm32f42/gpio.d).  It is an excellent model that generates fast code and plays very well with tooling.  The only problem is the TypeInfo bloat.


I'd just go for structs + template mixins for inheritance. It's not like you do any of virtual calls/typeinfo/object factory/whatever.

mixin template Register(blah...){ }

struct Peripheral{

mixin Register!(x,y,z,...);
mixin Register!(q,w,e,...);

}

Makes any sesne?

--
August 20, 2015
https://issues.dlang.org/show_bug.cgi?id=14758

--- Comment #2 from Mike <slavo5150@yahoo.com> ---
(In reply to Dmitry Olshansky from comment #1)

> I'd just go for structs + template mixins for inheritance. It's not like you do any of virtual calls/typeinfo/object factory/whatever.
> 
> mixin template Register(blah...){ }
> 
> struct Peripheral{
> 
> mixin Register!(x,y,z,...);
> mixin Register!(q,w,e,...);
> 
> }
> 
> Makes any sesne?

Yes, it makes sense, but it is not my preference, and is beside the point of this issue.  Furthermore, with your suggestions, you will still have a new type for each peripheral, and therefore unwanted TypeInfo bloat for each and every one of those peripherals.

The compiler/linker should generate efficient code using my pattern, and I shouldn't have to compromise.  Nor should I have to add stubs for runtime features that have no hope of every being used.  Rust does a good job with this, and I don't see why I should have to lower my expectations for D.

--
August 20, 2015
https://issues.dlang.org/show_bug.cgi?id=14758

--- Comment #3 from Sobirari Muhomori <dfj1esp02@sneakemail.com> ---
I have an impression that LDC doesn't generate TypeInfo for structs for me (because when it does, linking fails), if I don't use array comparisons and disable opEquals. The Rust argument is valid though :)

--
August 20, 2015
https://issues.dlang.org/show_bug.cgi?id=14758

--- Comment #4 from Dmitry Olshansky <dmitry.olsh@gmail.com> ---
(In reply to Sobirari Muhomori from comment #3)
> I have an impression that LDC doesn't generate TypeInfo for structs for me (because when it does, linking fails), if I don't use array comparisons and disable opEquals. The Rust argument is valid though :)

I also was under an impression that only classes do have obligatory type-info everything else is generated on demand.

--
August 20, 2015
https://issues.dlang.org/show_bug.cgi?id=14758

--- Comment #5 from Sobirari Muhomori <dfj1esp02@sneakemail.com> ---
And compile with -O2 or -Os

--
August 20, 2015
https://issues.dlang.org/show_bug.cgi?id=14758

--- Comment #6 from Mike <slavo5150@yahoo.com> ---
(In reply to Sobirari Muhomori from comment #5)
> And compile with -O2 or -Os

Doesn't work.  See http://forum.dlang.org/post/quemhwpgijwmqtpxukiv@forum.dlang.org

--
August 20, 2015
https://issues.dlang.org/show_bug.cgi?id=14758

--- Comment #7 from Dmitry Olshansky <dmitry.olsh@gmail.com> ---
(In reply to Mike from comment #6)
> (In reply to Sobirari Muhomori from comment #5)
> > And compile with -O2 or -Os
> 
> Doesn't work.  See http://forum.dlang.org/post/quemhwpgijwmqtpxukiv@forum.dlang.org

Yes, but try without classes.

--
August 20, 2015
https://issues.dlang.org/show_bug.cgi?id=14758

--- Comment #8 from Sobirari Muhomori <dfj1esp02@sneakemail.com> ---
I mean -O0 leaves all junk intact, so at least with LDC -Os is required for successful linking (or maybe it was required before I wrote needed druntime functions? will see). I didn't try to use classes yet (wonder what I would do when I need polymorphism).

--
August 20, 2015
https://issues.dlang.org/show_bug.cgi?id=14758

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |performance
                 CC|                            |bugzilla@digitalmars.com

--- Comment #9 from Walter Bright <bugzilla@digitalmars.com> ---
Partial fix: https://github.com/D-Programming-Language/dmd/pull/4912

--
« First   ‹ Prev
1 2