- ;; We use assignment and conditional restoration instead of
- ;; dynamic binding because we want the ignored locks
- ;; to propagate to the topmost context.
- (when (eq :invalid *ignored-package-locks*)
- (setf *ignored-package-locks* nil
- ,topmost t))
- (unwind-protect
- (progn
- ,@(ecase kind
- (:symbol
- `((assert-symbol-home-package-unlocked ,thing ,@format)))
- (:package
- `((assert-package-unlocked
- (find-undeleted-package-or-lose ,thing) ,@format)))
- ((nil)
- `()))
- ,@body)
- (when ,topmost
- (setf *ignored-package-locks* :invalid)))))))
+ ;; We use assignment and conditional restoration instead of
+ ;; dynamic binding because we want the ignored locks
+ ;; to propagate to the topmost context.
+ (when (eq :invalid *ignored-package-locks*)
+ (setf *ignored-package-locks* nil
+ ,topmost t))
+ (unwind-protect
+ (progn
+ ,@(ecase kind
+ (:symbol
+ `((assert-symbol-home-package-unlocked ,thing ,@format)))
+ (:package
+ `((assert-package-unlocked
+ (find-undeleted-package-or-lose ,thing) ,@format)))
+ ((nil)
+ `()))
+ ,@body)
+ (when ,topmost
+ (setf *ignored-package-locks* :invalid)))))))
+
+(defun compiler-assert-symbol-home-package-unlocked (symbol control)
+ #!-sb-package-locks
+ (declare (ignore symbol control))
+ #!+sb-package-locks
+ (flet ((resignal (condition)
+ ;; Signal the condition to give user defined handlers a chance,
+ ;; if they decline convert to compiler-error.
+ (signal condition)
+ (sb!c:compiler-error condition)))
+ (handler-bind ((package-lock-violation #'resignal))
+ (with-single-package-locked-error ()
+ (assert-symbol-home-package-unlocked symbol control)))))