X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcompiler-test-util.lisp;h=352db70625909a192a53ca3c4ebb383345ddd47e;hb=062283b901155792f65775491aea51481c56faaa;hp=47ffa11c0925948ee3e90953f3d5a301addc9c9d;hpb=40bff32181a4d9b591ae2bac69bbee3bd77a82bc;p=sbcl.git diff --git a/tests/compiler-test-util.lisp b/tests/compiler-test-util.lisp index 47ffa11..352db70 100644 --- a/tests/compiler-test-util.lisp +++ b/tests/compiler-test-util.lisp @@ -17,6 +17,7 @@ (:export #:assert-consing #:assert-no-consing #:compiler-derived-type + #:count-full-calls #:find-value-cell-values #:find-code-constants #:find-named-callees @@ -100,21 +101,6 @@ (unwind-protect (progn (with-open-file (f lisp :direction :output) - (dolist (form toplevel-forms) - (prin1 form f))) - (multiple-value-bind (fasl warn fail) (compile-file lisp) - (when load - (load fasl)) - (values warn fail))) - (ignore-errors (delete-file lisp)) - (ignore-errors (delete-file fasl))))) - -(defun file-compile (toplevel-forms &key load) - (let* ((lisp (merge-pathnames "file-compile-tmp.lisp")) - (fasl (compile-file-pathname lisp))) - (unwind-protect - (progn - (with-open-file (f lisp :direction :output) (if (stringp toplevel-forms) (write-line toplevel-forms f) (dolist (form toplevel-forms) @@ -125,3 +111,16 @@ (values warn fail))) (ignore-errors (delete-file lisp)) (ignore-errors (delete-file fasl))))) + +;; Pretty horrible, but does the job +(defun count-full-calls (name function) + (let ((code (with-output-to-string (s) + (disassemble function :stream s))) + (n 0)) + (with-input-from-string (s code) + (loop for line = (read-line s nil nil) + while line + when (and (search name line) + (search "#