Am Wed, 26 Nov 2014 17:19:25 +0000 schrieb "Iain Buclaw via D.gnu" <d.gnu@puremagic.com>:
> On 26 November 2014 at 15:40, Johannes Pfau via D.gnu > <d.gnu@puremagic.com> wrote: > > Has anybody had a closer look at cross-module inlining? > > What exactly is necessary to get it working and how difficult would > > it be to implement? > > > > AFAICS > > * We'd need to do semantic3 on all imported modules > > * We'd have to call (a modified) toObjfile on all functions from > > imported modules > > > > However, we of course can't emit the functions so could we mark them > > as EXTERN? I've also tried to do that, but in non-toy examples > > GDC always crashes somewhere. Do we also need to call toObjfile for > > variables, classes, etc used in these functions (of course somehow > > without emitting symbols)? > > > > All in all this seems to be a complicated task, correct? > > As best as I can explain it: > > - Inlining never occurs because there is no body (that has been > converted to gcc). > - The front-end knows the body, however semantic3 pass must be ran > before attempting inline (in the front-end). Calling semantic3 on all modules (like dmd does here: https://github.com/D-Programming-Language/dmd/commit/9cf4601702e24250dff3a61b510bae30a12eb8ae) currently causes infinite memory allocation with some testcases (runnable/test19.d). I guess we can't do this with the 2.065 frontend. The dmd changes were first in 2.066.