Skip to content

Commit

Permalink
1.0.1.31: Speed up fopcompilation of functions
Browse files Browse the repository at this point in the history
        * 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.
  • Loading branch information
jsnell committed Jan 18, 2007
1 parent 81a75e4 commit 89c9285
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions contrib/sb-posix/constants.lisp
Expand Up @@ -579,13 +579,13 @@
(: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
log-info "LOG_INFO" "Log severity level denoting informational messages." t)
#-win32
(:integer
log-debug "LOG_DEBUG" "Log severity level denoting debugging information ." t)

)
10 changes: 2 additions & 8 deletions src/compiler/fopcompile.lisp
Expand Up @@ -384,17 +384,11 @@
(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))
Expand Down
6 changes: 4 additions & 2 deletions src/compiler/locall.lisp
Expand Up @@ -1050,7 +1050,8 @@
;;; 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
Expand Down Expand Up @@ -1166,7 +1167,8 @@
(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)
Expand Down
1 change: 1 addition & 0 deletions src/compiler/main.lisp
Expand Up @@ -986,6 +986,7 @@
(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)))

Expand Down
15 changes: 10 additions & 5 deletions tests/compiler.pure.lisp
Expand Up @@ -1375,8 +1375,12 @@
(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)))
Expand Down Expand Up @@ -1901,14 +1905,15 @@
(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.
Expand Down
4 changes: 1 addition & 3 deletions tests/debug.impure.lisp
Expand Up @@ -123,9 +123,7 @@
;; 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)))))
Expand Down
2 changes: 1 addition & 1 deletion version.lisp-expr
Expand Up @@ -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"

0 comments on commit 89c9285

Please sign in to comment.