Fixes a bug in metafunction traces

When the result is in the cache but the cache is not consulted because
`caching-enabled?' is false, the call should not be shown as cached.
This commit is contained in:
Casey Klein 2011-01-14 09:40:51 -06:00
parent 61607c4da1
commit b45bb829b6
2 changed files with 10 additions and 1 deletions

View File

@ -1666,7 +1666,8 @@
(memq name (current-traced-metafunctions))) (memq name (current-traced-metafunctions)))
(parameterize ([current-trace-print-args (parameterize ([current-trace-print-args
(λ (name args kws kw-args level) (λ (name args kws kw-args level)
(if (eq? not-in-cache (hash-ref cache exp not-in-cache)) (if (or (not (caching-enabled?))
(eq? not-in-cache (hash-ref cache exp not-in-cache)))
(display " ") (display " ")
(display "c")) (display "c"))
(ot name (car args) kws kw-args level))] (ot name (car args) kws kw-args level))]

View File

@ -784,6 +784,14 @@
(term (f 1))) (term (f 1)))
(test (get-output-string sp) "c>(f 1)\n <0\n")) (test (get-output-string sp) "c>(f 1)\n <0\n"))
(let ([sp (open-output-string)])
(parameterize ([current-output-port sp]
[current-traced-metafunctions 'all]
[print-as-expression #f]
[caching-enabled? #f])
(term (f 1)))
(test (get-output-string sp) " >(f 1)\n > (f 0)\n < 0\n <0\n"))
(let ([sp (open-output-string)]) (let ([sp (open-output-string)])
(parameterize ([current-output-port sp] (parameterize ([current-output-port sp]
[current-traced-metafunctions '(f)] [current-traced-metafunctions '(f)]