[cmucl-cvs] [git] CMU Common Lisp branch master updated. snapshot-2012-09-6-g8d75583
Raymond Toy
rtoy at common-lisp.net
Wed Sep 26 16:05:17 UTC 2012
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMU Common Lisp".
The branch, master has been updated
via 8d75583bb9d07f2103e49aa5795c1e9604b76a55 (commit)
via f621914f1423e61c88b30583bd9056121b0c4139 (commit)
from 3832e020b43c1270e0710097381fb718271e61bf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 8d75583bb9d07f2103e49aa5795c1e9604b76a55
Author: Raymond Toy <toy.raymond at gmail.com>
Date: Tue Sep 25 21:19:05 2012 -0700
Add WITH-CYCLE-COUNTER for x86, sparc, and ppc. Sparc and ppc
versions are untested.
diff --git a/src/compiler/ppc/system.lisp b/src/compiler/ppc/system.lisp
index c3fe76a..edeed9a 100644
--- a/src/compiler/ppc/system.lisp
+++ b/src/compiler/ppc/system.lisp
@@ -275,3 +275,22 @@
(defun read-cycle-counter ()
(read-time-base))
+
+(defmacro with-cycle-counter (&body body)
+ "Returns the primary value of BODY as the primary value, and the
+ number of tick cycles elapsed as secondary value. To get the number
+ of cycles, multiply by *cycles-per-tick*"
+ (let ((hi0 (gensym))
+ (hi1 (gensym))
+ (lo0 (gensym))
+ (lo1 (gensym)))
+ `(multiple-value-bind (,lo0 ,hi0)
+ (read-cycle-counter)
+ (values (locally , at body)
+ (multiple-value-bind (,lo1 ,hi1)
+ (read-cycle-counter)
+ ;; Can't do anything about the notes about generic
+ ;; arithmetic, so silence the notes..
+ (declare (optimize (inhibit-warnings 3))
+ (+ (ash (- ,hi1 ,hi0) 32)
+ (- ,lo1 ,lo0)))))))
diff --git a/src/compiler/sparc/system.lisp b/src/compiler/sparc/system.lisp
index f4f99f9..2ba0b34 100644
--- a/src/compiler/sparc/system.lisp
+++ b/src/compiler/sparc/system.lisp
@@ -284,3 +284,21 @@
64-bit counter is returned as two 32-bit unsigned integers. The low 32-bit
result is the first value."
(read-cycle-counter))
+
+(defmacro with-cycle-counter (&body body)
+ "Returns the primary value of BODY as the primary value, and the
+ number of CPU cycles elapsed as secondary value."
+ (let ((hi0 (gensym))
+ (hi1 (gensym))
+ (lo0 (gensym))
+ (lo1 (gensym)))
+ `(multiple-value-bind (,lo0 ,hi0)
+ (read-cycle-counter)
+ (values (locally , at body)
+ (multiple-value-bind (,lo1 ,hi1)
+ (read-cycle-counter)
+ ;; Can't do anything about the notes about generic
+ ;; arithmetic, so silence the notes..
+ (declare (optimize (inhibit-warnings 3))
+ (+ (ash (- ,hi1 ,hi0) 32)
+ (- ,lo1 ,lo0)))))))
diff --git a/src/compiler/x86/system.lisp b/src/compiler/x86/system.lisp
index bb32332..9207b5b 100644
--- a/src/compiler/x86/system.lisp
+++ b/src/compiler/x86/system.lisp
@@ -562,7 +562,7 @@
(inst ret)))
-;; the RDTSC instruction (present on Pentium processors and
+;; The RDTSC instruction (present on Pentium processors and
;; successors) allows you to access the time-stamp counter, a 64-bit
;; model-specific register that counts executed cycles. The
;; instruction returns the low cycle count in EAX and high cycle count
@@ -676,3 +676,21 @@
(defun cpuid (level)
(declare (type (unsigned-byte 32) level))
(cpuid level))
+
+(defmacro with-cycle-counter (&body body)
+ "Returns the primary value of BODY as the primary value, and the
+ number of CPU cycles elapsed as secondary value."
+ (let ((hi0 (gensym))
+ (hi1 (gensym))
+ (lo0 (gensym))
+ (lo1 (gensym)))
+ `(multiple-value-bind (,lo0 ,hi0)
+ (read-cycle-counter)
+ (values (locally , at body)
+ (multiple-value-bind (,lo1 ,hi1)
+ (read-cycle-counter)
+ ;; Can't do anything about the notes about generic
+ ;; arithmetic, so silence the notes..
+ (declare (optimize (inhibit-warnings 3))
+ (+ (ash (- ,hi1 ,hi0) 32)
+ (- ,lo1 ,lo0)))))))
diff --git a/src/general-info/release-20d.txt b/src/general-info/release-20d.txt
index c11c5ee..a17c0da 100644
--- a/src/general-info/release-20d.txt
+++ b/src/general-info/release-20d.txt
@@ -54,6 +54,8 @@ New in this release:
* OSX 10.4 is no longer supported.
* Micro optimizations for floats: 2*x -> x+x and x/2^n ->
(2^(n))*x.
+ * Add VM::WITH-CYCLE-COUNTER to return the number of cycles elapsed
+ when executing the body, as measured by the CPU cycle/tick counter.
* ANSI compliance fixes:
* CMUCL was not printing pathnames like (make-pathname :directory
commit f621914f1423e61c88b30583bd9056121b0c4139
Author: Raymond Toy <toy.raymond at gmail.com>
Date: Tue Sep 25 21:15:51 2012 -0700
Update.
diff --git a/src/general-info/release-20d.txt b/src/general-info/release-20d.txt
index 827a741..c11c5ee 100644
--- a/src/general-info/release-20d.txt
+++ b/src/general-info/release-20d.txt
@@ -92,6 +92,8 @@ New in this release:
compiling the file.
* Minor build issue in CLM debugger interface due to USE-PACKAGE
no longer having special compiler treatment.
+ * READ-CYCLE-COUNTER no longer destroys any live values in the EBX
+ and ECX registers.
* Trac Tickets:
* #50: Print/read error with make-pathname.
-----------------------------------------------------------------------
Summary of changes:
src/compiler/ppc/system.lisp | 19 +++++++++++++++++++
src/compiler/sparc/system.lisp | 18 ++++++++++++++++++
src/compiler/x86/system.lisp | 20 +++++++++++++++++++-
src/general-info/release-20d.txt | 4 ++++
4 files changed, 60 insertions(+), 1 deletions(-)
hooks/post-receive
--
CMU Common Lisp
More information about the cmucl-cvs
mailing list