From e829d0de78c10d779de6bc5ace2ab3354e6236ec Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Wed, 11 Apr 2007 17:05:14 +0000 Subject: [PATCH] 1.0.4.64: more stack-alignment x86/Darwin * Things work better if we restore the old stack pointer in the inline version... * Make sure foreign tests test both fast and small code-paths. Note: our allocation routines also call out to C, ending up in alloc(), so they may need looking at too. Note: out-of-line call_into_c does call + jmp, getting it to to call + ret should not be too hard, should it? --- src/compiler/x86/c-call.lisp | 9 +++- tests/foreign.test.sh | 107 +++++++++++++++++++++++++----------------- version.lisp-expr | 2 +- 3 files changed, 74 insertions(+), 44 deletions(-) diff --git a/src/compiler/x86/c-call.lisp b/src/compiler/x86/c-call.lisp index df61c5c..27ebe1e 100644 --- a/src/compiler/x86/c-call.lisp +++ b/src/compiler/x86/c-call.lisp @@ -214,6 +214,7 @@ :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) @@ -236,12 +237,18 @@ #!+darwin ;; Align stack for C. - (inst and esp-tn #xfffffff0) + (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)) diff --git a/tests/foreign.test.sh b/tests/foreign.test.sh index 045d36b..59e28cd 100644 --- a/tests/foreign.test.sh +++ b/tests/foreign.test.sh @@ -111,7 +111,7 @@ build_so $testfilestem-c ## Foreign definitions & load -cat > $testfilestem.def.lisp < $testfilestem.base.lisp < $testfilestem.def.lisp < $testfilestem.def.lisp < $testfilestem.fast.lisp +cat $testfilestem.base.lisp >> $testfilestem.fast.lisp + +echo "(declaim (optimize space))" > $testfilestem.small.lisp +cat $testfilestem.base.lisp >> $testfilestem.small.lisp + # Test code cat > $testfilestem.test.lisp < $testfilestem.test.lisp <