Hi Andy! Just a meta-comment before I actually look into the code and fully appreciate your work. :-)
"Andy Wingo" <wi...@pobox.com> skribis: > commit 02ebea537fa805c615df44c4228db6a44d74c4b3 > Author: Andy Wingo <wi...@pobox.com> > Date: Fri Sep 23 12:43:04 2011 +0200 > > peval: simpler and more precise treatment of mutability > > * module/language/tree-il/optimize.scm (peval): The old approach of > optimistically producing constants and then de-constifying them at > their uses was not only cumbersome but incorrect: it both failed to > preserve identity in some cases and failed to retain immutable > constant values. Instead, now we only produce constants if they > really are constant and immutable. The constant folder has to have a > few more algebraic cases to be as effective as it was, to destructure > (car (cons _ _)) appropriately. On the plus side, now constructors > and deconstructors can handle impure cases more generally. [...] > +(define* (build-var-table exp #:optional (table vlist-null)) > + (tree-il-fold > + (lambda (exp res) > + (match exp > + (($ <lexical-ref> src name gensym) > + (let ((var (vhash-assq gensym res))) > + (if var > + (begin > + (set-var-refcount! (cdr var) (1+ (var-refcount (cdr var)))) > + res) > + (vhash-consq gensym (make-var name gensym 1 #f) res)))) > + (_ res))) > + (lambda (exp res) > + (match exp > + (($ <lexical-set> src name gensym exp) > + (let ((var (vhash-assq gensym res))) > + (if var > + (begin > + (set-var-set?! (cdr var) #t) > + res) > + (vhash-consq gensym (make-var name gensym 0 #t) res)))) > + (_ res))) > + (lambda (exp res) res) > + table exp)) > + > +(define-record-type <counter> > + (%make-counter effort size continuation recursive? data prev) > + counter? > + (effort effort-counter) > + (size size-counter) > + (continuation counter-continuation) > + (recursive? counter-recursive?) > + (data counter-data) > + (prev counter-prev)) Would it be possible to move the explanations from the commit log to comments in the code? Looking at the above code, I have no idea what a var-table or a counter is, what it’s used for, etc. Thanks, Ludo’.