From: Nathan Froyd Date: Tue, 6 Jun 2006 02:42:51 +0000 (+0000) Subject: 0.9.13.28: X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=34360bf475b3632f625fcc263f626557ef96d94f;p=sbcl.git 0.9.13.28: Move full-call checking responsibilities to DEFKNOWN. ... new ALWAYS-TRANSLATABLE flag in DEFKNOWN; ... change PONDER-FULL-CALL to check said flag; ... declare flag in appropriate cases; ... by analogy with %INSTANCE-{REF,SET}, flag their %RAW-* counterparts as well (they were not flagged previously).. There are probably other cases where it's applicable, too. --- diff --git a/src/compiler/fndb.lisp b/src/compiler/fndb.lisp index 70a34cf..4d0debb 100644 --- a/src/compiler/fndb.lisp +++ b/src/compiler/fndb.lisp @@ -1438,8 +1438,9 @@ (defknown %negate (number) number (movable foldable flushable explicit-check)) (defknown %check-bound (array index fixnum) index (movable foldable flushable)) (defknown data-vector-ref (simple-array index) t - (foldable explicit-check)) -(defknown data-vector-set (array index t) t (unsafe explicit-check)) + (foldable explicit-check always-translatable)) +(defknown data-vector-set (array index t) t + (unsafe explicit-check always-translatable)) (defknown hairy-data-vector-ref (array index) t (foldable explicit-check)) (defknown hairy-data-vector-set (array index t) t (unsafe explicit-check)) diff --git a/src/compiler/ir2tran.lisp b/src/compiler/ir2tran.lisp index 5adc631..777121f 100644 --- a/src/compiler/ir2tran.lisp +++ b/src/compiler/ir2tran.lisp @@ -1023,27 +1023,6 @@ ;;; stuff to check in PONDER-FULL-CALL ;;; -;;; There are some things which are intended always to be optimized -;;; away by DEFTRANSFORMs and such, and so never compiled into full -;;; calls. This has been a source of bugs so many times that it seems -;;; worth listing some of them here so that we can check the list -;;; whenever we compile a full call. -;;; -;;; FIXME: It might be better to represent this property by setting a -;;; flag in DEFKNOWN, instead of representing it by membership in this -;;; list. -(defvar *always-optimized-away* - '(;; This should always be DEFTRANSFORMed away, but wasn't in a bug - ;; reported to cmucl-imp 2000-06-20. - %instance-ref - ;; These should always turn into VOPs, but wasn't in a bug which - ;; appeared when LTN-POLICY stuff was being tweaked in - ;; sbcl-0.6.9.16. in sbcl-0.6.0 - data-vector-set - data-vector-ref)) - -;;; more stuff to check in PONDER-FULL-CALL -;;; ;;; These came in handy when troubleshooting cold boot after making ;;; major changes in the package structure: various transforms and ;;; VOPs and stuff got attached to the wrong symbol, so that @@ -1087,10 +1066,14 @@ ;; functions are actually optimized away. Thus, we skip the check ;; in that case. (unless *failure-p* - (when (memq fname *always-optimized-away*) - (/show (policy node speed) (policy node safety)) - (/show (policy node compilation-speed)) - (bug "full call to ~S" fname))) + ;; check to see if we know anything about the function + (let ((info (info :function :info fname))) + ;; if we know something, check to see if the full call was valid + (when (and info (ir1-attributep (fun-info-attributes info) + always-translatable)) + (/show (policy node speed) (policy node safety)) + (/show (policy node compilation-speed)) + (bug "full call to ~S" fname)))) (when (consp fname) (aver (legal-fun-name-p fname)) diff --git a/src/compiler/knownfun.lisp b/src/compiler/knownfun.lisp index 4c7ff9c..078b9f1 100644 --- a/src/compiler/knownfun.lisp +++ b/src/compiler/knownfun.lisp @@ -85,7 +85,12 @@ ;; The function does explicit argument type checking, so the ;; declared type should not be asserted when a definition is ;; compiled. - explicit-check) + explicit-check + ;; The function should always be translated by a VOP (i.e. it should + ;; should never be converted into a full call). This is used strictly + ;; as a consistency checking mechanism inside the compiler during IR2 + ;; transformation. + always-translatable) (defstruct (fun-info #-sb-xc-host (:pure t)) ;; boolean attributes of this function. diff --git a/src/compiler/ppc/arith.lisp b/src/compiler/ppc/arith.lisp index 9e675f8..67365c1 100644 --- a/src/compiler/ppc/arith.lisp +++ b/src/compiler/ppc/arith.lisp @@ -664,8 +664,9 @@ ;;;; %LDB (defknown %%ldb (integer unsigned-byte unsigned-byte) unsigned-byte - (movable foldable flushable)) + (movable foldable flushable always-translatable)) +;;; only for constant folding within the compiler (defun %%ldb (integer size posn) (sb!kernel::%ldb size posn integer)) @@ -830,8 +831,9 @@ (define-logtest-vops)) (defknown %logbitp (integer unsigned-byte) boolean - (movable foldable flushable)) + (movable foldable flushable always-translatable)) +;;; only for constant folding within the compiler (defun %logbitp (integer index) (logbitp index integer)) diff --git a/src/compiler/x86/arith.lisp b/src/compiler/x86/arith.lisp index b19fcb3..ce684ee 100644 --- a/src/compiler/x86/arith.lisp +++ b/src/compiler/x86/arith.lisp @@ -1057,8 +1057,9 @@ (define-logtest-vops)) (defknown %logbitp (integer unsigned-byte) boolean - (movable foldable flushable)) + (movable foldable flushable always-translatable)) +;;; only for constant folding within the compiler (defun %logbitp (integer index) (logbitp index integer))