1.0.1.31: Speed up fopcompilation of functions
authorJuho Snellman <jsnell@iki.fi>
Thu, 18 Jan 2007 00:32:04 +0000 (00:32 +0000)
committerJuho Snellman <jsnell@iki.fi>
Thu, 18 Jan 2007 00:32:04 +0000 (00:32 +0000)
        * Get rid of the extra wrapper lambda around fopcompiled functions
        * This requires making sure that functions with xeps are never
          let- or assignment-converted.
        * Fix some whitespace damage, and a few tests that were making
          invalid assumptions
        * Compilation speedup seems to be about 5% for most cases, up to
          20% on high debug levels.

contrib/sb-posix/constants.lisp
src/compiler/fopcompile.lisp
src/compiler/locall.lisp
src/compiler/main.lisp
tests/compiler.pure.lisp
tests/debug.impure.lisp
version.lisp-expr

index 6e05505..63a04a5 100644 (file)
  (:integer
   log-warning "LOG_WARNING" "Log severity level denoting a warning." t)
  #-win32
- (:integer 
+ (:integer
   log-notice "LOG_NOTICE" "Log severity level denoting non-errors that may require special handling." t)
  #-win32
  (:integer
  #-win32
  (:integer
   log-debug "LOG_DEBUG" "Log severity level denoting debugging information ." t)
+
 )
index 23c534d..31e87f6 100644 (file)
         (cond
           ;; Lambda forms are compiled with the real compiler
           ((lambda-form-p form)
-           ;; We wrap the real lambda inside another one to ensure
-           ;; that the compiler doesn't e.g. let convert it, thinking
-           ;; that there are no external references.
-           (let* ((handle (%compile `(lambda () ,form)
+           (let* ((handle (%compile form
                                     *compile-object*
                                     :path path)))
              (when for-value-p
-               (sb!fasl::dump-push handle *compile-object*)
-               ;; And then call the wrapper function when loading the FASL
-               (sb!fasl::dump-fop 'sb!fasl::fop-funcall *compile-object*)
-               (sb!fasl::dump-byte 0 *compile-object*))))
+               (sb!fasl::dump-push handle *compile-object*))))
           ;; While function names are translated to a call to FDEFINITION.
           ((legal-fun-name-p form)
            (dump-fdefinition form))
index f480fcf..e2af18d 100644 (file)
 ;;; true if we converted.
 (defun maybe-let-convert (clambda)
   (declare (type clambda clambda))
-  (unless (declarations-suppress-let-conversion-p clambda)
+  (unless (or (declarations-suppress-let-conversion-p clambda)
+              (functional-has-external-references-p clambda))
     ;; We only convert to a LET when the function is a normal local
     ;; function, has no XEP, and is referenced in exactly one local
     ;; call. Conversion is also inhibited if the only reference is in
 (defun maybe-convert-to-assignment (clambda)
   (declare (type clambda clambda))
   (when (and (not (functional-kind clambda))
-             (not (functional-entry-fun clambda)))
+             (not (functional-entry-fun clambda))
+             (not (functional-has-external-references-p clambda)))
     (let ((outside-non-tail-call nil)
           (outside-call nil))
       (when (and (dolist (ref (leaf-refs clambda) t)
index 74cba28..d13e07d 100644 (file)
         (assert-global-function-definition-type name locall-fun))
       (setf (functional-entry-fun fun) locall-fun
             (functional-kind fun) :external
+            (functional-has-external-references-p locall-fun) t
             (functional-has-external-references-p fun) t)
       fun)))
 
index 95d2928..7db4d3a 100644 (file)
 (handler-case (compile nil '(lambda (x)
                              (declare (optimize (speed 3) (safety 0)))
                              (the double-float (sqrt (the double-float x)))))
-  (sb-ext:compiler-note ()
-    (error "Compiler does not trust result type assertion.")))
+  (sb-ext:compiler-note (c)
+    ;; Ignore the note for the float -> pointer conversion of the
+    ;; return value.
+    (unless (string= (car (last (sb-c::simple-condition-format-arguments c)))
+                     "<return value>")
+      (error "Compiler does not trust result type assertion."))))
 
 (let ((f (compile nil '(lambda (x)
                         (declare (optimize speed (safety 0)))
     (compile nil '(lambda (x)
                    (declare (optimize (speed 3)))
                    (1+ x))))
-  ;; forced-to-do GENERIC-+, etc
-  (assert (> count0 0))
+  ;; forced-to-do GENERIC-+, etc, possible word -> bignum conversion note
+  (assert (> count0 1))
   (handler-bind ((sb-ext:compiler-note (lambda (c) (incf count1))))
     (compile nil '(lambda (x)
                    (declare (optimize (speed 3)))
                    (check-type x fixnum)
                    (1+ x))))
-  (assert (= count1 0)))
+  ;; Only the posssible word -> bignum conversion note
+  (assert (= count1 1)))
 
 ;;; Up to 0.9.8.22 x86-64 had broken return value handling in the
 ;;; %SET-SAP-REF-DOUBLE/SINGLE VOPs.
index 25ad2a7..b64e172 100644 (file)
                         ;; extra foreign frames below regular frames.
                         (let ((end (last backtrace #-win32 2 #+win32 4)))
                           (unless (equal (caar end)
-                                         (if *show-entry-point-details*
-                                             '(sb-c::tl-xep sb-impl::toplevel-init)
-                                             'sb-impl::toplevel-init))
+                                         'sb-impl::toplevel-init)
                             (print (list :backtrace-stunted (caar end)))
                             (setf result nil)))
                         (return-from outer-handler)))))
index b6c2a62..1a0b215 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.1.30"
+"1.0.1.31"