[cmucl-cvs] [git] CMU Common Lisp branch master updated. snapshot-2012-06-4-g2daa0e7
Raymond Toy
rtoy at common-lisp.net
Thu Jul 5 15:48:45 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 2daa0e7c547d718b19b8b7d5408d8cf0be35a861 (commit)
from f61034ab9eadb5f0e86c1d93930c2cc7e04835c3 (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 2daa0e7c547d718b19b8b7d5408d8cf0be35a861
Author: Raymond Toy <toy.raymond at gmail.com>
Date: Thu Jul 5 08:48:31 2012 -0700
Rearrange the fpu save/restore stuff to make it a bit simpler.
diff --git a/src/lisp/arch.h b/src/lisp/arch.h
index 7de6665..b8ebf3f 100644
--- a/src/lisp/arch.h
+++ b/src/lisp/arch.h
@@ -32,6 +32,8 @@ extern lispobj funcall3(lispobj function, lispobj arg0, lispobj arg1,
extern void fpu_save(void *);
extern void fpu_restore(void *);
+extern void sse_save(void *);
+extern void sse_restore(void *);
extern void arch_make_linkage_entry(long, void *, long);
extern long arch_linkage_entry(unsigned long);
diff --git a/src/lisp/gencgc.c b/src/lisp/gencgc.c
index 1e20421..a14b714 100644
--- a/src/lisp/gencgc.c
+++ b/src/lisp/gencgc.c
@@ -664,14 +664,9 @@ gen_av_mem_age(int gen)
}
/*
- * The verbose argument controls how much to print out:
- * 0 for normal level of detail; 1 for debugging.
+ * Define macro to allocate a local array of the appropriate size
+ * where the fpu state can be stored.
*/
-void
-print_generation_stats(int verbose)
-{
- int i, gens;
-
#if defined(i386) || defined(__x86_64)
#define FPU_STATE_SIZE 27
/*
@@ -680,36 +675,73 @@ print_generation_stats(int verbose)
* appropriate alignment.
*/
#define SSE_STATE_SIZE ((512+16)/4)
- int fpu_state[FPU_STATE_SIZE];
- int sse_state[SSE_STATE_SIZE];
- extern void sse_save(void *);
- extern void sse_restore(void *);
+/*
+ * Just use the SSE size for both x87 and sse2 since the SSE size is
+ * enough for either.
+ */
+#define FPU_STATE(name) int name[SSE_STATE_SIZE];
+
#elif defined(sparc)
- /*
- * 32 (single-precision) FP registers, and the FP state register.
- * But Sparc V9 has 32 double-precision registers (equivalent to 64
- * single-precision, but can't be accessed), so we leave enough room
- * for that.
- */
+/*
+ * 32 (single-precision) FP registers, and the FP state register.
+ * But Sparc V9 has 32 double-precision registers (equivalent to 64
+ * single-precision, but can't be accessed), so we leave enough room
+ * for that.
+ */
#define FPU_STATE_SIZE (((32 + 32 + 1) + 1)/2)
- long long fpu_state[FPU_STATE_SIZE];
+#define FPU_STATE(name) long long name[FPU_STATE_SIZE];
#elif defined(DARWIN) && defined(__ppc__)
#define FPU_STATE_SIZE 32
- long long fpu_state[FPU_STATE_SIZE];
+#define FPU_STATE(name0 long long name[FPU_STATE_SIZE];
#endif
+void
+save_fpu_state(void* state)
+{
+#if defined(i386) || defined(__x86_64)
+ if (fpu_mode == SSE2) {
+ sse_save(state);
+ } else {
+ fpu_save(state);
+ }
+#else
+ fpu_save(state);
+#endif
+}
+
+void
+restore_fpu_state(void* state)
+{
+#if defined(i386) || defined(__x86_64)
+ if (fpu_mode == SSE2) {
+ sse_restore(state);
+ } else {
+ fpu_restore(state);
+ }
+#else
+ fpu_restore(state);
+#endif
+}
+
+
+/*
+ * The verbose argument controls how much to print out:
+ * 0 for normal level of detail; 1 for debugging.
+ */
+void
+print_generation_stats(int verbose)
+{
+ int i, gens;
+
+ FPU_STATE(fpu_state);
+
/*
* This code uses the FP instructions which may be setup for Lisp so
* they need to the saved and reset for C.
*/
- fpu_save(fpu_state);
-#if defined(i386) || defined(__x86_64)
- if (fpu_mode == SSE2) {
- sse_save(sse_state);
- }
-#endif
+ save_fpu_state(fpu_state);
/* Number of generations to print out. */
if (verbose)
@@ -763,12 +795,7 @@ print_generation_stats(int verbose)
}
fprintf(stderr, " Total bytes alloc=%ld\n", bytes_allocated);
- fpu_restore(fpu_state);
-#if defined(i386) || defined(__x86_64)
- if (fpu_mode == SSE2) {
- sse_restore(sse_state);
- }
-#endif
+ restore_fpu_state(fpu_state);
}
/* Get statistics that are kept "on the fly" out of the generation
-----------------------------------------------------------------------
Summary of changes:
src/lisp/arch.h | 2 +
src/lisp/gencgc.c | 89 ++++++++++++++++++++++++++++++++++------------------
2 files changed, 60 insertions(+), 31 deletions(-)
hooks/post-receive
--
CMU Common Lisp
More information about the cmucl-cvs
mailing list