Recreate the pathname intern table on save

Don't save a hash-table kv vector full of a zillion unbound markers.
Some other tables might want the same treatment but I'm not sure which.
This commit is contained in:
Douglas Katzman 2022-07-14 17:37:26 -04:00
parent bf3034200a
commit cb0f8a1234
2 changed files with 10 additions and 4 deletions

View file

@ -339,9 +339,13 @@ sufficiently motivated to do lengthy fixes."
(profile-deinit)
(foreign-deinit)
;; To have any hope of making pathname interning actually work,
;; this CLRHASH would need to be removed. But removing it causes excess
;; garbage retention because weakness doesn't work. It's a catch-22.
(clrhash *pathnames*)
;; this MAKE-PATHNAME-TABLE (formerly CLRHASH) would need to be removed.
;; But removing this step causes excess garbage retention because the
;; table's weakness isn't actually working (not sure why).
;; And CLRHASH doesn't do as much as it should, because if the table
;; is actually empty, but at some point held 20,000 pathnames,
;; then we'd write out an enormous vector full of nothing.
(make-pathname-intern-table)
;; Clean up the simulated weak list of covered code components.
(rplacd sb-c:*code-coverage-info*
(delete-if-not #'weak-pointer-value (cdr sb-c:*code-coverage-info*)))

View file

@ -298,7 +298,7 @@
;;; *around* the get and put operations. It makes no sense to lock the table around
;;; individual operations, hence the unsynchronized table.
(define-load-time-global *pathnames*
(defun make-pathname-intern-table ()
(let ((h (%make-hash-table (logior (pack-ht-flags-weakness +ht-weak-value+)
(pack-ht-flags-kind 3)
hash-table-userfun-flag)
@ -310,6 +310,8 @@
$1.0)))
(install-hash-table-lock h)
h))
(define-load-time-global *pathnames* (make-pathname-intern-table))
;;; A pathname is logical if the host component is a logical host.
;;; This constructor is used to make an instance of the correct type
;;; from parsed arguments.