[gambit-list] full program optimization

Dimitris Vyzovitis vyzo at hackzen.org
Sun Mar 4 12:10:14 EST 2018


On Sun, Mar 4, 2018 at 2:21 PM, Dimitris Vyzovitis <vyzo at hackzen.org> wrote:

>
>
> 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.
>


So the problem was indeed declaration leakage -- there was a (declare
(fixnum)) leaking to the rest of the program and crashing inside _num.scm,
just as I predicted :)
I have fixed this by having the compiler issue a reset declaration after
each include, followed by the user's prelude declarations if any.
I am also happy to report that the program runs a little faster (~3.2s from
~3.6s), so there is indeed benefit from FPO.

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


More information about the Gambit-list mailing list