From c3c5e3bac6e4ca8e9d1c6960590d88e16254cfea Mon Sep 17 00:00:00 2001 From: Alexey Dejneka Date: Sun, 13 Jan 2008 20:39:21 +0000 Subject: [PATCH] 1.0.13.28: Add OPTIMIZE documentation for SBCL-specific optimize qualities. --- NEWS | 2 ++ src/code/describe.lisp | 11 ++++--- src/compiler/policies.lisp | 73 ++++++++++++++++++++++++++++++++++++++------ src/compiler/policy.lisp | 7 +++-- src/pcl/documentation.lisp | 3 ++ version.lisp-expr | 2 +- 6 files changed, 81 insertions(+), 17 deletions(-) diff --git a/NEWS b/NEWS index ef17dc0..badacbc 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,8 @@ changes in sbcl-1.0.14 relative to sbcl-1.0.13: Maciej Katafiasz) * bug fix: sb-aclrepl now correctly understands how to inspect single-floats on 64-bit platforms where single-floats are not boxed. + * DESCRIBE and (DOCUMENTATION ... 'OPTIMIZE) describe meaning of + SBCL-specific optimize qualities. changes in sbcl-1.0.13 relative to sbcl-1.0.12: * minor incompatible change: RUN-PROGRAM now uses execvp(3) to find diff --git a/src/code/describe.lisp b/src/code/describe.lisp index fe217a4..79de2f8 100644 --- a/src/code/describe.lisp +++ b/src/code/describe.lisp @@ -353,10 +353,13 @@ (%describe-doc x s 'type "Type") (%describe-doc x s 'setf "Setf macro") (dolist (assoc (info :random-documentation :stuff x)) - (format s - "~&~@" - (car assoc) - (cdr assoc))) + (let ((type (car assoc))) + (format s + "~&~@" + (case type + ((optimize) "optimize quality") + (t (car assoc))) + (cdr assoc)))) ;; Mention the associated type information, if any. ;; diff --git a/src/compiler/policies.lisp b/src/compiler/policies.lisp index f5c417d..1ee4f10 100644 --- a/src/compiler/policies.lisp +++ b/src/compiler/policies.lisp @@ -18,16 +18,26 @@ (cond ((= safety 0) 0) ((and (< safety 2) (< safety speed)) 2) (t 3)) - ("no" "maybe" "weak" "full")) + ("no" "maybe" "weak" "full") + "Control the way to perform runtime type checking: +0: declared types are simply trusted; no runtime checks are performed; +2: fast checks are performed: declared types are weakened to + FIXNUM/SINGLE-FLOAT/FLOAT/NUMBER/structure/specialized array etc.; +3: declared types are fully checked (several exceptions exist; + see \"SBCL User Manual\", Compiler->Handling of Types-> + Implementation Limitations for details).") (define-optimization-quality check-tag-existence (cond ((= safety 0) 0) (t 3)) - ("no" "maybe" "yes" "yes")) + ("no" "maybe" "yes" "yes") + "Control whether GO and RETURN-FROM check liveness of the destination tag. +Enabling this option can increase heap consing of closures.") (define-optimization-quality let-conversion (if (<= debug speed) 3 0) - ("off" "maybe" "on" "on")) + ("off" "maybe" "on" "on") + "Control inline-substitution of used-once local functions.") (define-optimization-quality verify-arg-count (if (zerop safety) 0 3) @@ -38,32 +48,64 @@ (> speed debug)) 3 0) - ("no" "maybe" "yes" "yes")) + ("no" "maybe" "yes" "yes") + "Control whether tail-calls should reuse caller stack frame. +Enabling this option make functions use less stack space, and make +tail-recursive functions execute in constant stack, but debugging +become harder, because backtraces show only part of function call +sequence. + +This options has no effect when INSERT-DEBUG-CATCH is set.") (define-optimization-quality insert-debug-catch (if (> debug (max speed space)) 3 0) - ("no" "maybe" "yes" "yes")) + ("no" "maybe" "yes" "yes") + "Enable possibility of returning from stack frames with the debugger. + +Enabling this option effectively disables MERGE-TAIL-CALLS.") (define-optimization-quality recognize-self-calls (if (> (max speed space) debug) 3 0) - ("no" "maybe" "yes" "yes")) + ("no" "maybe" "yes" "yes") + "When enabled, reference to a function FOO inside the body of (DEFUN +FOO ...) is considered to be the reference to the function being +defined. Calls to FOO are compiled as local. This allows better +optimization and type checking, but TRACE will not show recursive +calls. If the function object is bound to another name BAR, and FOO is +bound to another function, calls to FOO inside BAR will remain to be +recursive. + +When disabled, internal references to a function FOO will be +considered ti be a call of a function, bound to the symbol at +run-time, which is less efficient. TRACE will show recursive calls. In +case of renaming described above, calls to FOO will not be recursive +and will refer to the new function, bound to FOO.") (define-optimization-quality stack-allocate-dynamic-extent (if (and (> (max speed space) (max debug safety)) (< safety 3)) 3 0) - ("no" "maybe" "yes" "yes")) + ("no" "maybe" "yes" "yes") + "Control whether allocate objects, declared DYNAMIC-EXTENT, on +stack.") (define-optimization-quality stack-allocate-vector (cond ((= stack-allocate-dynamic-extent 0) 0) ((= safety 0) 3) (t 2)) - ("no" "maybe" "one page" "yes")) + ("no" "maybe" "one page" "yes") + "Control what vectors, declared DYNAMIC-EXTENT, are allocated on stack: +0: no vectors are allocated on stack; +2: only short vectors (compiler knows them to fit on one page); +3: every. + +This option has an effect only when STACK-ALLOCATE-DYNAMIC-EXTENT is +set.") (define-optimization-quality float-accuracy 3 @@ -73,7 +115,11 @@ (if (> debug (max speed space compilation-speed)) debug 0) - ("no" "no" "partial" "full")) + ("no" "no" "partial" "full") + "Control instrumentation of code, enabling single-stepping through +it in the debugger. + +This option has no effect without COMPUTE-DEBUG-FUN.") (define-optimization-quality compute-debug-fun debug @@ -84,7 +130,14 @@ (< speed 3)) 3 0) - ("no" "no" "no" "yes")) + ("no" "no" "no" "yes") + "When disabled, LET variable, which is never set and is referenced +exactly once, is eliminated and the reference is substituted with the +initial value. This allows better type inference and some algebraic +optimizations. + +When enabled, the variable is preserved and can be seen in the +debugger.") (define-optimization-quality insert-array-bounds-checks (if (= safety 0) 0 3) diff --git a/src/compiler/policy.lisp b/src/compiler/policy.lisp index d0beebe..26bf0ce 100644 --- a/src/compiler/policy.lisp +++ b/src/compiler/policy.lisp @@ -154,16 +154,19 @@ EXPERIMENTAL INTERFACE: Subject to change." ;;; Dependent qualities (defmacro define-optimization-quality - (name expression &optional documentation) + (name expression &optional values-documentation documentation) + (declare (ignorable documentation)) `(eval-when (:compile-toplevel :load-toplevel :execute) (let ((acons (assoc ',name *policy-dependent-qualities*)) (item (make-policy-dependent-quality :name ',name :expression ',expression :getter (lambda (policy) (policy policy ,expression)) - :values-documentation ',documentation))) + :values-documentation ',values-documentation))) (if acons (setf (cdr acons) item) (setf *policy-dependent-qualities* (nconc *policy-dependent-qualities* (list `(,',name . ,item)))))) + #-sb-xc-host + ,@(when documentation `((setf (fdocumentation ',name 'optimize) ,documentation))) ',name)) diff --git a/src/pcl/documentation.lisp b/src/pcl/documentation.lisp index 7dd07e4..d957392 100644 --- a/src/pcl/documentation.lisp +++ b/src/pcl/documentation.lisp @@ -47,6 +47,9 @@ (defmethod documentation ((x symbol) (doc-type (eql 'setf))) (values (info :setf :documentation x))) +(defmethod documentation ((x symbol) (doc-type (eql 'optimize))) + (random-documentation x 'optimize)) + (defun (setf fun-doc) (new-value x) (etypecase x (generic-function diff --git a/version.lisp-expr b/version.lisp-expr index 77bbe2a..7d1d1f9 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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.13.27" +"1.0.13.28" -- 1.7.10.4