[cmucl-cvs] [git] CMU Common Lisp branch master updated. snapshot-2012-07-9-g6180b39

Raymond Toy rtoy at common-lisp.net
Wed Jul 18 03:13:46 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  6180b3963ea5a38ef9f2f82bc53995e6dba349c1 (commit)
       via  40b532c59cd9ff6d48588ed8c36880a625009142 (commit)
      from  ebb2b74c4b31d9e28432993958657c67bef50f0d (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 6180b3963ea5a38ef9f2f82bc53995e6dba349c1
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Tue Jul 17 20:13:39 2012 -0700

    Remove comment about compiling with clang, which now works fine.

diff --git a/src/lisp/Config.x86_common b/src/lisp/Config.x86_common
index edf4476..ea52b94 100644
--- a/src/lisp/Config.x86_common
+++ b/src/lisp/Config.x86_common
@@ -45,23 +45,9 @@ ifdef FEATURE_UNICODE
 CPP_DEFINE_OPTIONS += -DUNICODE
 endif
 
-# Default to using gcc
+# Default to using gcc.  But clang also works.
 CC = gcc
 
-# But we can use clang.
-#
-# However, clang seems to want to use SSE instructions in various
-# places, but we DON'T want that because we need a lisp that will run
-# on chips without sse.
-#
-# But on Mac, every machine has SSE2 so we can use SSE2.  However,
-# there's some code path through GC or allocation where we aren't
-# saving the FPU state so after GC or allocation, some XMM FP
-# registers are corrupted.  
-#
-# Got that?
-
-#CC = clang -mno-sse
 
 LD = ld
 

commit 40b532c59cd9ff6d48588ed8c36880a625009142
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Tue Jul 17 20:11:13 2012 -0700

    Fix ticket:61, using option 2.
    
    src/lisp/gencgc.c:
    o Save and restore the FPU state in alloc().
    
    src/compiler/x86/alloc.lisp
    src/compiler/x86/array.lisp
    src/compiler/x86/call.lisp
    src/compiler/x86/float-sse2.lisp
    src/compiler/x86/float.lisp
    src/compiler/x86/move.lisp
    src/compiler/x86/sap.lisp:
    o Don't need to use :save-p anymore because the allocation routine
      saves an live registers anyway.  This improves code generation as
      well.
    
    src/general-info/release-20d.txt:
    o Update.

diff --git a/src/compiler/x86/alloc.lisp b/src/compiler/x86/alloc.lisp
index bff6d0b..85d95d1 100644
--- a/src/compiler/x86/alloc.lisp
+++ b/src/compiler/x86/alloc.lisp
@@ -53,7 +53,6 @@
   (:variant-vars star)
   (:policy :safe)
   (:node-var node)
-  (:save-p t)
   (:generator 0
     (cond ((zerop num)
 	   ;; (move result nil-value)
@@ -142,7 +141,6 @@
   (:temporary (:sc unsigned-reg :from (:argument 0)) boxed)
   (:temporary (:sc unsigned-reg :from (:argument 1)) unboxed)
   (:node-var node)
-  (:save-p t)
   (:generator 100
     (move boxed boxed-arg)
     (inst add boxed (fixnumize (1+ code-trace-table-offset-slot)))
@@ -171,7 +169,6 @@
   (:args (name :scs (descriptor-reg) :to :eval))
   (:results (result :scs (descriptor-reg) :from :argument))
   (:node-var node)
-  (:save-p t)
   (:generator 37
     (with-fixed-allocation (result fdefn-type fdefn-size node)
       (storew name result fdefn-name-slot other-pointer-type)
@@ -185,7 +182,6 @@
   (:args (name :scs (descriptor-reg) :to :eval))
   (:results (result :scs (descriptor-reg) :from :argument))
   (:node-var node)
-  (:save-p t)
   (:generator 37
     (with-fixed-allocation (result fdefn-type fdefn-size node)
       (storew name result fdefn-name-slot other-pointer-type)
@@ -200,7 +196,6 @@
   (:temporary (:sc any-reg) temp)
   (:results (result :scs (descriptor-reg)))
   (:node-var node)
-  (:save-p t)
   (:generator 10
    (let ((*enable-pseudo-atomic* (unless dynamic-extent
 				   *enable-pseudo-atomic*)))
@@ -220,7 +215,6 @@
   (:args (value :scs (descriptor-reg any-reg) :to :result))
   (:results (result :scs (descriptor-reg) :from :eval))
   (:node-var node)
-  (:save-p t)
   (:generator 10
     (with-fixed-allocation
 	(result value-cell-header-type value-cell-size node)
@@ -242,7 +236,6 @@
   (:ignore name)
   (:results (result :scs (descriptor-reg)))
   (:node-var node)
-  (:save-p t)
   (:generator 50
     (let ((*enable-pseudo-atomic* (unless dynamic-extent
 				    *enable-pseudo-atomic*)))
@@ -261,7 +254,6 @@
   (:temporary (:sc any-reg :from :eval :to (:eval 1)) bytes)
   (:temporary (:sc any-reg :from :eval :to :result) header)
   (:node-var node)
-  (:save-p t)
   (:generator 50
     (inst lea bytes
 	  (make-ea :dword :base extra :disp (* (1+ words) word-bytes)))
@@ -287,7 +279,6 @@
   (:temporary (:sc unsigned-reg :from :eval) state-addr)
   (:results (result :scs (descriptor-reg) :from :argument))
   (:node-var node)
-  (:save-p t)
   (:generator 37
     (with-fixed-allocation (result symbol-header-type symbol-size node)
       (storew name result symbol-name-slot other-pointer-type)
diff --git a/src/compiler/x86/array.lisp b/src/compiler/x86/array.lisp
index 79b3ad1..ae86e43 100644
--- a/src/compiler/x86/array.lisp
+++ b/src/compiler/x86/array.lisp
@@ -35,7 +35,6 @@
   (:temporary (:sc any-reg :to :result) header)
   (:results (result :scs (descriptor-reg) :from :eval))
   (:node-var node)
-  (:save-p t)
   (:generator 13
     (inst lea bytes
 	  (make-ea :dword :base rank
diff --git a/src/compiler/x86/call.lisp b/src/compiler/x86/call.lisp
index d0188c9..63104de 100644
--- a/src/compiler/x86/call.lisp
+++ b/src/compiler/x86/call.lisp
@@ -1365,7 +1365,6 @@
   (:temporary (:sc unsigned-reg) dst)
   (:results (result :scs (descriptor-reg)))
   (:node-var node)
-  (:save-p t)
   (:generator 20
     (let ((enter (gen-label))
 	  (loop (gen-label))
diff --git a/src/compiler/x86/float-sse2.lisp b/src/compiler/x86/float-sse2.lisp
index 9fe6d5d..f54f072 100644
--- a/src/compiler/x86/float-sse2.lisp
+++ b/src/compiler/x86/float-sse2.lisp
@@ -413,7 +413,6 @@
   (:results (y :scs (descriptor-reg)))
   (:node-var node)
   (:note _N"float to pointer coercion")
-  (:save-p t)
   (:generator 13
      (with-fixed-allocation (y vm:single-float-type vm:single-float-size node)
        (inst movss (ea-for-sf-desc y) x))))
@@ -425,7 +424,6 @@
   (:results (y :scs (descriptor-reg)))
   (:node-var node)
   (:note _N"float to pointer coercion")
-  (:save-p t)
   (:generator 13
      (with-fixed-allocation (y vm:double-float-type vm:double-float-size node)
        (inst movsd (ea-for-df-desc y) x))))
@@ -438,7 +436,6 @@
   (:results (y :scs (descriptor-reg)))
   (:node-var node)
   (:note _N"float to pointer coercion")
-  (:save-p t)
   (:generator 13
      (with-fixed-allocation (y vm:long-float-type vm:long-float-size node)
        (with-tn at fp-top(x)
@@ -501,7 +498,6 @@
   (:results (y :scs (descriptor-reg)))
   (:node-var node)
   (:note _N"complex float to pointer coercion")
-  (:save-p t)
   (:generator 13
      (with-fixed-allocation (y vm:complex-single-float-type
 			       vm:complex-single-float-size node)
@@ -514,7 +510,6 @@
   (:results (y :scs (descriptor-reg)))
   (:node-var node)
   (:note _N"complex float to pointer coercion")
-  (:save-p t)
   (:generator 13
      (with-fixed-allocation (y vm:complex-double-float-type
 			       vm:complex-double-float-size node)
@@ -529,7 +524,6 @@
   (:results (y :scs (descriptor-reg)))
   (:node-var node)
   (:note _N"complex float to pointer coercion")
-  (:save-p t)
   (:generator 13
      (with-fixed-allocation (y vm:complex-long-float-type
 			       vm:complex-long-float-size node)
@@ -549,7 +543,6 @@
   (:results (y :scs (descriptor-reg)))
   (:node-var node)
   (:note _N"complex double-double float to pointer coercion")
-  (:save-p t)
   (:generator 13
      (with-fixed-allocation (y vm::complex-double-double-float-type
 			       vm::complex-double-double-float-size node)
@@ -1570,7 +1563,6 @@
   (:results (y :scs (descriptor-reg)))
   (:node-var node)
   (:note _N"double double float to pointer coercion")
-  (:save-p t)
   (:generator 13
      (with-fixed-allocation (y vm:double-double-float-type
 			       vm:double-double-float-size node)
diff --git a/src/compiler/x86/float.lisp b/src/compiler/x86/float.lisp
index e0e90b0..e4d5952 100644
--- a/src/compiler/x86/float.lisp
+++ b/src/compiler/x86/float.lisp
@@ -498,7 +498,6 @@
   (:results (y :scs (descriptor-reg)))
   (:node-var node)
   (:note _N"float to pointer coercion")
-  (:save-p t)
   (:generator 13
      (with-fixed-allocation (y vm:single-float-type vm:single-float-size node)
        (with-tn at fp-top(x)
@@ -511,7 +510,6 @@
   (:results (y :scs (descriptor-reg)))
   (:node-var node)
   (:note _N"float to pointer coercion")
-  (:save-p t)
   (:generator 13
      (with-fixed-allocation (y vm:double-float-type vm:double-float-size node)
        (with-tn at fp-top(x)
@@ -525,7 +523,6 @@
   (:results (y :scs (descriptor-reg)))
   (:node-var node)
   (:note _N"float to pointer coercion")
-  (:save-p t)
   (:generator 13
      (with-fixed-allocation (y vm:long-float-type vm:long-float-size node)
        (with-tn at fp-top(x)
@@ -604,7 +601,6 @@
   (:results (y :scs (descriptor-reg)))
   (:node-var node)
   (:note _N"complex float to pointer coercion")
-  (:save-p t)
   (:generator 13
      (with-fixed-allocation (y vm:complex-single-float-type
 			       vm:complex-single-float-size node)
@@ -622,7 +618,6 @@
   (:results (y :scs (descriptor-reg)))
   (:node-var node)
   (:note _N"complex float to pointer coercion")
-  (:save-p t)
   (:generator 13
      (with-fixed-allocation (y vm:complex-double-float-type
 			       vm:complex-double-float-size node)
@@ -641,7 +636,6 @@
   (:results (y :scs (descriptor-reg)))
   (:node-var node)
   (:note _N"complex float to pointer coercion")
-  (:save-p t)
   (:generator 13
      (with-fixed-allocation (y vm:complex-long-float-type
 			       vm:complex-long-float-size node)
@@ -661,7 +655,6 @@
   (:results (y :scs (descriptor-reg)))
   (:node-var node)
   (:note _N"complex double-double float to pointer coercion")
-  (:save-p t)
   (:generator 13
      (with-fixed-allocation (y vm::complex-double-double-float-type
 			       vm::complex-double-double-float-size node)
@@ -5061,7 +5054,6 @@
   (:results (y :scs (descriptor-reg)))
   (:node-var node)
   (:note _N"double double float to pointer coercion")
-  (:save-p t)
   (:generator 13
      (with-fixed-allocation (y vm:double-double-float-type
 			       vm:double-double-float-size node)
diff --git a/src/compiler/x86/move.lisp b/src/compiler/x86/move.lisp
index 7c6f0b9..2ff54ee 100644
--- a/src/compiler/x86/move.lisp
+++ b/src/compiler/x86/move.lisp
@@ -300,7 +300,6 @@
   (:results (y :scs (any-reg descriptor-reg) :from :argument))
   (:note _N"signed word to integer coercion")
   (:node-var node)
-  (:save-p t)
   (:generator 20
      (assert (not (location= x y)))
      (let ((bignum (gen-label))
@@ -349,7 +348,6 @@
   (:results (y :scs (any-reg descriptor-reg)))
   (:node-var node)
   (:note _N"unsigned word to integer coercion")
-  (:save-p t)
   (:generator 20
     (assert (not (location= x y)))
     (assert (not (location= x alloc)))
diff --git a/src/compiler/x86/sap.lisp b/src/compiler/x86/sap.lisp
index 43e1a0e..a01112e 100644
--- a/src/compiler/x86/sap.lisp
+++ b/src/compiler/x86/sap.lisp
@@ -44,7 +44,6 @@
   (:results (res :scs (descriptor-reg) :from :argument))
   (:note "SAP to pointer coercion") 
   (:node-var node)
-  (:save-p t)
   (:generator 20
     (with-fixed-allocation (res sap-type sap-size node)
       (storew sap res sap-pointer-slot other-pointer-type))))
diff --git a/src/general-info/release-20d.txt b/src/general-info/release-20d.txt
index 4f9637e..5444383 100644
--- a/src/general-info/release-20d.txt
+++ b/src/general-info/release-20d.txt
@@ -94,6 +94,7 @@ New in this release:
     * #55: blocked signals.
     * #58: UTF-16 buffering problem.
     * #60: compile-file and export problem
+    * #61: Darwin+clang doesn't produce a working lisp
 
   * Other changes:
     * The layout of the cmucl directories has been changed.
diff --git a/src/lisp/gencgc.c b/src/lisp/gencgc.c
index fc095f8..cab6a0c 100644
--- a/src/lisp/gencgc.c
+++ b/src/lisp/gencgc.c
@@ -8027,6 +8027,7 @@ void do_pending_interrupt(void);
 char *
 alloc(int nbytes)
 {
+    void *new_obj;
 #if !(defined(sparc) || (defined(DARWIN) && defined(__ppc__)))
     /*
      * *current-region-free-pointer* is the same as alloc-tn (=
@@ -8041,24 +8042,44 @@ alloc(int nbytes)
     bytes_allocated_sum += nbytes;
 
     for (;;) {
-	void *new_obj;
 	char *new_free_pointer = (void *) (get_current_region_free() + nbytes);
 
 	if (new_free_pointer <= boxed_region.end_addr) {
 	    /* Allocate from the current region. */
 	    new_obj = (void *) get_current_region_free();
 	    set_current_region_free((lispobj) new_free_pointer);
-	    return new_obj;
+            break;
 	} else if (bytes_allocated <= auto_gc_trigger) {
+#if defined(i386) || defined(__x86_64)
+            /*
+             * Need to save and restore the FPU registers on x86, but only for
+             * sse2.  See Ticket #61.
+             *
+             * Not needed by sparc or ppc because we never call alloc from
+             * Lisp directly to do allocation.
+             */
+            FPU_STATE(fpu_state);
+
+            if (fpu_mode == SSE2) {
+                save_fpu_state(fpu_state);
+            }
+#endif
 	    /* Call gc_alloc.  */
 	    boxed_region.free_pointer = (void *) get_current_region_free();
 	    boxed_region.end_addr =
 		(void *) SymbolValue(CURRENT_REGION_END_ADDR);
 
 	    new_obj = gc_alloc(nbytes);
+
 	    set_current_region_free((lispobj) boxed_region.free_pointer);
 	    set_current_region_end((lispobj) boxed_region.end_addr);
-	    return new_obj;
+
+#if defined(i386) || defined(__x86_64)
+            if (fpu_mode == SSE2) {
+                restore_fpu_state(fpu_state);
+            }
+#endif
+            break;
 	} else {
 	    /* Run GC and try again.  */
 	    auto_gc_trigger *= 2;
@@ -8070,6 +8091,8 @@ alloc(int nbytes)
 	    set_pseudo_atomic_atomic();
 	}
     }
+
+    return new_obj;
 }
 
 char *

-----------------------------------------------------------------------

Summary of changes:
 src/compiler/x86/alloc.lisp      |    9 ---------
 src/compiler/x86/array.lisp      |    1 -
 src/compiler/x86/call.lisp       |    1 -
 src/compiler/x86/float-sse2.lisp |    8 --------
 src/compiler/x86/float.lisp      |    8 --------
 src/compiler/x86/move.lisp       |    2 --
 src/compiler/x86/sap.lisp        |    1 -
 src/general-info/release-20d.txt |    1 +
 src/lisp/Config.x86_common       |   16 +---------------
 src/lisp/gencgc.c                |   29 ++++++++++++++++++++++++++---
 10 files changed, 28 insertions(+), 48 deletions(-)


hooks/post-receive
-- 
CMU Common Lisp




More information about the cmucl-cvs mailing list