[gambit-list] full program optimization

Dimitris Vyzovitis vyzo at hackzen.org
Sun Mar 4 07:21:48 EST 2018


On Sun, Mar 4, 2018 at 1:19 PM, Marc Feeley <feeley at iro.umontreal.ca> wrote:

>
> > On Mar 4, 2018, at 3:54 AM, Dimitris Vyzovitis <vyzo at hackzen.org> wrote:
> >
> > The first problem is truly insurmountable. Linking more than a handful
> of modules results in gcc blowing up...
> > I haven't managed to compile any non-trivial program that uses a decent
> part of the gerbil stdlib, they all end with the compiler getting OOM
> killed.
>
> I believe this problem would vanish if the tree-shaker is enabled and the
> runtime library is refactored to avoid gratuitous dependencies.  Then your
> final executable would only contain the parts of the runtime library (and
> the program) that are useful for this specific program.
>
> This strategy is what I envision for the universal backend where the bloat
> is more severe than in C.
>

The tree-shaker makes a difference indeed. I did manage to compile a
program that was OOMing with the tree shaker enabled with (declare
(optimize-dead-definitions)).
Unfortunately the resulting program crashes with Bus Error when poked (it
starts up fine, but it crashes once it starts communicating) and it's quite
hard to tell what went wrong; program works fine with separate linkage
obviously.


>
> I think a new form to limit the scope of declarations would be useful for
> all of this.  For example:
>
>    (declare (core))
>
>    (begin-with-declaration-scope
>     (declare (not core))
>     (include "mod.scm"))
>
>    ;; at this point we are back in the scope of the (declare (core))
>
> Maybe begin-with-declaration-scope could have a better name…
>
>
Such a form would make life much simpler indeed, no need to reset
declarations after including.

-- vyzo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20180304/9b12e42e/attachment.htm>


More information about the Gambit-list mailing list