guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ELF and garbage collection


From: Robin Templeton
Subject: ELF and garbage collection
Date: Wed, 24 Sep 2014 11:51:08 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Guile-Emacs/24.4 (gnu/linux)

The following program works as expected in Guile 2.0:

(do ((i 0 (1+ i)))
    ((= i 100000))
  (compile ''foo #:from 'scheme #:to 'value))

...but when it's evaluated in Guile from the master branch, Guile
crashes with a "too many root sets" error. This is because
`GC_add_roots' is used in loader.c to instruct the garbage collector to
scan the program constants section of an ELF object, and there's a fixed
limit in libgc on the total number of roots.

AFAICT, `GC_add_roots' used because loaded programs aren't
garbage-collected. This makes normal compilation inconvenient when it's
necessary to compile and execute lots of independent single-expression
programs, like with the Elisp and Common Lisp `load' functions.

The easiest solution is to change nothing and require the use of
interpreters for some applications. Guile-Elisp currently relies on a
Tree-IL interpreter to load files; whole-file compilation is not
possible for some programs.

Maybe it's possible to modify the internal representation of ELF
programs and/or extend libgc so that the garbage collector can manage
them. It would be tricky to do this without scanning arbitrary program
text. Another option could be to define a new program representation for
"small" programs that's amenable to garbage collection, at the cost of
complicating the VM somewhat.

What do you think?

Thanks,
Robin
-- 
Inteligenta persono lernas la lingvon Esperanton rapide kaj facile.
Esperanto estas moderna, kultura lingvo por la mondo. Simpla, fleksebla,
belsona, Esperanto estas la praktika solvo de la problemo de universala
interkompreno. Lernu la interlingvon Esperanton!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]