diff --git a/racket/src/expander/eval/module-cache.rkt b/racket/src/expander/eval/module-cache.rkt index 89c4c7a19b..7f93955308 100644 --- a/racket/src/expander/eval/module-cache.rkt +++ b/racket/src/expander/eval/module-cache.rkt @@ -9,7 +9,7 @@ module-cache-set! module-cache-ref) -(define module-cache (make-weak-hash)) +(define module-cache (make-weak-hasheq)) (define (make-module-cache-key hash-code) ;; The result is preserved to retain the cache entry, and @@ -20,7 +20,10 @@ ;; relative to the enclosing module, and that part of ;; the syntax object is unmarshaled once and used for ;; all instances of the module. - (and hash-code (list hash-code (current-load-relative-directory)))) + (and hash-code + ;; Encode as a symbol so we can use an eq?-based hash table + ;; (i.e., explot the low-level lock on the symbol table) + (string->symbol (format "~s" (list hash-code (current-load-relative-directory)))))) (define (module-cache-set! key proc) (hash-set! module-cache key (make-ephemeron key proc))) diff --git a/racket/src/racket/src/startup.inc b/racket/src/racket/src/startup.inc index 6aae70d146..5784585ad7 100644 --- a/racket/src/racket/src/startup.inc +++ b/racket/src/racket/src/startup.inc @@ -33804,10 +33804,11 @@ static const char *startup_source = "(let-values(((or-part_265)(if insp_11(inspector-superior? insp_11 guard-insp_4) #f)))" "(if or-part_265 or-part_265(inspector-superior?(current-code-inspector) guard-insp_4)))))" "(let-values() #t))))))))))" -"(define-values(module-cache)(make-weak-hash))" +"(define-values(module-cache)(make-weak-hasheq))" "(define-values" "(make-module-cache-key)" -"(lambda(hash-code_4)(begin(if hash-code_4(list hash-code_4(current-load-relative-directory)) #f))))" +"(lambda(hash-code_4)" +" (begin (if hash-code_4 (string->symbol (format \"~s\" (list hash-code_4 (current-load-relative-directory)))) #f))))" "(define-values" "(module-cache-set!)" "(lambda(key_11 proc_9)(begin(hash-set! module-cache key_11(make-ephemeron key_11 proc_9)))))"