On Sun, Mar 4, 2018 at 1:19 PM, Marc Feeley feeley@iro.umontreal.ca wrote:
On Mar 4, 2018, at 3:54 AM, Dimitris Vyzovitis vyzo@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