1 ;;; Guile VM code converters
3 ;; Copyright (C) 2001, 2009, 2012, 2013 Free Software Foundation, Inc.
5 ;;;; This library is free software; you can redistribute it and/or
6 ;;;; modify it under the terms of the GNU Lesser General Public
7 ;;;; License as published by the Free Software Foundation; either
8 ;;;; version 3 of the License, or (at your option) any later version.
10 ;;;; This library is distributed in the hope that it will be useful,
11 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ;;;; Lesser General Public License for more details.
15 ;;;; You should have received a copy of the GNU Lesser General Public
16 ;;;; License along with this library; if not, write to the Free Software
17 ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 (define-module (language scheme decompile-tree-il)
22 #:use-module (language tree-il)
23 #:use-module (srfi srfi-1)
24 #:use-module (srfi srfi-26)
25 #:use-module (ice-9 receive)
26 #:use-module (ice-9 vlist)
27 #:use-module (ice-9 match)
28 #:use-module (system base syntax)
29 #:export (decompile-tree-il))
31 (define (decompile-tree-il e env opts)
32 (apply do-decompile e env opts))
34 (define* (do-decompile e env
36 (use-derived-syntax? #t)
39 (strip-numeric-suffixes? #f)
42 (receive (output-name-table occurrence-count-table)
43 (choose-output-names e use-derived-syntax? strip-numeric-suffixes?)
45 (define (output-name s) (hashq-ref output-name-table s))
46 (define (occurrence-count s) (hashq-ref occurrence-count-table s))
48 (define (const x) (lambda (_) x))
49 (define (atom? x) (not (or (pair? x) (vector? x))))
51 (define (build-void) '(if #f #f))
53 (define (build-begin es)
59 (define (build-lambda-body e)
61 (('let () body ...) body)
65 (define (build-begin-body e)
70 (define (build-define name e)
72 ((? (const avoid-lambda?)
73 ('lambda formals body ...))
74 `(define (,name ,@formals) ,@body))
75 ((? (const avoid-lambda?)
76 ('lambda* formals body ...))
77 `(define* (,name ,@formals) ,@body))
78 (_ `(define ,name ,e))))
80 (define (build-let names vals body)
81 (match `(let ,(map list names vals)
82 ,@(build-lambda-body body))
84 ((_ (b) ('let* (bs ...) body ...))
85 `(let* (,b ,@bs) ,@body))
86 ((? (const use-derived-syntax?)
87 (_ (b1) ('let (b2) body ...)))
88 `(let* (,b1 ,b2) ,@body))
91 (define (build-letrec in-order? names vals body)
92 (match `(,(if in-order? 'letrec* 'letrec)
93 ,(map list names vals)
94 ,@(build-lambda-body body))
96 ((_ () body ...) `(let () ,@body))
97 ((_ ((name ('lambda (formals ...) body ...)))
100 (if (= (length formals) (length args))
101 `(let ,name ,(map list formals args) ,@body)
103 ((? (const avoid-lambda?)
104 ('letrec* _ body ...))
106 ,@(map build-define names vals)
110 (define (build-if test consequent alternate)
112 (('if #f _) `(if ,test ,consequent))
113 (_ `(if ,test ,consequent ,alternate))))
115 (define (build-and xs)
121 (define (build-or xs)
127 (define (case-test-var test)
129 (('memv (? atom? v) ('quote (datums ...)))
131 (('eqv? (? atom? v) ('quote datum))
135 (define (test->datums v test)
137 ((v 'memv v ('quote (xs ...)))
139 ((v 'eqv? v ('quote x))
143 (define (build-else-tail e)
146 (('and xs ... x) `((,(build-and xs) ,@(build-begin-body x))
148 (_ `((else ,@(build-begin-body e))))))
150 (define (build-cond-else-tail e)
152 (('cond clauses ...) clauses)
153 (_ (build-else-tail e))))
155 (define (build-case-else-tail v e)
157 ((v 'case v clauses ...)
159 ((v 'if ('memv v ('quote (xs ...))) consequent . alternate*)
160 `((,xs ,@(build-begin-body consequent))
161 ,@(build-case-else-tail v (build-begin alternate*))))
162 ((v 'if ('eqv? v ('quote x)) consequent . alternate*)
163 `(((,x) ,@(build-begin-body consequent))
164 ,@(build-case-else-tail v (build-begin alternate*))))
165 (_ (build-else-tail e))))
167 (define (clauses+tail clauses)
169 ((cs ... (and c ('else . _))) (values cs (list c)))
170 (_ (values clauses '()))))
172 (define (build-cond tests consequents alternate)
175 ((1) (build-if (car tests) (car consequents) alternate))
176 (else `(cond ,@(map (lambda (test consequent)
177 `(,test ,@(build-begin-body consequent)))
179 ,@(build-cond-else-tail alternate)))))
181 (define (build-cond-or-case tests consequents alternate)
183 (build-cond tests consequents alternate)
184 (let* ((v (and (not (null? tests))
185 (case-test-var (car tests))))
186 (datum-lists (take-while identity
187 (map (cut test->datums v <>)
189 (n (length datum-lists))
190 (tail (build-case-else-tail v (build-cond
194 (receive (clauses tail) (clauses+tail tail)
195 (let ((n (+ n (length clauses)))
196 (datum-lists (append datum-lists
198 (consequents (append consequents
200 (map cdr clauses)))))
202 (build-cond tests consequents alternate)
204 ,@(map cons datum-lists (map build-begin-body
205 (take consequents n)))
210 (define (recurse-body e)
211 (build-lambda-body (recurse e)))
218 (if (and (self-evaluating? exp) (not (vector? exp)))
223 (build-begin (cons (recurse head)
228 (match `(,(recurse proc) ,@(map recurse args))
229 ((('lambda (formals ...) body ...) args ...)
231 (if (= (length formals) (length args))
232 (build-let formals args (build-begin body))
236 ((<primcall> name args)
237 `(,name ,@(map recurse args)))
239 ((<primitive-ref> name)
242 ((<lexical-ref> gensym)
243 (output-name gensym))
245 ((<lexical-set> gensym exp)
246 `(set! ,(output-name gensym) ,(recurse exp)))
248 ((<module-ref> mod name public?)
249 `(,(if public? '@ '@@) ,mod ,name))
251 ((<module-set> mod name public? exp)
252 `(set! (,(if public? '@ '@@) ,mod ,name) ,(recurse exp)))
254 ((<toplevel-ref> name)
257 ((<toplevel-set> name exp)
258 `(set! ,name ,(recurse exp)))
260 ((<toplevel-define> name exp)
261 (build-define name (recurse exp)))
263 ((<lambda> meta body)
265 (let ((body (recurse body))
266 (doc (assq-ref meta 'documentation)))
270 (('lambda formals body ...)
271 `(lambda ,formals ,doc ,@body))
272 (('lambda* formals body ...)
273 `(lambda* ,formals ,doc ,@body))
274 (('case-lambda (formals body ...) clauses ...)
275 `(case-lambda (,formals ,doc ,@body) ,@clauses))
276 (('case-lambda* (formals body ...) clauses ...)
277 `(case-lambda* (,formals ,doc ,@body) ,@clauses))
281 ((<lambda-case> req opt rest kw inits gensyms body alternate)
282 (let ((names (map output-name gensyms)))
284 ((and (not opt) (not kw) (not alternate))
285 `(lambda ,(if rest (apply cons* names) names)
286 ,@(recurse-body body)))
287 ((and (not opt) (not kw))
288 (let ((alt-expansion (recurse alternate))
289 (formals (if rest (apply cons* names) names)))
290 (case (car alt-expansion)
292 `(case-lambda (,formals ,@(recurse-body body))
293 ,(cdr alt-expansion)))
295 `(case-lambda* (,formals ,@(recurse-body body))
296 ,(cdr alt-expansion)))
298 `(case-lambda (,formals ,@(recurse-body body))
299 ,@(cdr alt-expansion)))
301 `(case-lambda* (,formals ,@(recurse-body body))
302 ,@(cdr alt-expansion))))))
304 (let* ((alt-expansion (and alternate (recurse alternate)))
306 (nopt (if opt (length opt) 0))
307 (restargs (if rest (list-ref names (+ nreq nopt)) '()))
308 (reqargs (list-head names nreq))
312 (list-head (list-tail names nreq) nopt)
314 (list-head inits nopt))))
319 (map output-name (map caddr (cdr kw)))
321 (list-tail inits nopt))
324 '(#:allow-other-keys)
327 (formals `(,@reqargs ,@optargs ,@kwargs . ,restargs)))
328 (if (not alt-expansion)
329 `(lambda* ,formals ,@(recurse-body body))
330 (case (car alt-expansion)
332 `(case-lambda* (,formals ,@(recurse-body body))
333 ,(cdr alt-expansion)))
334 ((case-lambda case-lambda*)
335 `(case-lambda* (,formals ,@(recurse-body body))
336 ,@(cdr alt-expansion))))))))))
338 ((<conditional> test consequent alternate)
339 (define (simplify-test e)
341 (('if ('eqv? (? atom? v) ('quote a)) #t ('eqv? v ('quote b)))
343 (('if ('eqv? (? atom? v) ('quote a)) #t ('memv v ('quote (bs ...))))
344 `(memv ,v '(,a ,@bs)))
347 ('else ('eqv? v ('quote last-datum))))
348 `(memv ,v '(,@datum ,last-datum)))
350 (match `(if ,(simplify-test (recurse test))
351 ,(recurse consequent)
352 ,@(if (void? alternate) '()
353 (list (recurse alternate))))
354 (('if test ('if ('and xs ...) consequent))
355 (build-if (build-and (cons test xs))
358 ((? (const use-derived-syntax?)
359 ('if test1 ('if test2 consequent)))
360 (build-if (build-and (list test1 test2))
363 (('if (? atom? x) x ('or ys ...))
364 (build-or (cons x ys)))
365 ((? (const use-derived-syntax?)
366 ('if (? atom? x) x y))
367 (build-or (list x y)))
368 (('if test consequent)
369 `(if ,test ,consequent))
370 (('if test ('and xs ...) #f)
371 (build-and (cons test xs)))
372 ((? (const use-derived-syntax?)
373 ('if test consequent #f))
374 (build-and (list test consequent)))
375 ((? (const use-derived-syntax?)
376 ('if test1 consequent1
377 ('if test2 consequent2 . alternate*)))
378 (build-cond-or-case (list test1 test2)
379 (list consequent1 consequent2)
380 (build-begin alternate*)))
381 (('if test consequent ('cond clauses ...))
382 `(cond (,test ,@(build-begin-body consequent))
384 (('if ('memv (? atom? v) ('quote (xs ...))) consequent
385 ('case v clauses ...))
386 `(case ,v (,xs ,@(build-begin-body consequent))
388 (('if ('eqv? (? atom? v) ('quote x)) consequent
389 ('case v clauses ...))
390 `(case ,v ((,x) ,@(build-begin-body consequent))
394 ((<let> gensyms vals body)
395 (match (build-let (map output-name gensyms)
398 (('let ((v e)) ('or v xs ...))
400 (if (and (not (null? gensyms))
401 (= 3 (occurrence-count (car gensyms))))
404 (('let ((v e)) ('case v clauses ...))
406 (if (and (not (null? gensyms))
407 ;; FIXME: This fails if any of the 'memv's were
408 ;; optimized into multiple 'eqv?'s, because the
409 ;; occurrence count will be higher than we expect.
410 (= (occurrence-count (car gensyms))
411 (1+ (length (clauses+tail clauses)))))
416 ((<letrec> in-order? gensyms vals body)
417 (build-letrec in-order?
418 (map output-name gensyms)
422 ((<fix> gensyms vals body)
423 ;; not a typo, we really do translate back to letrec. use letrec* since it
424 ;; doesn't matter, and the naive letrec* transformation does not require an
427 (map output-name gensyms)
431 ((<let-values> exp body)
432 `(call-with-values (lambda () ,@(recurse-body exp))
433 ,(recurse (make-lambda #f '() body))))
435 ((<prompt> escape-only? tag body handler)
439 `(lambda () ,(recurse body))
444 ((<abort> tag args tail)
445 `(apply abort ,(recurse tag) ,@(map recurse args)
447 (values (recurse e) env)))
449 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
451 ;; Algorithm for choosing better variable names
452 ;; ============================================
454 ;; First we perform an analysis pass, collecting the following
457 ;; * For each gensym: how many occurrences will occur in the output?
459 ;; * For each gensym A: which gensyms does A conflict with? Gensym A
460 ;; and gensym B conflict if they have the same base name (usually the
461 ;; same as the source name, but see below), and if giving them the
462 ;; same name would cause a bad variable reference due to unintentional
465 ;; The occurrence counter is indexed by gensym and is global (within each
466 ;; invocation of the algorithm), implemented using a hash table. We also
467 ;; keep a global mapping from gensym to source name as provided by the
468 ;; binding construct (we prefer not to trust the source names in the
469 ;; lexical ref or set).
471 ;; As we recurse down into lexical binding forms, we keep track of a
472 ;; mapping from base name to an ordered list of bindings, innermost
473 ;; first. When we encounter a variable occurrence, we increment the
474 ;; counter, look up the base name (preferring not to trust the 'name' in
475 ;; the lexical ref or set), and then look up the bindings currently in
476 ;; effect for that base name. Hopefully our gensym will be the first
477 ;; (innermost) binding. If not, we register a conflict between the
478 ;; referenced gensym and the other bound gensyms with the same base name
479 ;; that shadow the binding we want. These are simply the gensyms on the
480 ;; binding list that come before our gensym.
482 ;; Top-level bindings are treated specially. Whenever top-level
483 ;; references are found, they conflict with every lexical binding
484 ;; currently in effect with the same base name. They are guaranteed to
485 ;; be assigned to their source names. For purposes of recording
486 ;; conflicts (which are normally keyed on gensyms) top-level identifiers
487 ;; are assigned a pseudo-gensym that is an interned pair of the form
488 ;; (top-level . <name>). This allows them to be compared using 'eq?'
489 ;; like other gensyms.
491 ;; The base name is normally just the source name. However, if the
492 ;; source name has a suffix of the form "-N" (where N is a positive
493 ;; integer without leading zeroes), then we strip that suffix (multiple
494 ;; times if necessary) to form the base name. We must do this because
495 ;; we add suffixes of that form in order to resolve conflicts, and we
496 ;; must ensure that only identifiers with the same base name can
497 ;; possibly conflict with each other.
499 ;; XXX FIXME: Currently, primitives are treated exactly like top-level
500 ;; bindings. This handles conflicting lexical bindings properly, but
501 ;; does _not_ handle the case where top-level bindings conflict with the
502 ;; needed primitives.
504 ;; Also note that this requires that 'choose-output-names' be kept in
505 ;; sync with 'tree-il->scheme'. Primitives that are introduced by
506 ;; 'tree-il->scheme' must be anticipated by 'choose-output-name'.
508 ;; We also ensure that lexically-bound identifiers found in operator
509 ;; position will never be assigned one of the standard primitive names.
510 ;; This is needed because 'tree-il->scheme' recognizes primitive names
511 ;; in operator position and assumes that they have the standard
515 ;; How we assign an output name to each gensym
516 ;; ===========================================
518 ;; We process the gensyms in order of decreasing occurrence count, with
519 ;; each gensym choosing the best output name possible, as long as it
520 ;; isn't the same name as any of the previously-chosen output names of
521 ;; conflicting gensyms.
526 ;; 'choose-output-names' analyzes the top-level form e, chooses good
527 ;; variable names that are as close as possible to the source names,
528 ;; and returns two values:
530 ;; * a hash table mapping gensym to output name
531 ;; * a hash table mapping gensym to number of occurrences
533 (define choose-output-names
536 ;; This is a list of primitives that 'tree-il->scheme' assumes
537 ;; will have the standard bindings when found in operator
539 (let* ((primitives '(if quote @ @@ set! define define*
540 begin let let* letrec letrec*
542 lambda lambda* case-lambda case-lambda*
543 apply call-with-values dynamic-wind
544 with-fluids fluid-ref fluid-set!
545 call-with-prompt abort memv eqv?))
546 (table (make-hash-table (length primitives))))
547 (for-each (cut hashq-set! table <> #t) primitives)
548 (lambda (name) (hashq-ref table name))))
550 ;; Repeatedly strip suffix of the form "-N", where N is a string
551 ;; that could be produced by number->string given a positive
552 ;; integer. In other words, the first digit of N may not be 0.
553 (define compute-base-name
554 (let ((digits (string->char-set "0123456789")))
555 (define (base-name-string str)
556 (let ((i (string-skip-right str digits)))
557 (if (and i (< (1+ i) (string-length str))
558 (eq? #\- (string-ref str i))
559 (not (eq? #\0 (string-ref str (1+ i)))))
560 (base-name-string (substring str 0 i))
563 (string->symbol (base-name-string (symbol->string sym))))))
565 ;; choose-output-names
566 (lambda (e use-derived-syntax? strip-numeric-suffixes?)
568 (define lexical-gensyms '())
570 (define top-level-intern!
571 (let ((table (make-hash-table)))
573 (let ((h (hashq-create-handle! table name #f)))
574 (or (cdr h) (begin (set-cdr! h (cons 'top-level name))
576 (define (top-level? s) (pair? s))
577 (define (top-level-name s) (cdr s))
579 (define occurrence-count-table (make-hash-table))
580 (define (occurrence-count s) (or (hashq-ref occurrence-count-table s) 0))
581 (define (increment-occurrence-count! s)
582 (let ((h (hashq-create-handle! occurrence-count-table s 0)))
584 (set! lexical-gensyms (cons s lexical-gensyms)))
585 (set-cdr! h (1+ (cdr h)))))
588 (let ((table (make-hash-table)))
590 (let ((h (hashq-create-handle! table name #f)))
591 (or (cdr h) (begin (set-cdr! h (compute-base-name name))
594 (define source-name-table (make-hash-table))
595 (define (set-source-name! s name)
596 (if (not (top-level? s))
597 (let ((name (if strip-numeric-suffixes?
600 (hashq-set! source-name-table s name))))
601 (define (source-name s)
604 (hashq-ref source-name-table s)))
606 (define conflict-table (make-hash-table))
607 (define (conflicts s) (or (hashq-ref conflict-table s) '()))
608 (define (add-conflict! a b)
610 (if (not (top-level? a))
611 (let ((h (hashq-create-handle! conflict-table a '())))
612 (if (not (memq b (cdr h)))
613 (set-cdr! h (cons b (cdr h)))))))
617 (let recurse-with-bindings ((e e) (bindings vlist-null))
620 ;; We call this whenever we encounter a top-level ref or set
621 (define (top-level name)
622 (let ((bname (base-name name)))
623 (let ((s (top-level-intern! name))
624 (conflicts (vhash-foldq* cons '() bname bindings)))
625 (for-each (cut add-conflict! s <>) conflicts))))
627 ;; We call this whenever we encounter a primitive reference.
628 ;; We must also call it for every primitive that might be
629 ;; inserted by 'tree-il->scheme'. It is okay to call this
630 ;; even when 'tree-il->scheme' will not insert the named
631 ;; primitive; the worst that will happen is for a lexical
632 ;; variable of the same name to be renamed unnecessarily.
633 (define (primitive name) (top-level name))
635 ;; We call this whenever we encounter a lexical ref or set.
637 (increment-occurrence-count! s)
640 (lambda (s*) (not (eq? s s*)))
641 (reverse! (vhash-foldq* cons
643 (base-name (source-name s))
645 (for-each (cut add-conflict! s <>) conflicts)))
648 ((<void>) (primitive 'if)) ; (if #f #f)
649 ((<const>) (primitive 'quote))
652 (if (lexical-ref? proc)
653 (let* ((gensym (lexical-ref-gensym proc))
654 (name (source-name gensym)))
655 ;; If the operator position contains a bare variable
656 ;; reference with the same source name as a standard
657 ;; primitive, we must ensure that it will be given a
658 ;; different name, so that 'tree-il->scheme' will not
659 ;; misinterpret the resulting expression.
660 (if (primitive? name)
661 (add-conflict! gensym (top-level-intern! name)))))
663 (for-each recurse args))
665 ((<primitive-ref> name) (primitive name))
666 ((<primcall> name args) (primitive name) (for-each recurse args))
668 ((<lexical-ref> gensym) (lexical gensym))
669 ((<lexical-set> gensym exp)
670 (primitive 'set!) (lexical gensym) (recurse exp))
672 ((<module-ref> public?) (primitive (if public? '@ '@@)))
673 ((<module-set> public? exp)
674 (primitive 'set!) (primitive (if public? '@ '@@)) (recurse exp))
676 ((<toplevel-ref> name) (top-level name))
677 ((<toplevel-set> name exp)
678 (primitive 'set!) (top-level name) (recurse exp))
679 ((<toplevel-define> name exp) (top-level name) (recurse exp))
681 ((<conditional> test consequent alternate)
682 (cond (use-derived-syntax?
683 (primitive 'and) (primitive 'or)
684 (primitive 'cond) (primitive 'case)
685 (primitive 'else) (primitive '=>)))
687 (recurse test) (recurse consequent) (recurse alternate))
690 (primitive 'begin) (recurse head) (recurse tail))
693 (if body (recurse body) (primitive 'case-lambda)))
695 ((<lambda-case> req opt rest kw inits gensyms body alternate)
697 (cond ((or opt kw alternate)
699 (primitive 'case-lambda)
700 (primitive 'case-lambda*)))
702 (if use-derived-syntax? (primitive 'let*))
703 (let* ((names (append req (or opt '()) (if rest (list rest) '())
704 (map cadr (if kw (cdr kw) '()))))
705 (base-names (map base-name names))
707 (fold vhash-consq bindings base-names gensyms)))
708 (for-each increment-occurrence-count! gensyms)
709 (for-each set-source-name! gensyms names)
710 (for-each recurse inits)
711 (recurse-with-bindings body body-bindings)
712 (if alternate (recurse alternate))))
714 ((<let> names gensyms vals body)
716 (cond (use-derived-syntax? (primitive 'let*) (primitive 'or)))
717 (for-each increment-occurrence-count! gensyms)
718 (for-each set-source-name! gensyms names)
719 (for-each recurse vals)
720 (recurse-with-bindings
721 body (fold vhash-consq bindings (map base-name names) gensyms)))
723 ((<letrec> in-order? names gensyms vals body)
725 (cond (use-derived-syntax? (primitive 'let*) (primitive 'or)))
726 (primitive (if in-order? 'letrec* 'letrec))
727 (for-each increment-occurrence-count! gensyms)
728 (for-each set-source-name! gensyms names)
729 (let* ((base-names (map base-name names))
730 (bindings (fold vhash-consq bindings base-names gensyms)))
731 (for-each (cut recurse-with-bindings <> bindings) vals)
732 (recurse-with-bindings body bindings)))
734 ((<fix> names gensyms vals body)
737 (cond (use-derived-syntax? (primitive 'let*) (primitive 'or)))
738 (for-each increment-occurrence-count! gensyms)
739 (for-each set-source-name! gensyms names)
740 (let* ((base-names (map base-name names))
741 (bindings (fold vhash-consq bindings base-names gensyms)))
742 (for-each (cut recurse-with-bindings <> bindings) vals)
743 (recurse-with-bindings body bindings)))
745 ((<let-values> exp body)
746 (primitive 'call-with-values)
747 (recurse exp) (recurse body))
749 ((<prompt> tag body handler)
750 (primitive 'call-with-prompt)
751 (recurse tag) (recurse body) (recurse handler))
753 ((<abort> tag args tail)
756 (recurse tag) (for-each recurse args) (recurse tail)))))
759 (define output-name-table (make-hash-table))
760 (define (set-output-name! s name)
761 (hashq-set! output-name-table s name))
762 (define (output-name s)
765 (hashq-ref output-name-table s)))
767 (define sorted-lexical-gensyms
768 (sort-list lexical-gensyms
769 (lambda (a b) (> (occurrence-count a)
770 (occurrence-count b)))))
772 (for-each (lambda (s)
775 (let ((the-conflicts (conflicts s))
776 (the-source-name (source-name s)))
777 (define (not-yet-taken? name)
778 (not (any (lambda (s*)
779 (and=> (output-name s*)
782 (if (not-yet-taken? the-source-name)
784 (let ((prefix (string-append
785 (symbol->string the-source-name)
787 (let loop ((i 1) (name the-source-name))
788 (if (not-yet-taken? name)
794 (number->string i)))))))))))
795 sorted-lexical-gensyms)
796 (values output-name-table occurrence-count-table)))))