Trass3r schrieb: > Am 08.02.2010, 16:33 Uhr, schrieb Scorn <[email protected]>: > >> Trass3r schrieb: >>> Would be interesting. >> >> >> Yes, this would be very interesting indeed. A list of the rules which >> dmd uses internally for inlining functions and methods would be really >> nice. >> > > Well if I read the code correctly the following is not supported: > - nested inline? > - variadic functions (T t, ...) > - synchronized > - imported functions > - functions with closure vars > - virtual functions that aren't final > - functions with out, ref or static array parameters > - functions with more than 250 elementary expressions > > > Created my own little inline dumping patch: > > > Index: inline.c > =================================================================== > --- inline.c (revision 363) > +++ inline.c (working copy) > @@ -1126,6 +1126,7 @@ > if (fd && fd != iss->fd && fd->canInline(0)) > { > e = fd->doInline(iss, NULL, arguments); > + printf("Inlined function %s.\n", fd->toPrettyChars()); > } > } > else if (e1->op == TOKdotvar) > @@ -1145,7 +1146,10 @@ > ; > } > else > - e = fd->doInline(iss, dve->e1, arguments); > + { > + e = fd->doInline(iss, dve->e1, arguments); > + printf("Inlined method %s.\n", fd->toPrettyChars()); > + } > } > } >
Thanks for your work. This is very interesting. It would be good to have this on a separate page regarding optimizations in D. But a big problem is that inlining seems to be done only inside one module and not across modules which makes modules with something like small helper or math functions which are used across different modules senseless.
