compiled code file size
Dicebot
public at dicebot.lv
Sat Sep 21 04:46:11 PDT 2013
On Saturday, 21 September 2013 at 11:34:10 UTC, Temtaime wrote:
> Are you saying about passing a function via pointer to winapi
> for example?
> The logic is simple: if someone gets function address, then
> function cannot be stripped. It's logic of all c++ compilers.
More like passing an object instance to plugin which knows it
only via .di import. Compiler can't possibly know what methods of
that object (or function indirectly accessible from it) will be
available in the .di and/or called and must act conservatively,
preserving everything.
It will also need to be aware of fact that function pointer
retrieved via `dlsym` is actually some external function and use
that knowledge during optimization.
Also it is worth noting that naive preservation of all functions
that got their address may not work very well with frequent
lambda usage for algorithms in D.
Same stuff with inheritance. It is just another side of a problem
why compiler can't de-virtualize certain methods based on whole
program class graph.
I won't be as harsh as to say it is impossible but this clearly
requires defining some parts of the language that are currently
vague.
P.S. C++ compilers are not much better here in that regard,
unless you are going to try some non-standard tweaks.
More information about the Digitalmars-d
mailing list