X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fknownfun.lisp;h=100f3ee11ef016336e7d2e3e409762c69ffcd922;hb=203e2acb585b1c13159bbd6ec83c61ad9c095818;hp=c9ec933c472f899a3bfd8a1c7da4ebc301266bb1;hpb=e241757954fbb4ef0d7b97597d65bfc31dbd60ba;p=sbcl.git diff --git a/src/compiler/knownfun.lisp b/src/compiler/knownfun.lisp index c9ec933..100f3ee 100644 --- a/src/compiler/knownfun.lisp +++ b/src/compiler/knownfun.lisp @@ -206,10 +206,13 @@ (:derive-type (or function null)) (:optimizer (or function null)) (:destroyed-constant-args (or function null)) - (:result-arg (or index null))) + (:result-arg (or index null)) + (:overwrite-fndb-silently boolean)) *) %defknown)) -(defun %defknown (names type attributes &key derive-type optimizer destroyed-constant-args result-arg) +(defun %defknown (names type attributes + &key derive-type optimizer destroyed-constant-args result-arg + overwrite-fndb-silently) (let ((ctype (specifier-type type)) (info (make-fun-info :attributes attributes :derive-type derive-type @@ -217,20 +220,21 @@ :destroyed-constant-args destroyed-constant-args :result-arg result-arg))) (dolist (name names) - (let ((old-fun-info (info :function :info name))) - (when old-fun-info - ;; This is handled as an error because it's generally a bad - ;; thing to blow away all the old optimization stuff. It's - ;; also a potential source of sneaky bugs: - ;; DEFKNOWN FOO - ;; DEFTRANSFORM FOO - ;; DEFKNOWN FOO ; possibly hidden inside some macroexpansion - ;; ; Now the DEFTRANSFORM doesn't exist in the target Lisp. - ;; However, it's continuable because it might be useful to do - ;; it when testing new optimization stuff interactively. - (cerror "Go ahead, overwrite it." - "~@" - old-fun-info name))) + (unless overwrite-fndb-silently + (let ((old-fun-info (info :function :info name))) + (when old-fun-info + ;; This is handled as an error because it's generally a bad + ;; thing to blow away all the old optimization stuff. It's + ;; also a potential source of sneaky bugs: + ;; DEFKNOWN FOO + ;; DEFTRANSFORM FOO + ;; DEFKNOWN FOO ; possibly hidden inside some macroexpansion + ;; ; Now the DEFTRANSFORM doesn't exist in the target Lisp. + ;; However, it's continuable because it might be useful to do + ;; it when testing new optimization stuff interactively. + (cerror "Go ahead, overwrite it." + "~@" + old-fun-info name)))) (setf (info :function :type name) ctype) (setf (info :function :where-from name) :declared) (setf (info :function :kind name) :function)