Hi Matt! Indeed a bug. I'll be away for a week with my laptop, and will try to address this by the time I get back.
flet code build a closure on each call, which consumes memory. The code in fact is tail recursive, which need not. Now that 2.7 does automatic inlining, I'm tempted to have flet and labels be inlined automatically by default. Is there some reason a user writing flet would want a genuine function call with each iteration? Tracing without fast-links, perhaps? As before mentioned in a gcl-devel post, I'm also working on passive list referencing and dereferencing. In brief, with our source inlining, (append x y z) goes to (let* ((xx x) (yy y) (zz z) (append-rest (list* xx yy zz)) inline append source) The list is consed on the C stack, avoiding gc overhead, as the append source includes a :dynamic-extent declaration. The weakness is that type information on x y and z are lost when referenced as the car of some list. Right now I have a working experimental version which carries this information in cons types, and which I believe can be made acceptably fast. In addition, or perhaps instead, I'd like to engineer a passive reference of such a list which would revert to the original variable. The list, being then unreferenced, would never be stack-consed in the first place. Thouhts most welcome. Take care, Matt Kaufmann <[EMAIL PROTECTED]> writes: > Hi, Camm -- > > Normally I find that GCL prints friendly messages like this when it > runs out of space: > > Error: The storage for BIGNUM is exhausted. > Currently, 68 pages are allocated. > Use ALLOCATE to expand the space. > > However, here is an example in which I get an unrecoverable error, the > statement of which depends on the version of GCL (as shown below). > > ============================== > > (declaim (optimize (speed 3) (space 0) (safety 0))) > (si::sgc-on t) > (defun fact (n acc) > (flet ((fact0 (n acc) > (if (zerop n) > acc > (fact (1- n) > (* n acc))))) > (return-from fact (fact0 n acc)))) > (compile 'fact) > (zerop (fact 50000 1)) > > ============================== > > For /u/camm/test/gcl2/bin/gcl [a 2.7.0 I found lying around]: > > Warning: attempting tight relocatable GC > > Unrecoverable error: not enough room to gc relblock. > Abort > > ============================== > > For /p/bin/gcl-2.6.7 [GCL 2.6.7]: > > Unrecoverable error: Pages out of range in make_writable. > Abort > > ============================== > > By the way, the error disappears if I manually remove the flet: > > (defun fact (n acc) > (return-from fact (if (zerop n) > acc > (fact (1- n) > (* n acc))))) > > Thanks -- > -- Matt > > > -- Camm Maguire [EMAIL PROTECTED] ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah _______________________________________________ Gcl-devel mailing list [email protected] http://lists.gnu.org/mailman/listinfo/gcl-devel
