From 347f5b8ccfb9079d2cf97a85f925af7baefe3837 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 12 Dec 2018 07:41:35 -0700 Subject: [PATCH] compiler/cm: unbreak dependency checking Recent changes to adapt cm to cross-multi mode also attempted to improve dependency checking to avoid prematurely committing to compiling an old dependency, but that improvement was broken. --- .../collects/compiler/private/cm-minimal.rkt | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/racket/collects/compiler/private/cm-minimal.rkt b/racket/collects/compiler/private/cm-minimal.rkt index 2ac7513063..d13252f677 100644 --- a/racket/collects/compiler/private/cm-minimal.rkt +++ b/racket/collects/compiler/private/cm-minimal.rkt @@ -999,7 +999,7 @@ (trace-printf "different src hash ~a for ~a..." difference path) (maybe-compile-zo deps path->mode roots path orig-path read-src-syntax up-to-date collection-cache new-seen #:trying-sha1? sha1-only?))] - [(ormap-strict + [((if sha1-only? ormap ormap-strict) (lambda (p) (define ext? (external-dep? p)) (define d (collects-relative*->path (dep->encoded-path p) collection-cache)) @@ -1008,18 +1008,23 @@ (cons (or (try-file-time d) +inf.0) #f) (compile-root path->mode roots d up-to-date collection-cache read-src-syntax new-seen #:sha1-only? sha1-only?))) - (and t - (car t) - (> (car t) (or path-zo-time -inf.0)) - (begin (trace-printf "newer for ~a: ~a (~a > ~a)..." - path d (car t) path-zo-time) - #t))) + (cond + [(not t) #t] + [else (and (car t) + (> (car t) (or path-zo-time -inf.0)) + (begin (trace-printf "newer for ~a: ~a (~a > ~a)..." + path d (car t) path-zo-time) + #t))])) (deps-imports deps)) (maybe-compile-zo deps path->mode roots path orig-path read-src-syntax up-to-date collection-cache new-seen #:trying-sha1? sha1-only?)] [else #f])) (cond - [(and needs-build? sha1-only?) #f] + [(and needs-build? sha1-only?) + (hash-set! up-to-date (cons 'needs-build? main-path) #t) + (unless (eq? main-path alt-path) + (hash-set! up-to-date (cons 'needs-build? alt-path) #t)) + #f] [else (when needs-build? (maybe-compile-zo deps path->mode roots path orig-path read-src-syntax up-to-date collection-cache new-seen)) @@ -1050,8 +1055,13 @@ (and v (hash-set! up-to-date orig-path v) v)) - (begin (trace-printf "checking: ~a" orig-path) - (do-check)))) + (cond + [(and sha1-only? + (hash-ref up-to-date (cons 'needs-build? orig-path) #f)) + #f] + [else + (trace-printf "checking: ~a" orig-path) + (do-check)]))) (define (ormap-strict f l) (cond