Work around remaining RENAME-PACKAGE issue for tll smashing.

Simply force compilation of queued lambdas when a
DEFPACKAGE/MAKE-PACKAGE is seen at compile time, thereby avoiding
issues with RENAME-PACKAGE. Set TOP-LEVEL-LAMBDA-MAX back to 20. This
is for the case which I think is not conforming code, but nevertheless
causes behavioral change. It's not worth trying to solve this to save
a few bytes off of fasls in the case where we have random package
hackery going on, something which doesn't apply to the majority of
code.
This commit is contained in:
Charles Zhang 2022-05-31 17:50:24 -07:00
parent a73445b84d
commit 1bdc85ab9d
4 changed files with 16 additions and 5 deletions

4
NEWS
View file

@ -1,5 +1,9 @@
;;;; -*- coding: utf-8; fill-column: 78 -*-
changes relative to sbcl-2.2.5:
* optimization: fasl files are now usually smaller (up to 10% on default
policy) and may load faster, especially on high debug.
changes in sbcl-2.2.5 relative to sbcl-2.2.4:
* minor incompatible change: SB-EXT:*DERIVE-FUNCTION-TYPES* being NIL now
means that function calls will strictly only use type information from

View file

@ -67,10 +67,6 @@ echo //doing warm init - load and dump phase
(setf sb-c::*merge-pathnames* t)
;;; and for storing pathname namestrings in fasls too.
(setq sb-c::*name-context-file-path-selector* 'truename)
;;; FIXME: Workaround for possible incorrect RENAME-PACKAGE behavior
;;; with top-level-lambda merging. Remove this when the tests
;;; :block-defpackage-rename-package etc works.
(setq sb-c::top-level-lambda-max 0)
(let ((sb-ext:*invoke-debugger-hook* (prog1 sb-ext:*invoke-debugger-hook* (sb-ext:enable-debugger))))
(sb-ext:save-lisp-and-die "output/sbcl.core"))
EOF

View file

@ -1046,6 +1046,14 @@ implementation it is ~S." *!default-package-use-list*)
"Clobber existing package."
"A package named ~S already exists" name)
(setf clobber t))
;; Force pending top-level lambdas at compile time, to prevent a
;; potentially observable behavioral change with
;; RENAME-PACKAGE. See test
;; :BLOCK-DEFPACKAGE-RENAME-PACKAGE-REDEFPACKAGE which shows the
;; failing scenario. Forcing top-level lambdas like this does not
;; apply to block compilation.
(when (boundp 'sb-c::*compilation*)
(sb-c::compile-toplevel-lambdas '() t))
(with-package-graph ()
;; Check for race, signal the error outside the lock.
(when (and (not clobber) (find-package name))

View file

@ -82,7 +82,10 @@
(assert (eq (nth-value 1 (find-symbol "F" "BLOCK-DEFPACKAGE3"))
:external)))
;;; Similar to the above test case, but with RENAME-PACKAGE.
;;; Similar to the above test case, but with RENAME-PACKAGE. This is
;;; probably, strictly speaking, non-conforming code according to ANSI
;;; 3.2.4.4 under item 1 for symbol, taking package "same"ness to mean
;;; EQness. We don't expect this to work under block compilation.
(with-test (:name :block-defpackage-rename-package-redefpackage
:fails-on :sbcl)
(ctu:file-compile