From bc328488e1f74035a45341191a098b927ba8de4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Fri, 26 Feb 2016 12:06:38 +0100 Subject: [PATCH] Get rid of bunch of eval-when forms Also adding extra eval-when around generic get-cons makes the package compile under XCL. --- metering.cl | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/metering.cl b/metering.cl index 1ada5f5..ede4c43 100644 --- a/metering.cl +++ b/metering.cl @@ -387,24 +387,32 @@ Estimated total monitoring overhead: 0.88 seconds ;;; The get-cons macro is called to find the total number of bytes ;;; consed since the beginning of time. -(eval-when (compile load eval) - #+cmu - (defmacro get-cons () - "The get-cons macro is called to find the total number of bytes +#+cmu +(defmacro get-cons () + "The get-cons macro is called to find the total number of bytes consed since the beginning of time." - '(the consing-type (ext:get-bytes-consed))) + '(the consing-type (ext:get-bytes-consed))) - #+clisp - (defmacro get-cons () - `(the consing-type - (multiple-value-bind (real1 real2 run1 run2 gc1 gc2 space1 space2 gccount) - (sys::%%time) - (declare (ignore real1 real2 run1 run2 gc1 gc2 gccount)) - (dpb space1 (byte 24 24) space2)))) +#+clisp +(defmacro get-cons () + `(the consing-type + (multiple-value-bind (real1 real2 run1 run2 gc1 gc2 space1 space2 gccount) + (sys::%%time) + (declare (ignore real1 real2 run1 run2 gc1 gc2 gccount)) + (dpb space1 (byte 24 24) space2)))) + +#+clozure +(defmacro get-cons () + `(the consing-type (ccl::total-bytes-allocated))) - #+clozure +#+ecl +;; ECL has to compile the inlined C-code, otherwise it gets the generic +;; definition. +(eval-when (eval) + (warn "No consing will be reported unless the package is compiled.") (defmacro get-cons () - `(the consing-type (ccl::total-bytes-allocated)))) + (defmacro get-cons () + '(the consing-type 0)))) #+ecl ;; ECL has to compile the inlined C-code, otherwise it gets the generic @@ -415,12 +423,13 @@ Estimated total monitoring overhead: 0.88 seconds "ecl_make_unsigned_integer(GC_get_total_bytes())" :one-liner t)))) -(eval-when (compile load eval) - (unless (fboundp 'get-cons) - (eval-when (compile eval) - (warn "No consing will be reported unless a get-cons function is ~ +#-(or cmu clisp clozure ecl) +(progn + (eval-when (compile eval) + (warn "No consing will be reported unless a get-cons function is ~ defined.")) + (eval-when (load eval) (defmacro get-cons () '(the consing-type 0)))) ;;; ******************************** -- GitLab