cse.scm 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. ;;; Common Subexpression Elimination (CSE) on Tree-IL
  2. ;; Copyright (C) 2011, 2012, 2013 Free Software Foundation, Inc.
  3. ;;;; This library is free software; you can redistribute it and/or
  4. ;;;; modify it under the terms of the GNU Lesser General Public
  5. ;;;; License as published by the Free Software Foundation; either
  6. ;;;; version 3 of the License, or (at your option) any later version.
  7. ;;;;
  8. ;;;; This library is distributed in the hope that it will be useful,
  9. ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. ;;;; Lesser General Public License for more details.
  12. ;;;;
  13. ;;;; You should have received a copy of the GNU Lesser General Public
  14. ;;;; License along with this library; if not, write to the Free Software
  15. ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  16. (define-module (language tree-il cse)
  17. #:use-module (language tree-il)
  18. #:use-module (language tree-il primitives)
  19. #:use-module (language tree-il effects)
  20. #:use-module (ice-9 vlist)
  21. #:use-module (ice-9 match)
  22. #:use-module (srfi srfi-1)
  23. #:use-module (srfi srfi-9)
  24. #:use-module (srfi srfi-11)
  25. #:use-module (srfi srfi-26)
  26. #:export (cse))
  27. ;;;
  28. ;;; This pass eliminates common subexpressions in Tree-IL. It works
  29. ;;; best locally -- within a function -- so it is meant to be run after
  30. ;;; partial evaluation, which usually inlines functions and so opens up
  31. ;;; a bigger space for CSE to work.
  32. ;;;
  33. ;;; The algorithm traverses the tree of expressions, returning two
  34. ;;; values: the newly rebuilt tree, and a "database". The database is
  35. ;;; the set of expressions that will have been evaluated as part of
  36. ;;; evaluating an expression. For example, in:
  37. ;;;
  38. ;;; (1- (+ (if a b c) (* x y)))
  39. ;;;
  40. ;;; We can say that when it comes time to evaluate (1- <>), that the
  41. ;;; subexpressions +, x, y, and (* x y) must have been evaluated in
  42. ;;; values context. We know that a was evaluated in test context, but
  43. ;;; we don't know if it was true or false.
  44. ;;;
  45. ;;; The expressions in the database /dominate/ any subsequent
  46. ;;; expression: FOO dominates BAR if evaluation of BAR implies that any
  47. ;;; effects associated with FOO have already occured.
  48. ;;;
  49. ;;; When adding expressions to the database, we record the context in
  50. ;;; which they are evaluated. We treat expressions in test context
  51. ;;; specially: the presence of such an expression indicates that the
  52. ;;; expression is true. In this way we can elide duplicate predicates.
  53. ;;;
  54. ;;; Duplicate predicates are not common in code that users write, but
  55. ;;; can occur quite frequently in macro-generated code.
  56. ;;;
  57. ;;; For example:
  58. ;;;
  59. ;;; (and (foo? x) (foo-bar x))
  60. ;;; => (if (and (struct? x) (eq? (struct-vtable x) <foo>))
  61. ;;; (if (and (struct? x) (eq? (struct-vtable x) <foo>))
  62. ;;; (struct-ref x 1)
  63. ;;; (throw 'not-a-foo))
  64. ;;; #f))
  65. ;;; => (if (and (struct? x) (eq? (struct-vtable x) <foo>))
  66. ;;; (struct-ref x 1)
  67. ;;; #f)
  68. ;;;
  69. ;;; A conditional bailout in effect context also has the effect of
  70. ;;; adding predicates to the database:
  71. ;;;
  72. ;;; (begin (foo-bar x) (foo-baz x))
  73. ;;; => (begin
  74. ;;; (if (and (struct? x) (eq? (struct-vtable x) <foo>))
  75. ;;; (struct-ref x 1)
  76. ;;; (throw 'not-a-foo))
  77. ;;; (if (and (struct? x) (eq? (struct-vtable x) <foo>))
  78. ;;; (struct-ref x 2)
  79. ;;; (throw 'not-a-foo)))
  80. ;;; => (begin
  81. ;;; (if (and (struct? x) (eq? (struct-vtable x) <foo>))
  82. ;;; (struct-ref x 1)
  83. ;;; (throw 'not-a-foo))
  84. ;;; (struct-ref x 2))
  85. ;;;
  86. ;;; When removing code, we have to ensure that the semantics of the
  87. ;;; source program and the residual program are the same. It's easy to
  88. ;;; ensure that they have the same value, because those manipulations
  89. ;;; are just algebraic, but the tricky thing is to ensure that the
  90. ;;; expressions exhibit the same ordering of effects. For that, we use
  91. ;;; the effects analysis of (language tree-il effects). We only
  92. ;;; eliminate code if the duplicate code commutes with all of the
  93. ;;; dominators on the path from the duplicate to the original.
  94. ;;;
  95. ;;; The implementation uses vhashes as the fundamental data structure.
  96. ;;; This can be seen as a form of global value numbering. This
  97. ;;; algorithm currently spends most of its time in vhash-assoc. I'm not
  98. ;;; sure whether that is due to our bad hash function in Guile 2.0, an
  99. ;;; inefficiency in vhashes, or what. Overall though the complexity
  100. ;;; should be linear, or N log N -- whatever vhash-assoc's complexity
  101. ;;; is. Walking the dominators is nonlinear, but that only happens when
  102. ;;; we've actually found a common subexpression so that should be OK.
  103. ;;;
  104. ;; Logging helpers, as in peval.
  105. ;;
  106. (define-syntax *logging* (identifier-syntax #f))
  107. ;; (define %logging #f)
  108. ;; (define-syntax *logging* (identifier-syntax %logging))
  109. (define-syntax log
  110. (syntax-rules (quote)
  111. ((log 'event arg ...)
  112. (if (and *logging*
  113. (or (eq? *logging* #t)
  114. (memq 'event *logging*)))
  115. (log* 'event arg ...)))))
  116. (define (log* event . args)
  117. (let ((pp (module-ref (resolve-interface '(ice-9 pretty-print))
  118. 'pretty-print)))
  119. (pp `(log ,event . ,args))
  120. (newline)
  121. (values)))
  122. ;; A pre-pass on the source program to determine the set of assigned
  123. ;; lexicals.
  124. ;;
  125. (define* (build-assigned-var-table exp #:optional (table vlist-null))
  126. (tree-il-fold
  127. (lambda (exp res)
  128. (match exp
  129. (($ <lexical-set> src name gensym exp)
  130. (vhash-consq gensym #t res))
  131. (_ res)))
  132. (lambda (exp res) res)
  133. table exp))
  134. (define (boolean-valued-primitive? primitive)
  135. (or (negate-primitive primitive)
  136. (eq? primitive 'not)
  137. (let ((chars (symbol->string primitive)))
  138. (eqv? (string-ref chars (1- (string-length chars)))
  139. #\?))))
  140. (define (boolean-valued-expression? x ctx)
  141. (match x
  142. (($ <primcall> _ (? boolean-valued-primitive?)) #t)
  143. (($ <const> _ (? boolean?)) #t)
  144. (_ (eq? ctx 'test))))
  145. (define (singly-valued-expression? x ctx)
  146. (match x
  147. (($ <const>) #t)
  148. (($ <lexical-ref>) #t)
  149. (($ <void>) #t)
  150. (($ <lexical-ref>) #t)
  151. (($ <primitive-ref>) #t)
  152. (($ <module-ref>) #t)
  153. (($ <toplevel-ref>) #t)
  154. (($ <primcall> _ (? singly-valued-primitive?)) #t)
  155. (($ <primcall> _ 'values (val)) #t)
  156. (($ <lambda>) #t)
  157. (_ (eq? ctx 'value))))
  158. (define* (cse exp)
  159. "Eliminate common subexpressions in EXP."
  160. (define assigned-lexical?
  161. (let ((table (build-assigned-var-table exp)))
  162. (lambda (sym)
  163. (vhash-assq sym table))))
  164. (define %compute-effects
  165. (make-effects-analyzer assigned-lexical?))
  166. (define (negate exp ctx)
  167. (match exp
  168. (($ <const> src x)
  169. (make-const src (not x)))
  170. (($ <void> src)
  171. (make-const src #f))
  172. (($ <conditional> src test consequent alternate)
  173. (make-conditional src test (negate consequent ctx) (negate alternate ctx)))
  174. (($ <primcall> _ 'not
  175. ((and x (? (cut boolean-valued-expression? <> ctx)))))
  176. x)
  177. (($ <primcall> src (and pred (? negate-primitive)) args)
  178. (make-primcall src (negate-primitive pred) args))
  179. (_
  180. (make-primcall #f 'not (list exp)))))
  181. (define (hasher n)
  182. (lambda (x size) (modulo n size)))
  183. (define (add-to-db exp effects ctx db)
  184. (let ((v (vector exp effects ctx))
  185. (h (tree-il-hash exp)))
  186. (vhash-cons v h db (hasher h))))
  187. (define (control-flow-boundary db)
  188. (let ((h (hashq 'lambda most-positive-fixnum)))
  189. (vhash-cons 'lambda h db (hasher h))))
  190. (define (find-dominating-expression exp effects ctx db)
  191. (define (entry-matches? v1 v2)
  192. (match (if (vector? v1) v1 v2)
  193. (#(exp* effects* ctx*)
  194. (and (tree-il=? exp exp*)
  195. (or (not ctx) (eq? ctx* ctx))))
  196. (_ #f)))
  197. (let ((len (vlist-length db))
  198. (h (tree-il-hash exp)))
  199. (and (vhash-assoc #t db entry-matches? (hasher h))
  200. (let lp ((n 0))
  201. (and (< n len)
  202. (match (vlist-ref db n)
  203. (('lambda . h*)
  204. ;; We assume that lambdas can escape and thus be
  205. ;; called from anywhere. Thus code inside a lambda
  206. ;; only has a dominating expression if it does not
  207. ;; depend on any effects.
  208. (and (not (depends-on-effects? effects &all-effects))
  209. (lp (1+ n))))
  210. ((#(exp* effects* ctx*) . h*)
  211. (log 'walk (unparse-tree-il exp) effects
  212. (unparse-tree-il exp*) effects* ctx*)
  213. (or (and (= h h*)
  214. (or (not ctx) (eq? ctx ctx*))
  215. (tree-il=? exp exp*))
  216. (and (effects-commute? effects effects*)
  217. (lp (1+ n)))))))))))
  218. ;; Return #t if EXP is dominated by an instance of itself. In that
  219. ;; case, we can exclude *type-check* effects, because the first
  220. ;; expression already caused them if needed.
  221. (define (has-dominating-effect? exp effects db)
  222. (or (constant? effects)
  223. (and
  224. (effect-free?
  225. (exclude-effects effects
  226. (logior &zero-values
  227. &allocation
  228. &type-check)))
  229. (find-dominating-expression exp effects #f db))))
  230. (define (find-dominating-test exp effects db)
  231. (and
  232. (effect-free?
  233. (exclude-effects effects (logior &allocation
  234. &type-check)))
  235. (match exp
  236. (($ <const> src val)
  237. (if (boolean? val)
  238. exp
  239. (make-const src (not (not val)))))
  240. ;; For (not FOO), try to prove FOO, then negate the result.
  241. (($ <primcall> src 'not (exp*))
  242. (match (find-dominating-test exp* effects db)
  243. (($ <const> _ val)
  244. (log 'inferring exp (not val))
  245. (make-const src (not val)))
  246. (_
  247. #f)))
  248. (_
  249. (cond
  250. ((find-dominating-expression exp effects 'test db)
  251. ;; We have an EXP fact, so we infer #t.
  252. (log 'inferring exp #t)
  253. (make-const (tree-il-src exp) #t))
  254. ((find-dominating-expression (negate exp 'test) effects 'test db)
  255. ;; We have a (not EXP) fact, so we infer #f.
  256. (log 'inferring exp #f)
  257. (make-const (tree-il-src exp) #f))
  258. (else
  259. ;; Otherwise we don't know.
  260. #f))))))
  261. (define (add-to-env exp name sym db env)
  262. (let* ((v (vector exp name sym (vlist-length db)))
  263. (h (tree-il-hash exp)))
  264. (vhash-cons v h env (hasher h))))
  265. (define (augment-env env names syms exps db)
  266. (if (null? names)
  267. env
  268. (let ((name (car names)) (sym (car syms)) (exp (car exps)))
  269. (augment-env (if (or (assigned-lexical? sym)
  270. (lexical-ref? exp))
  271. env
  272. (add-to-env exp name sym db env))
  273. (cdr names) (cdr syms) (cdr exps) db))))
  274. (define (find-dominating-lexical exp effects env db)
  275. (define (entry-matches? v1 v2)
  276. (match (if (vector? v1) v1 v2)
  277. (#(exp* name sym db)
  278. (tree-il=? exp exp*))
  279. (_ #f)))
  280. (define (unroll db base n)
  281. (or (zero? n)
  282. (match (vlist-ref db base)
  283. (('lambda . h*)
  284. ;; See note in find-dominating-expression.
  285. (and (not (depends-on-effects? effects &all-effects))
  286. (unroll db (1+ base) (1- n))))
  287. ((#(exp* effects* ctx*) . h*)
  288. (and (effects-commute? effects effects*)
  289. (unroll db (1+ base) (1- n)))))))
  290. (let ((h (tree-il-hash exp)))
  291. (and (effect-free? (exclude-effects effects &type-check))
  292. (vhash-assoc exp env entry-matches? (hasher h))
  293. (let ((env-len (vlist-length env))
  294. (db-len (vlist-length db)))
  295. (let lp ((n 0) (m 0))
  296. (and (< n env-len)
  297. (match (vlist-ref env n)
  298. ((#(exp* name sym db-len*) . h*)
  299. (let ((niter (- (- db-len db-len*) m)))
  300. (and (unroll db m niter)
  301. (if (and (= h h*) (tree-il=? exp* exp))
  302. (make-lexical-ref (tree-il-src exp) name sym)
  303. (lp (1+ n) (- db-len db-len*)))))))))))))
  304. (define (lookup-lexical sym env)
  305. (let ((env-len (vlist-length env)))
  306. (let lp ((n 0))
  307. (and (< n env-len)
  308. (match (vlist-ref env n)
  309. ((#(exp _ sym* _) . _)
  310. (if (eq? sym sym*)
  311. exp
  312. (lp (1+ n)))))))))
  313. (define (intersection db+ db-)
  314. (vhash-fold-right
  315. (lambda (k h out)
  316. (if (vhash-assoc k db- equal? (hasher h))
  317. (vhash-cons k h out (hasher h))
  318. out))
  319. vlist-null
  320. db+))
  321. (define (concat db1 db2)
  322. (vhash-fold-right (lambda (k h tail)
  323. (vhash-cons k h tail (hasher h)))
  324. db2 db1))
  325. (let visit ((exp exp)
  326. (db vlist-null) ; dominating expressions: #(exp effects ctx) -> hash
  327. (env vlist-null) ; named expressions: #(exp name sym db) -> hash
  328. (ctx 'values)) ; test, effect, value, or values
  329. (define (parallel-visit exps db env ctx)
  330. (let lp ((in exps) (out '()) (db* vlist-null))
  331. (if (pair? in)
  332. (call-with-values (lambda () (visit (car in) db env ctx))
  333. (lambda (x db**)
  334. (lp (cdr in) (cons x out) (concat db** db*))))
  335. (values (reverse out) db*))))
  336. (define (compute-effects exp)
  337. (%compute-effects exp (lambda (sym) (lookup-lexical sym env))))
  338. (define (bailout? exp)
  339. (causes-effects? (compute-effects exp) &definite-bailout))
  340. (define (return exp db*)
  341. (let ((effects (compute-effects exp)))
  342. (cond
  343. ((and (eq? ctx 'effect)
  344. (not (lambda-case? exp))
  345. (or (effect-free?
  346. (exclude-effects effects
  347. (logior &zero-values
  348. &allocation)))
  349. (has-dominating-effect? exp effects db)))
  350. (cond
  351. ((void? exp)
  352. (values exp db*))
  353. (else
  354. (log 'elide ctx (unparse-tree-il exp))
  355. (values (make-void #f) db*))))
  356. ((and (boolean-valued-expression? exp ctx)
  357. (find-dominating-test exp effects db))
  358. => (lambda (exp)
  359. (log 'propagate-test ctx (unparse-tree-il exp))
  360. (values exp db*)))
  361. ((and (singly-valued-expression? exp ctx)
  362. (find-dominating-lexical exp effects env db))
  363. => (lambda (exp)
  364. (log 'propagate-value ctx (unparse-tree-il exp))
  365. (values exp db*)))
  366. ((and (constant? effects) (memq ctx '(value values)))
  367. ;; Adds nothing to the db.
  368. (values exp db*))
  369. (else
  370. (log 'return ctx effects (unparse-tree-il exp) db*)
  371. (values exp
  372. (add-to-db exp effects ctx db*))))))
  373. (log 'visit ctx (unparse-tree-il exp) db env)
  374. (match exp
  375. (($ <const>)
  376. (return exp vlist-null))
  377. (($ <void>)
  378. (return exp vlist-null))
  379. (($ <lexical-ref> _ _ gensym)
  380. (return exp vlist-null))
  381. (($ <lexical-set> src name gensym exp)
  382. (let*-values (((exp db*) (visit exp db env 'value)))
  383. (return (make-lexical-set src name gensym exp)
  384. db*)))
  385. (($ <let> src names gensyms vals body)
  386. (let*-values (((vals db*) (parallel-visit vals db env 'value))
  387. ((body db**) (visit body (concat db* db)
  388. (augment-env env names gensyms vals db)
  389. ctx)))
  390. (return (make-let src names gensyms vals body)
  391. (concat db** db*))))
  392. (($ <letrec> src in-order? names gensyms vals body)
  393. (let*-values (((vals db*) (parallel-visit vals db env 'value))
  394. ((body db**) (visit body (concat db* db)
  395. (augment-env env names gensyms vals db)
  396. ctx)))
  397. (return (make-letrec src in-order? names gensyms vals body)
  398. (concat db** db*))))
  399. (($ <fix> src names gensyms vals body)
  400. (let*-values (((vals db*) (parallel-visit vals db env 'value))
  401. ((body db**) (visit body (concat db* db) env ctx)))
  402. (return (make-fix src names gensyms vals body)
  403. (concat db** db*))))
  404. (($ <let-values> src producer consumer)
  405. (let*-values (((producer db*) (visit producer db env 'values))
  406. ((consumer db**) (visit consumer (concat db* db) env ctx)))
  407. (return (make-let-values src producer consumer)
  408. (concat db** db*))))
  409. (($ <toplevel-ref>)
  410. (return exp vlist-null))
  411. (($ <module-ref>)
  412. (return exp vlist-null))
  413. (($ <module-set> src mod name public? exp)
  414. (let*-values (((exp db*) (visit exp db env 'value)))
  415. (return (make-module-set src mod name public? exp)
  416. db*)))
  417. (($ <toplevel-define> src name exp)
  418. (let*-values (((exp db*) (visit exp db env 'value)))
  419. (return (make-toplevel-define src name exp)
  420. db*)))
  421. (($ <toplevel-set> src name exp)
  422. (let*-values (((exp db*) (visit exp db env 'value)))
  423. (return (make-toplevel-set src name exp)
  424. db*)))
  425. (($ <primitive-ref>)
  426. (return exp vlist-null))
  427. (($ <conditional> src test consequent alternate)
  428. (let*-values
  429. (((test db+) (visit test db env 'test))
  430. ((converse db-) (visit (negate test 'test) db env 'test))
  431. ((consequent db++) (visit consequent (concat db+ db) env ctx))
  432. ((alternate db--) (visit alternate (concat db- db) env ctx)))
  433. (match (make-conditional src test consequent alternate)
  434. (($ <conditional> _ ($ <const> _ exp))
  435. (if exp
  436. (return consequent (concat db++ db+))
  437. (return alternate (concat db-- db-))))
  438. ;; (if FOO A A) => (begin FOO A)
  439. (($ <conditional> src _
  440. ($ <const> _ a) ($ <const> _ (? (cut equal? a <>))))
  441. (visit (make-seq #f test (make-const #f a))
  442. db env ctx))
  443. ;; (if FOO #t #f) => FOO for boolean-valued FOO.
  444. (($ <conditional> src
  445. (? (cut boolean-valued-expression? <> ctx))
  446. ($ <const> _ #t) ($ <const> _ #f))
  447. (return test db+))
  448. ;; (if FOO #f #t) => (not FOO)
  449. (($ <conditional> src _ ($ <const> _ #f) ($ <const> _ #t))
  450. (visit (negate test ctx) db env ctx))
  451. ;; Allow "and"-like conditions to accumulate in test context.
  452. ((and c ($ <conditional> _ _ _ ($ <const> _ #f)))
  453. (return c (if (eq? ctx 'test) (concat db++ db+) vlist-null)))
  454. ((and c ($ <conditional> _ _ ($ <const> _ #f) _))
  455. (return c (if (eq? ctx 'test) (concat db-- db-) vlist-null)))
  456. ;; Conditional bailouts turn expressions into predicates.
  457. ((and c ($ <conditional> _ _ _ (? bailout?)))
  458. (return c (concat db++ db+)))
  459. ((and c ($ <conditional> _ _ (? bailout?) _))
  460. (return c (concat db-- db-)))
  461. (c
  462. (return c (intersection (concat db++ db+) (concat db-- db-)))))))
  463. (($ <primcall> src primitive args)
  464. (let*-values (((args db*) (parallel-visit args db env 'value)))
  465. (return (make-primcall src primitive args) db*)))
  466. (($ <call> src proc args)
  467. (let*-values (((proc db*) (visit proc db env 'value))
  468. ((args db**) (parallel-visit args db env 'value)))
  469. (return (make-call src proc args)
  470. (concat db** db*))))
  471. (($ <lambda> src meta body)
  472. (let*-values (((body _) (if body
  473. (visit body (control-flow-boundary db)
  474. env 'values)
  475. (values #f #f))))
  476. (return (make-lambda src meta body)
  477. vlist-null)))
  478. (($ <lambda-case> src req opt rest kw inits gensyms body alt)
  479. (let*-values (((inits _) (parallel-visit inits db env 'value))
  480. ((body db*) (visit body db env ctx))
  481. ((alt _) (if alt
  482. (visit alt db env ctx)
  483. (values #f #f))))
  484. (return (make-lambda-case src req opt rest kw inits gensyms body alt)
  485. (if alt vlist-null db*))))
  486. (($ <seq> src head tail)
  487. (let*-values (((head db*) (visit head db env 'effect)))
  488. (cond
  489. ((void? head)
  490. (visit tail db env ctx))
  491. (else
  492. (let*-values (((tail db**) (visit tail (concat db* db) env ctx)))
  493. (values (make-seq src head tail)
  494. (concat db** db*)))))))
  495. (($ <prompt> src escape-only? tag body handler)
  496. (let*-values (((tag db*) (visit tag db env 'value))
  497. ((body _) (visit body (concat db* db) env
  498. (if escape-only? ctx 'value)))
  499. ((handler _) (visit handler (concat db* db) env 'value)))
  500. (return (make-prompt src escape-only? tag body handler)
  501. db*)))
  502. (($ <abort> src tag args tail)
  503. (let*-values (((tag db*) (visit tag db env 'value))
  504. ((args db**) (parallel-visit args db env 'value))
  505. ((tail db***) (visit tail db env 'value)))
  506. (return (make-abort src tag args tail)
  507. (concat db* (concat db** db***))))))))