projects
/
sbcl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
1.0.4.64: more stack-alignment x86/Darwin
[sbcl.git]
/
src
/
compiler
/
x86
/
c-call.lisp
diff --git
a/src/compiler/x86/c-call.lisp
b/src/compiler/x86/c-call.lisp
index
38a8fe2
..
27ebe1e
100644
(file)
--- 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)
: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
(: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)))
(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))
(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)
(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))
;; Restore the NPX for lisp; ensure no regs are empty
(dotimes (i 7)
(inst fldz))
@@
-279,6
+294,8
@@
(unless (zerop amount)
(let ((delta (logandc2 (+ amount 3) 3)))
(inst sub esp-tn delta)))
(unless (zerop amount)
(let ((delta (logandc2 (+ amount 3) 3)))
(inst sub esp-tn delta)))
+ ;; C stack should probably be 16 byte aligned on Darwin
+ #!+darwin (inst and esp-tn -16)
(move result esp-tn)))
(define-vop (dealloc-number-stack-space)
(move result esp-tn)))
(define-vop (dealloc-number-stack-space)
@@
-304,7
+321,7
@@
(ash symbol-tls-index-slot word-shift)
(- other-pointer-lowtag))))
(inst fs-segment-prefix)
(ash symbol-tls-index-slot word-shift)
(- other-pointer-lowtag))))
(inst fs-segment-prefix)
- (inst sub (make-ea :dword :scale 1 :index temp) delta)))
+ (inst sub (make-ea :dword :base temp) delta)))
(load-tl-symbol-value result *alien-stack*))
#!-sb-thread
(:generator 0
(load-tl-symbol-value result *alien-stack*))
#!-sb-thread
(:generator 0
@@
-328,12
+345,12
@@
(let ((delta (logandc2 (+ amount 3) 3)))
(inst mov temp
(make-ea :dword
(let ((delta (logandc2 (+ amount 3) 3)))
(inst mov temp
(make-ea :dword
- :disp (+ nil-value
- (static-symbol-offset '*alien-stack*)
+ :disp (+ nil-value
+ (static-symbol-offset '*alien-stack*)
(ash symbol-tls-index-slot word-shift)
(- other-pointer-lowtag))))
(inst fs-segment-prefix)
(ash symbol-tls-index-slot word-shift)
(- other-pointer-lowtag))))
(inst fs-segment-prefix)
- (inst add (make-ea :dword :scale 1 :index temp) delta))))
+ (inst add (make-ea :dword :base temp) delta))))
#!-sb-thread
(:generator 0
(unless (zerop amount)
#!-sb-thread
(:generator 0
(unless (zerop amount)