X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fprofile.lisp;h=57b3a5eb12a63a4759807bc1039b176bfe723853;hb=204f2fa9771ad9e55718dc76205afec7d11b3011;hp=4bb691c094b273f523f3d605f5d3b633ab0cf39f;hpb=39ca94ec421224c78cb01f7d2d7b49321c66a2d4;p=sbcl.git diff --git a/src/code/profile.lisp b/src/code/profile.lisp index 4bb691c..57b3a5e 100644 --- a/src/code/profile.lisp +++ b/src/code/profile.lisp @@ -193,7 +193,6 @@ ;;; will minimize profiling overhead.) (defun profile-encapsulation-lambdas (encapsulated-fun) (declare (type function encapsulated-fun)) - (declare (optimize speed safety)) (let* ((count 0) (ticks 0) (consing 0) @@ -202,7 +201,8 @@ (values ;; ENCAPSULATION-FUN (lambda (sb-c:&more arg-context arg-count) - #+nil (declare (optimize (speed 3) (safety 0))) ; FIXME: remove #+NIL? + (declare (optimize speed safety)) + ;; FIXME: Probably when this is stable, we should optimize (SAFETY 0). (fastbig-incf-pcounter-or-fixnum count 1) (let ((dticks 0) (dconsing 0) @@ -287,6 +287,7 @@ ;;; Profile the named function, which should exist and not be profiled ;;; already. (defun profile-1-unprofiled-function (name) + (declare #.*optimize-byte-compilation*) (let ((encapsulated-fun (fdefinition name))) (multiple-value-bind (encapsulation-fun read-stats-fun clear-stats-fun) (profile-encapsulation-lambdas encapsulated-fun) @@ -302,6 +303,7 @@ ;;; Profile the named function. If already profiled, unprofile first. (defun profile-1-function (name) + (declare #.*optimize-byte-compilation*) (cond ((fboundp name) (when (gethash name *profiled-function-name->info*) (warn "~S is already profiled, so unprofiling it first." name) @@ -313,6 +315,7 @@ ;;; Unprofile the named function, if it is profiled. (defun unprofile-1-function (name) + (declare #.*optimize-byte-compilation*) (let ((pinfo (gethash name *profiled-function-name->info*))) (cond (pinfo (remhash name *profiled-function-name->info*) @@ -337,6 +340,7 @@ reprofile (useful to notice function redefinition.) If a name is undefined, then we give a warning and ignore it. See also UNPROFILE, REPORT and RESET." + (declare #.*optimize-byte-compilation*) (if (null names) `(loop for k being each hash-key in *profiled-function-name->info* collecting k) @@ -349,11 +353,13 @@ a function. A string names all the functions named by symbols in the named package. NAMES defaults to the list of names of all currently profiled functions." + (declare #.*optimize-byte-compilation*) (if names `(mapc-on-named-functions #'unprofile-1-function ',names) `(unprofile-all))) (defun unprofile-all () + (declare #.*optimize-byte-compilation*) (dohash (name profile-info *profiled-function-name->info*) (declare (ignore profile-info)) (unprofile-1-function name))) @@ -399,7 +405,7 @@ approximately adjusted for profiling overhead, but when RAW is true the unadjusted results are reported. The compensation may be somewhat inaccurate when bignums are involved in runtime calculation, as in a very-long-running Lisp process." - (declare (optimize (speed 0))) + (declare #.*optimize-external-despite-byte-compilation*) (unless (boundp '*overhead*) (setf *overhead* (compute-overhead)))