From 6a1714a6b9556de3f67872355265f44e43c056cf Mon Sep 17 00:00:00 2001 From: zane <39070793+zaneenders@users.noreply.github.com> Date: Thu, 31 Oct 2024 12:26:21 -0600 Subject: [PATCH] Delete extra code. Touch up variables and literals. --- src/core/localize.rkt | 45 ++++--------------------------------------- 1 file changed, 4 insertions(+), 41 deletions(-) diff --git a/src/core/localize.rkt b/src/core/localize.rkt index 855ce148c..79aad8d0b 100644 --- a/src/core/localize.rkt +++ b/src/core/localize.rkt @@ -219,14 +219,12 @@ (define expr-batch (progs->batch exprs-list)) (define nodes (batch-nodes expr-batch)) (define roots (batch-roots expr-batch)) - (eprintf "exprs:~a\n" (length exprs-list)) - (eprintf "~a\n" exprs-list) ; TODO don't ignore the status code from make-real-compiler in eval-progs-real (define subexprs-fn (eval-progs-real spec-list ctx-list)) (define actual-value-fn (compile-progs exprs-list ctx)) - ; TODO way too much allocation for what we are doing. + ; TODO This is a mess, don't need 4 loops (define errs (for/vector #:length (vector-length roots) ([node (in-vector roots)]) @@ -237,8 +235,6 @@ ([node (in-vector roots)]) (make-vector (pcontext-length (*pcontext*))))) - (eprintf "true-errors-out: ~a\n" true-errors-out) - (define exacts-out (for/vector #:length (vector-length roots) ([node (in-vector roots)]) @@ -261,19 +257,10 @@ ([(pt ex) (in-pcontext (*pcontext*))]) (apply actual-value-fn pt))) - (define diff-expers-per-pcontext - (for/vector #:length (vector-length exacts-from-points) - ([exacts (in-vector exacts-from-points)]) - (for/list ([exact (in-vector exacts)] - [spec (in-list spec-list)]) - `(- ,spec ,exact)))) - - ;; can use ctx list (define (true-error-for spec exact ctx pt) ; TODO pass in the list of of specs and exacts and ctxs and apply that function to pts (define s (list `(- ,spec ,exact))) (define c (list ctx)) - (eprintf "true-error-for: ~a, ~a, ~a\n" s c pt) (first (apply (eval-progs-real s c) pt))) (define (true-error-from i exact pt) @@ -312,8 +299,8 @@ (ulp-difference exact approx repr)])) (define true-error (match (vector-ref nodes root) - [(? literal?) exact] - [(? variable?) 1] + [(? literal?) (true-error-for c-spec exact c-ctx pt)] + [(? variable?) 0] ; assuming input is exact ; compare the exact against it's impl substitution. [(approx _ impl) (true-error-from impl exact pt)] [`(if ,c ,ift ,iff) @@ -333,26 +320,7 @@ (vector-set! (vector-ref actuals-out expr-idx) pt-idx actual) (vector-set! (vector-ref true-errors-out expr-idx) pt-idx true-error))) - #| - (define s (list (first (vector-ref diff-expers-per-pcontext 0)))) - (define p (vector-ref (pcontext-points (*pcontext*)) 0)) - (define c (list (first ctx-list))) - (eprintf "spec: ~a, ctx: ~a, pt: ~a\n" s c p) - (eprintf "diff-expers: ~a\n" (apply (eval-progs-real s c) p)) - - (define diff-funcs - (for/list ([diff-expers (in-vector diff-expers-per-pcontext)]) - (eval-progs-real diff-expers ctx-list))) - - (eprintf "diffs: ~a\n" diff-funcs) - (define results - (for/list ([(pt ex) (in-pcontext (*pcontext*))] - [func (in-list diff-funcs)]) - (eprintf "func: ~a, pt: ~a\n" func pt) - (apply func pt))) - (eprintf "results: ~a\n" results) - |# - + ; TODO below is also a mess (define n 0) (define err-tree (first (for/list ([subexprs (in-list subexprss)]) @@ -368,8 +336,6 @@ (vector->list (vector-ref true-errors-out n)))) (set! n (add1 n))))))) - (eprintf "err-tree: ~a\n" err-tree) - (define local-error (let loop ([expr (test-input test)]) (define expr-info (hash-ref err-tree expr)) @@ -402,9 +368,6 @@ [(list op args ...) (cons true-error-list (map loop args))] [_ (list true-error-list)]))) - (eprintf "hash: ~a\n" (hash-ref (hash-ref err-tree (test-input test)) 'actual-values)) - (eprintf "actual-values: ~a\n" actual-values) - (define tree (let loop ([expr (prog->fpcore (test-input test) (test-context test))] [err local-error]