X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcompiler%2Fx86%2Fc-call.lisp;h=27ebe1e5cd0c6c31f41ffe0b5420c4d49f629240;hb=e829d0de78c10d779de6bc5ace2ab3354e6236ec;hp=e44100311e6193b81a8edb2187770519d4767d8d;hpb=8bb7e14a921675eacec2dad00ed3060289cf6538;p=sbcl.git diff --git a/src/compiler/x86/c-call.lisp b/src/compiler/x86/c-call.lisp index e441003..27ebe1e 100644 --- a/src/compiler/x86/c-call.lisp +++ b/src/compiler/x86/c-call.lisp @@ -214,11 +214,15 @@ :from :eval :to :result) ecx) (:temporary (:sc unsigned-reg :offset edx-offset :from :eval :to :result) edx) + (:temporary (:sc unsigned-reg :offset esi-offset) prev-esp) (:node-var node) (:vop-var vop) (:save-p t) (:ignore args ecx edx) (:generator 0 + ;; FIXME & OAOOM: This is brittle and error-prone to maintain two + ;; instances of the same logic, on in arch-assem.S, and one in + ;; c-call.lisp. If you modify this, modify that one too... (cond ((policy node (> space speed)) (move eax function) (inst call (make-fixup "call_into_c" :foreign))) @@ -228,12 +232,23 @@ (dotimes (i 8) (inst fstp fr0-tn)) - #!+win32 (inst cld) + #!+win32 + (inst cld) + + #!+darwin + ;; Align stack for C. + (progn + (move prev-esp esp-tn) + (inst and esp-tn -16)) (inst call function) ;; To give the debugger a clue. XX not really internal-error? (note-this-location vop :internal-error) + #!+darwin + ;; Restore + (move esp-tn prev-esp) + ;; Restore the NPX for lisp; ensure no regs are empty (dotimes (i 7) (inst fldz))