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)
|
(define (text->list o)
|
||||||
(append-map (lambda/label->list '() '() 0 0 0) o))
|
(append-map (lambda/label->list '() '() 0 0 0) o))
|
||||||
|
|
||||||
(define (functions->text functions globals ta t d)
|
(define functions->text
|
||||||
(let loop ((lambdas/labels (functions->lambdas functions)) (text '()))
|
(let ((cache '()))
|
||||||
(if (null? lambdas/labels) text
|
(lambda (functions globals ta t d)
|
||||||
(loop (cdr lambdas/labels)
|
(or (assoc-ref cache (cons ta (map car functions)))
|
||||||
(append text ((lambda/label->list functions globals ta (- (length text)) d) (car lambdas/labels)))))))
|
(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)
|
(define (function-prefix name functions)
|
||||||
;; FIXME
|
;; FIXME
|
||||||
|
|
Loading…
Reference in New Issue