0.9.13.28:
authorNathan Froyd <froydnj@cs.rice.edu>
Tue, 6 Jun 2006 02:42:51 +0000 (02:42 +0000)
committerNathan Froyd <froydnj@cs.rice.edu>
Tue, 6 Jun 2006 02:42:51 +0000 (02:42 +0000)
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.

src/compiler/fndb.lisp
src/compiler/ir2tran.lisp
src/compiler/knownfun.lisp
src/compiler/ppc/arith.lisp
src/compiler/x86/arith.lisp

index 70a34cf..4d0debb 100644 (file)
 (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))
index 5adc631..777121f 100644 (file)
 
 ;;; 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
     ;; 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))
index 4c7ff9c..078b9f1 100644 (file)
   ;; 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.
index 9e675f8..67365c1 100644 (file)
 ;;;; %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))
 
   (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))
 
index b19fcb3..ce684ee 100644 (file)
   (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))