Object.factory() and exe file size bloat

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 21 04:22:02 PDT 2015


On 21 August 2015 at 13:03, Mike via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

> On Friday, 21 August 2015 at 08:11:37 UTC, Kagamin wrote:
>
>> On Friday, 21 August 2015 at 06:00:44 UTC, Mike wrote:
>>
>>> Disabling TypeInfo forces one to compromise on slicing, postblit
>>>
>>
>> Why slicing and postblit would need typeinfo?
>>
>
> See below for the source code.  Some obvious, some not.
>
> * dynamic cast -
> https://github.com/D-Programming-GDC/GDC/pull/100/files?diff=unified#diff-83bcb64558f947e39f87d7435709dfe7R364
> * array literal -
> https://github.com/D-Programming-GDC/GDC/pull/100/files?diff=unified#diff-bed7d2226948b1e098749985d7a60633R2353
> * postblit -
> https://github.com/D-Programming-GDC/GDC/pull/100/files?diff=unified#diff-1f51c84492753de4c1863d02e24318bbR918
> * destructor -
> https://github.com/D-Programming-GDC/GDC/pull/100/files?diff=unified#diff-1f51c84492753de4c1863d02e24318bbR1039,
>
> https://github.com/D-Programming-GDC/GDC/pull/100/files?diff=unified#diff-867588d7078efd0364c256152fb5a2e7R2053
> * new -
> https://github.com/D-Programming-GDC/GDC/pull/100/files?diff=unified#diff-5960d486a42197785b9eee4ba95c6b95R5091
> * AAs -
> https://github.com/D-Programming-GDC/GDC/pull/100/files?diff=unified#diff-5960d486a42197785b9eee4ba95c6b95R10710
> * slicing -
> https://github.com/D-Programming-GDC/GDC/pull/100/files?diff=unified#diff-5960d486a42197785b9eee4ba95c6b95R11857
>
> etc...
>
> Disabling TypeInfo requires quite a compromise on D's features.  I want
> TypeInfo, I just don't want dead code.
>
>
Where removing RTTI disables D feature's in a compromising way, I'd start
by questioning the why.

Eg:  Why does array literals need RTTI?  Looking at _d_arrayliteralTX
implementation, it only does the following with the given TypeInfo provided:

- Get the array element size (this is known at compile time)
- Get the array element type flags (calculated during the codegen stage,
but otherwise known at compile time)
- Test if the TypeInfo is derived from TypeInfo_Shared (can be done at -
you guessed it - compile time by peeking through the baseClass linked list
for a given TypeInfo type we are passing).

So we have this function that accepts a TypeInfo, but doesn't really *need*
to at all.

void* _d_arrayliteralTX(size_t length, size_t sizeelem, uint flags, bool
isshared);

Just putting it out there....

Iain.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150821/05086cb4/attachment.html>


More information about the Digitalmars-d mailing list