1.0.19.7: refactor stack allocation decisions
[sbcl/pkhuong.git] / src / code / describe-policy.lisp
blobcfecbdbc8edfdf8933216c5e6c16630a766534a9
1 ;;;; DESCRIBE-COMPILER-POLICY
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
12 (in-package "SB-C") ;(SB-C, not SB!C, since we're built in warm load.)
14 (defun describe-compiler-policy (&optional spec)
15 #+sb-doc
16 "Print all global optimization settings, augmented by SPEC."
17 (let ((policy (process-optimize-decl (cons 'optimize spec) *policy*)))
18 (fresh-line)
19 (format t " Basic qualities:~%")
20 (dolist (quality *policy-qualities*)
21 (format t "~S = ~D~%" quality (policy-quality policy quality)))
22 (format t " Dependent qualities:~%")
23 (loop for (name . info) in *policy-dependent-qualities*
24 for values-documentation = (policy-dependent-quality-values-documentation info)
25 for explicit-value = (policy-quality policy name)
26 do (if (= explicit-value 1)
27 (let* ((getter (policy-dependent-quality-getter info))
28 (value (funcall getter policy))
29 (documentation (elt values-documentation value)))
30 (format t "~S = ~D -> ~D (~A)~%"
31 name explicit-value
32 value documentation))
33 (let ((documentation (elt values-documentation explicit-value)))
34 (format t "~S = ~D (~A)~%"
35 name explicit-value documentation)))))
37 (values))