Racket now works, but was broken before
This commit is contained in:
parent
e6e95f1029
commit
11b784236e
|
@ -35,7 +35,7 @@
|
|||
(path-add-suffix file-to-batch #"_merged.zo")))
|
||||
|
||||
;; Transformations
|
||||
(define path-cache (make-hash))
|
||||
(define path-cache (make-hasheq))
|
||||
|
||||
(log-info "Removing dependencies")
|
||||
(define-values (batch-nodep top-lang-info top-self-modidx get-modvar-rewrite)
|
||||
|
|
|
@ -68,13 +68,18 @@
|
|||
[(struct module-variable (modidx sym pos phase constantness))
|
||||
(match rw
|
||||
[(struct modvar-rewrite (self-modidx provide->toplevel))
|
||||
(log-debug (format "Rewriting ~a of ~S" pos (mpi->path* modidx)))
|
||||
(log-debug (format "Rewriting ~a@~a of ~S" sym pos (mpi->path* modidx)))
|
||||
(define tl (provide->toplevel sym pos))
|
||||
(log-debug (format "Rewriting ~a@~a of ~S to ~S" sym pos (mpi->path* modidx) tl))
|
||||
(match-define (toplevel-offset-rewriter rewrite-fun meta)
|
||||
(hash-ref MODULE-TOPLEVEL-OFFSETS self-modidx
|
||||
(lambda ()
|
||||
(error 'compute-new-modvar "toplevel offset not yet computed: ~S" self-modidx))))
|
||||
(log-debug (format "Rewriting ~a of ~S from ~S" pos (mpi->path* modidx) meta))
|
||||
(rewrite-fun (provide->toplevel sym pos))])]))
|
||||
(log-debug (format "Rewriting ~a@~a of ~S (which is ~a) with ~S" sym pos (mpi->path* modidx) tl meta))
|
||||
(define res (rewrite-fun tl))
|
||||
(log-debug (format "Rewriting ~a@~a of ~S (which is ~a) with ~S and got ~S"
|
||||
sym pos (mpi->path* modidx) tl meta res))
|
||||
res])]))
|
||||
|
||||
(define (filter-rewritable-module-variable? toplevel-offset mod-toplevels)
|
||||
(define-values
|
||||
|
@ -86,7 +91,7 @@
|
|||
(match tl
|
||||
[(and mv (struct module-variable (modidx sym pos phase constantness)))
|
||||
(define rw ((current-get-modvar-rewrite) modidx))
|
||||
; XXX We probably don't need to deal with #f phase
|
||||
;; XXX We probably don't need to deal with #f phase
|
||||
(unless (or (not phase) (zero? phase))
|
||||
(error 'eliminate-module-variables "Non-zero phases not supported: ~S" mv))
|
||||
(cond
|
||||
|
|
|
@ -128,9 +128,10 @@
|
|||
(when (symbol? tl)
|
||||
(hash-set! provide-ht (intern tl) i)))
|
||||
(lambda (sym pos)
|
||||
(log-debug (format "Looking up ~S@~a in ~S" sym pos prefix))
|
||||
(define isym (intern sym))
|
||||
(log-debug (format "Looking up ~S@~a [~S] in ~S" sym pos isym prefix))
|
||||
(define res
|
||||
(hash-ref provide-ht (intern sym)
|
||||
(hash-ref provide-ht isym
|
||||
(lambda ()
|
||||
(error 'provide->toplevel "Cannot find ~S in ~S" sym prefix))))
|
||||
(log-debug (format "Looked up ~S@~a and got ~v" sym pos res))
|
||||
|
@ -142,14 +143,15 @@
|
|||
unexported max-let-depth dummy lang-info internal-context
|
||||
flags pre-submodules post-submodules))
|
||||
(define new-prefix prefix)
|
||||
; Cache all the mpi paths
|
||||
;; Cache all the mpi paths
|
||||
(for-each (match-lambda
|
||||
[(and mv (struct module-variable (modidx sym pos phase constantness)))
|
||||
(mpi->path! modidx)]
|
||||
[tl
|
||||
(void)])
|
||||
(prefix-toplevels new-prefix))
|
||||
(log-debug (format "[~S] module-variables: ~S" name (length (filter module-variable? (prefix-toplevels new-prefix)))))
|
||||
(define mvs (filter module-variable? (prefix-toplevels new-prefix)))
|
||||
(log-debug (format "[~S] module-variables: ~S - ~S" name (length mvs) mvs))
|
||||
(values (make-modvar-rewrite self-modidx (construct-provide->toplevel new-prefix provides))
|
||||
lang-info
|
||||
(append (requires->modlist requires phase)
|
||||
|
|
Loading…
Reference in New Issue
Block a user