mirror of
git://git.code.sf.net/p/sbcl/sbcl
synced 2026-09-10 07:26:40 -04:00
Always evaluate make-load-form forms.
FOPCOMPILE-IF can skip over some forms but the constant for which MAKE-LOAD-FORM was used can be referenced later.
This commit is contained in:
parent
0919dcb1ea
commit
7b097db861
|
|
@ -509,6 +509,10 @@
|
|||
(fop-funcall* (fasl-input-stream) (operand-stack) (skip-until)))
|
||||
(!define-fop 56 (fop-funcall-for-effect () nil)
|
||||
(fop-funcall* (fasl-input-stream) (operand-stack) (skip-until)))
|
||||
|
||||
;;; For LOAD-TIME-VALUE which is used for MAKE-LOAD-FORM
|
||||
(!define-fop 57 (fop-funcall-no-skip)
|
||||
(fop-funcall* (fasl-input-stream) (operand-stack) nil))
|
||||
|
||||
;;;; fops for fixing up circularities
|
||||
|
||||
|
|
|
|||
|
|
@ -498,13 +498,16 @@
|
|||
|
||||
;;; Emit a funcall of the function and return the handle for the
|
||||
;;; result.
|
||||
(defun fasl-dump-load-time-value-lambda (fun file)
|
||||
(defun fasl-dump-load-time-value-lambda (fun file no-skip)
|
||||
(declare (type sb!c::clambda fun) (type fasl-output file))
|
||||
(let ((handle (gethash (sb!c::leaf-info fun)
|
||||
(fasl-output-entry-table file))))
|
||||
(aver handle)
|
||||
(dump-push handle file)
|
||||
(dump-fop 'fop-funcall file)
|
||||
;; Can't skip MAKE-LOAD-FORM due to later references
|
||||
(if no-skip
|
||||
(dump-fop 'fop-funcall-no-skip file)
|
||||
(dump-fop 'fop-funcall file))
|
||||
(dump-byte 0 file))
|
||||
(dump-pop file))
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
;;; the dumper handle and our best guess at the type of the object.
|
||||
;;; It would be nice if L-T-V forms were generally eligible
|
||||
;;; for fopcompilation, as it could eliminate special cases below.
|
||||
(defun compile-load-time-value (form)
|
||||
(defun compile-load-time-value (form &optional no-skip)
|
||||
(acond ((typecase form
|
||||
;; This case is important for dumping packages as constants
|
||||
;; in cold-init, but works fine in the normal target too.
|
||||
|
|
@ -43,7 +43,8 @@
|
|||
(values (sb!fasl::dump-pop *compile-object*) (specifier-type it)))
|
||||
(t
|
||||
(let ((lambda (compile-load-time-stuff form t)))
|
||||
(values (fasl-dump-load-time-value-lambda lambda *compile-object*)
|
||||
(values (fasl-dump-load-time-value-lambda lambda *compile-object*
|
||||
no-skip)
|
||||
(let ((type (leaf-type lambda)))
|
||||
(if (fun-type-p type)
|
||||
(single-value-type (fun-type-returns type))
|
||||
|
|
|
|||
|
|
@ -2074,7 +2074,7 @@ SPEED and COMPILATION-SPEED optimization values, and the
|
|||
(setf (sb!fasl::fasl-output-table-free fasl) (1+ index))
|
||||
index))
|
||||
(t
|
||||
(compile-load-time-value creation-form)))
|
||||
(compile-load-time-value creation-form t)))
|
||||
fasl)
|
||||
nil)
|
||||
(compiler-error "circular references in creation form for ~S"
|
||||
|
|
|
|||
|
|
@ -141,3 +141,10 @@
|
|||
'((CMACRO-MFOO 3) (CMACRO-FFOO 3)
|
||||
(CMACRO-MFOO 2) (CMACRO-FFOO 2)
|
||||
(CMACRO-MFOO 1) (CMACRO-FFOO 1)))))
|
||||
|
||||
(when (eval nil)
|
||||
(lambda () #.(find-package "CL")))
|
||||
|
||||
(with-test (:name :skip-load-form)
|
||||
(assert (eq #.(find-package "CL")
|
||||
(eval '(find-package "CL")))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue