From 0c54eadbdfd0a1ec1e47e067de53bdf4a06330c5 Mon Sep 17 00:00:00 2001 From: William Harold Newman Date: Thu, 2 Aug 2001 18:29:46 +0000 Subject: [PATCH] 0.6.12.63: added code to report what's being overwritten by a duplicate DEFKNOWN removed duplicate DEFKNOWN for (SETF %FUNCALLABLE-INSTANCE-FUNCTION), at the cost of much entrail-reading and a lengthy KLUDGE note --- src/code/byte-interp.lisp | 20 ++++++++++---------- src/compiler/fndb.lisp | 4 ++++ src/compiler/generic/objdef.lisp | 20 +++++++++++++++++++- src/compiler/knownfun.lisp | 28 +++++++++++++++------------- src/compiler/x86/system.lisp | 9 ++++++--- version.lisp-expr | 2 +- 6 files changed, 55 insertions(+), 28 deletions(-) diff --git a/src/code/byte-interp.lisp b/src/code/byte-interp.lisp index 821abd6..2de7dfd 100644 --- a/src/code/byte-interp.lisp +++ b/src/code/byte-interp.lisp @@ -400,17 +400,17 @@ ;;;; miscellaneous primitive stubs -(macrolet ((frob (name &optional (args '(x))) +(macrolet ((def-frob (name &optional (args '(x))) `(defun ,name ,args (,name ,@args)))) - (frob %CODE-CODE-SIZE) - (frob %CODE-DEBUG-INFO) - (frob %CODE-ENTRY-POINTS) - (frob %FUNCALLABLE-INSTANCE-FUNCTION) - (frob %FUNCALLABLE-INSTANCE-LAYOUT) - (frob %FUNCALLABLE-INSTANCE-LEXENV) - (frob %FUNCTION-NEXT) - (frob %FUNCTION-SELF) - (frob %SET-FUNCALLABLE-INSTANCE-FUNCTION (fin new-val))) + (def-frob %code-code-size) + (def-frob %code-debug-info) + (def-frob %code-entry-points) + (def-frob %funcallable-instance-function) + (def-frob %funcallable-instance-layout) + (def-frob %funcallable-instance-lexenv) + (def-frob %function-next) + (def-frob %function-self) + (def-frob %set-funcallable-instance-function (fin new-val))) ;;;; funny functions diff --git a/src/compiler/fndb.lisp b/src/compiler/fndb.lisp index ba89f35..530aa5a 100644 --- a/src/compiler/fndb.lisp +++ b/src/compiler/fndb.lisp @@ -1340,6 +1340,9 @@ long-float-p base-char-p %standard-char-p %instancep array-header-p) (t) boolean (movable foldable flushable)) + +;;; REMOVEME +#| ;;;; miscellaneous "sub-primitives" @@ -1347,3 +1350,4 @@ (simple-string index index simple-string index index) (or index null) (foldable flushable)) +|# \ No newline at end of file diff --git a/src/compiler/generic/objdef.lisp b/src/compiler/generic/objdef.lisp index ae2c7cd..9320639 100644 --- a/src/compiler/generic/objdef.lisp +++ b/src/compiler/generic/objdef.lisp @@ -174,10 +174,28 @@ :lowtag function-pointer-type :header funcallable-instance-header-type :alloc-trans %make-funcallable-instance) - #!-gengc + #!-(or gengc x86) (function :ref-known (flushable) :ref-trans %funcallable-instance-function :set-known (unsafe) :set-trans (setf %funcallable-instance-function)) + #!+x86 + (function + :ref-known (flushable) :ref-trans %funcallable-instance-function + ;; KLUDGE: There's no :SET-KNOWN or :SET-TRANS in this case. + ;; Instead, later in compiler/x86/system.lisp there's a separate + ;; DEFKNOWN for (SETF %FUNCALLABLE-INSTANCE-FUNCTION), and a weird + ;; unexplained DEFTRANSFORM from (SETF %FUNCTION-INSTANCE-FUNCTION) + ;; into (SETF %FUNCTION-SELF). The #!+X86 wrapped around this case + ;; is a literal translation of the old CMU CL implementation into + ;; the new world of sbcl-0.6.12.63, where multiple DEFKNOWNs for + ;; the same operator cause an error (instead of silently deleting + ;; all information associated with the old DEFKNOWN, as before). + ;; It's definitely not very clean, with too many #!+ conditionals, + ;; too little documentation, and an implicit assumption that GENGC + ;; and X86 are mutually exclusive, but I have more urgent things to + ;; clean up right now, so I've just left it as a literal + ;; translation without trying to fix it. -- WHN 2001-08-02 + ) #!+gengc (entry-point :c-type "char *") (lexenv :ref-known (flushable) :ref-trans %funcallable-instance-lexenv :set-known (unsafe) :set-trans (setf %funcallable-instance-lexenv)) diff --git a/src/compiler/knownfun.lisp b/src/compiler/knownfun.lisp index 839ab45..8a1d3fc 100644 --- a/src/compiler/knownfun.lisp +++ b/src/compiler/knownfun.lisp @@ -171,19 +171,21 @@ :optimizer optimizer)) (target-env (or *backend-info-environment* *info-environment*))) (dolist (name names) - (when (info :function :info name) - ;; This is 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. - #+nil (cerror "Go ahead, overwrite it." - "overwriting old FUNCTION-INFO for ~S" name) - (warn "overwriting old FUNCTION-INFO for ~S" name)) + (let ((old-function-info (info :function :info name))) + (when old-function-info + ;; This is 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. + #+nil (cerror "Go ahead, overwrite it." + "overwriting old FUNCTION-INFO for ~S" name) + (warn "~@" + old-function-info name))) (setf (info :function :type name target-env) ctype) (setf (info :function :where-from name target-env) :declared) (setf (info :function :kind name target-env) :function) diff --git a/src/compiler/x86/system.lisp b/src/compiler/x86/system.lisp index 89cac6d..95de87f 100644 --- a/src/compiler/x86/system.lisp +++ b/src/compiler/x86/system.lisp @@ -256,10 +256,13 @@ (storew temp function function-self-slot function-pointer-type) (move result new-self))) -;;; REMOVEME +;;; KLUDGE: This seems to be some kind of weird override of the way +;;; that the objdef.lisp code would ordinarily set up the slot +;;; accessor. It's inherited from CMU CL, and it works, and naively +;;; deleting it seemed to cause problems, but it's not obvious why +;;; it's done this way. Any ideas? -- WHN 2001-08-02 (defknown ((setf %funcallable-instance-function)) (function function) function - (unsafe)) - + (unsafe)) ;;; CMU CL comment: ;;; We would have really liked to use a source-transform for this, but ;;; they don't work with SETF functions. diff --git a/version.lisp-expr b/version.lisp-expr index 8763fc4..2426550 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -16,4 +16,4 @@ ;;; four numeric fields, is used for versions which aren't released ;;; but correspond only to CVS tags or snapshots. -"0.6.12.62" +"0.6.12.63" -- 1.7.10.4