0.9.10.26
[sbcl.git] / src / compiler / x86 / show.lisp
index b52d6a5..5fb38b9 100644 (file)
 (define-vop (print)
   (:args (object :scs (descriptor-reg any-reg)))
   (:temporary (:sc unsigned-reg
-              :offset eax-offset
-              :target result
-              :from :eval
-              :to (:result 0))
-             eax)
+               :offset eax-offset
+               :target result
+               :from :eval
+               :to (:result 0))
+              eax)
+  #!+darwin (:temporary (:sc unsigned-reg
+                            :offset esi-offset)
+                       prev-stack-pointer)
   (:results (result :scs (descriptor-reg)))
   (:save-p t)
   (:generator 100
-    (inst push object)
-    (inst lea eax (make-fixup (extern-alien-name "debug_print") :foreign))
-    (inst call (make-fixup (extern-alien-name "call_into_c") :foreign))
-    (inst add esp-tn n-word-bytes)
+    ;; the stack should be 16-byte aligned on Darwin
+    #!-darwin (inst push object)
+    #!+darwin (progn (inst mov prev-stack-pointer esp-tn)
+                     (inst sub esp-tn n-word-bytes)
+                     (inst and esp-tn -16)
+                     (storew object esp-tn))
+    (inst lea eax (make-fixup "debug_print" :foreign))
+    (inst call (make-fixup "call_into_c" :foreign))
+    #!-darwin (inst add esp-tn n-word-bytes)
+    #!+darwin (inst mov esp-tn prev-stack-pointer)
     (move result eax)))