The optimizer's test harness now makes sure that optimized and

non-optimized versions of the same code evaluate to the same thing.

Unfortunately, this leads to a lot of code duplication. We can't
abstract over optimization like we do for the benchmarks since the
wrapper module would interfere with testing expanded code for
equality.

original commit: 7fb1b41a28c1a082e5f726bbc2acab4e2cc0e5fb
This commit is contained in:
Vincent St-Amour 2010-07-13 17:23:53 -04:00
parent 5f878b83bc
commit 9c1a9c4661

View File

@ -26,12 +26,23 @@
(define (test gen)
(let-values (((base name _) (split-path gen)))
(or (regexp-match ".*~" name) ; we ignore backup files
(equal? (parameterize ([current-load-relative-directory
(build-path here "generic")])
(read-and-expand gen))
(let ((hand-opt-dir (build-path here "hand-optimized")))
(parameterize ([current-load-relative-directory hand-opt-dir])
(read-and-expand (build-path hand-opt-dir name)))))
;; machine optimized and hand optimized versions must expand to the
;; same code
(and (equal? (parameterize ([current-load-relative-directory
(build-path here "generic")])
(read-and-expand gen))
(let ((hand-opt-dir (build-path here "hand-optimized")))
(parameterize ([current-load-relative-directory hand-opt-dir])
(read-and-expand (build-path hand-opt-dir name)))))
;; optimized and non-optimized versions must evaluate to the
;; same thing
(equal? (with-output-to-string
(lambda ()
(dynamic-require gen #f)))
(with-output-to-string
(lambda ()
(let ((non-opt-dir (build-path here "non-optimized")))
(dynamic-require (build-path non-opt-dir name) #f))))))
(begin (printf "~a failed\n\n" name)
#f))))