mescc: Cache text generation.
* module/mes/elf-util.mes (functions->text): Add cache.
This commit is contained in:
parent
2397e0c8e2
commit
a010203f0d
|
@ -55,11 +55,16 @@
|
|||
(define (text->list o)
|
||||
(append-map (lambda/label->list '() '() 0 0 0) o))
|
||||
|
||||
(define (functions->text functions globals ta t d)
|
||||
(let loop ((lambdas/labels (functions->lambdas functions)) (text '()))
|
||||
(if (null? lambdas/labels) text
|
||||
(loop (cdr lambdas/labels)
|
||||
(append text ((lambda/label->list functions globals ta (- (length text)) d) (car lambdas/labels)))))))
|
||||
(define functions->text
|
||||
(let ((cache '()))
|
||||
(lambda (functions globals ta t d)
|
||||
(or (assoc-ref cache (cons ta (map car functions)))
|
||||
(let ((text (let loop ((lambdas/labels (functions->lambdas functions)) (text '()))
|
||||
(if (null? lambdas/labels) text
|
||||
(loop (cdr lambdas/labels)
|
||||
(append text ((lambda/label->list functions globals ta (- (length text)) d) (car lambdas/labels))))))))
|
||||
(set! cache (assoc-set! cache (cons ta (map car functions)) text))
|
||||
text)))))
|
||||
|
||||
(define (function-prefix name functions)
|
||||
;; FIXME
|
||||
|
|
Loading…
Reference in a new issue