From cb3058c533711c39292b3526269437f424f4cf04 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Fri, 11 Feb 2011 17:41:46 +0000 Subject: [PATCH] 1.0.45.20: optimize ERROR and CERROR They were both surprisingly slow as we looked for a *STACK-TOP-HINT* before calling SIGNAL. The hint is needed (and was used) only for the INVOKE-DEBUGGER case, however, so there is no need to pay that price if SIGNAL is enough -- eg. when there's a handler. Fixes lp#715191. Also missing NEWS items for the CTOR hackery. --- NEWS | 5 +++++ src/code/cold-error.lisp | 16 +++++++++------- version.lisp-expr | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 22a9839..d4165fd 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,11 @@ ;;;; -*- coding: utf-8; fill-column: 78 -*- changes relative to sbcl-1.0.45: * enhancement: largefile support on Solaris. + * optimization: ERROR and CERROR are approximately 5 times faster. + * optimization: optimized constructors are used for MAKE-INSTANCE of classes + with applicable non-standard (SETF SLOT-VALUE-USING-CLASS), + SLOT-BOUNDP-USING-CLASS, and INITIALIZE-INSTANCE :AROUND methods, speeding + up instance creation in those cases. * bug fix: local tail calls to DYNAMIC-EXTENT functions can no longer cause lifetime analysis to overwrite closed-over variables (lp#681092). * bug fix: encoding errors from some multibyte external formats such as EUC-JP diff --git a/src/code/cold-error.lisp b/src/code/cold-error.lisp index 96a5670..ba9bfae 100644 --- a/src/code/cold-error.lisp +++ b/src/code/cold-error.lisp @@ -110,14 +110,16 @@ (infinite-error-protect (let ((condition (coerce-to-condition datum arguments - 'simple-error 'error)) - (sb!debug:*stack-top-hint* (maybe-find-stack-top-hint))) + 'simple-error 'error))) (/show0 "done coercing DATUM to CONDITION") + (/show0 "signalling CONDITION from within ERROR") (let ((sb!debug:*stack-top-hint* nil)) - (/show0 "signalling CONDITION from within ERROR") (signal condition)) (/show0 "done signalling CONDITION within ERROR") - (invoke-debugger condition)))) + ;; Finding the stack top hint is pretty expensive, so don't do + ;; it until we know we need the debugger. + (let ((sb!debug:*stack-top-hint* (maybe-find-stack-top-hint))) + (invoke-debugger condition))))) (defun cerror (continue-string datum &rest arguments) (infinite-error-protect @@ -126,12 +128,12 @@ (let ((condition (coerce-to-condition datum arguments 'simple-error - 'cerror)) - (sb!debug:*stack-top-hint* (maybe-find-stack-top-hint))) + 'cerror))) (with-condition-restarts condition (list (find-restart 'continue)) (let ((sb!debug:*stack-top-hint* nil)) (signal condition)) - (invoke-debugger condition))))) + (let ((sb!debug:*stack-top-hint* (maybe-find-stack-top-hint))) + (invoke-debugger condition)))))) nil) ;;; like BREAK, but without rebinding *DEBUGGER-HOOK* to NIL, so that diff --git a/version.lisp-expr b/version.lisp-expr index ed982e9..a691cdf 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -20,4 +20,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.45.19" +"1.0.45.20" -- 1.7.10.4