[git] CMU Common Lisp branch master updated. begin-x87-removal-6-g260d94f
Raymond Toy
rtoy at common-lisp.net
Fri Apr 11 03:03:35 UTC 2014
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 260d94f1a9057fb9ae592a0b7b898f881316f289 (commit)
from 1dbe0c4b5e5e05cc6a9377bc3c6505a9a3e60efc (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 260d94f1a9057fb9ae592a0b7b898f881316f289
Author: Raymond Toy <toy.raymond at gmail.com>
Date: Thu Apr 10 20:03:20 2014 -0700
Simplify call_into_c more, putting more of the functionality into
call-out.
* lisp/x86-assem.S
* Rip out all of cruft dealing with float return values and the
need for maintaining the FPU state. Just call the foreign
function and return, letting call-out deal with the result.
* compiler/x86/sse2-c-call.lisp
* Handle the different return values depending on whether we
declared the function to return a float or not.
diff --git a/src/compiler/x86/sse2-c-call.lisp b/src/compiler/x86/sse2-c-call.lisp
index edd226b..83f21b5 100644
--- a/src/compiler/x86/sse2-c-call.lisp
+++ b/src/compiler/x86/sse2-c-call.lisp
@@ -44,35 +44,26 @@
(:generator 0
(cond ((policy node (> space speed))
(move eax function)
- (inst call (make-fixup (extern-alien-name "call_into_c") :foreign))
- (when (and results (location= (tn-ref-tn results) xmm0-tn))
- ;; If there is a float result from the foreign call,
- ;; call_into_c has arranged for the result to be in XMM0,
- ;; as a double. If we wanted a single float, do the
- ;; conversion here.
- (sc-case (tn-ref-tn results)
- (single-reg
- (inst cvtsd2ss xmm0-tn xmm0-tn))
- (double-reg
- ;; Nothing needed for double because call_into_c saved
- ;; the result as a double.
- ))))
+ (inst call (make-fixup (extern-alien-name "call_into_c") :foreign)))
(t
(inst call function)
;; To give the debugger a clue. XX not really internal-error?
- (note-this-location vop :internal-error)
-
- (when (and results
- (location= (tn-ref-tn results) xmm0-tn))
- ;; If there's a float result, it would have been returned
- ;; in fr0 according to the ABI. We want it in xmm0.
- (sc-case (tn-ref-tn results)
- (single-reg
- (inst fstp (ea-for-sf-stack temp-single))
- (inst movss xmm0-tn (ea-for-sf-stack temp-single)))
- (double-reg
- (inst fstpd (ea-for-df-stack temp-double))
- (inst movsd xmm0-tn (ea-for-df-stack temp-double)))))))))
+ (note-this-location vop :internal-error)))
+ ;; FIXME: check that a float result is returned when expected. If
+ ;; we don't, we'll either get a NaN when doing the fstp or we'll
+ ;; leave an entry on the FPU and we'll eventually overflow the FPU
+ ;; stack.
+ (when (and results
+ (location= (tn-ref-tn results) xmm0-tn))
+ ;; If there's a float result, it would have been returned
+ ;; in ST(0) according to the ABI. We want it in xmm0.
+ (sc-case (tn-ref-tn results)
+ (single-reg
+ (inst fstp (ea-for-sf-stack temp-single))
+ (inst movss xmm0-tn (ea-for-sf-stack temp-single)))
+ (double-reg
+ (inst fstpd (ea-for-df-stack temp-double))
+ (inst movsd xmm0-tn (ea-for-df-stack temp-double)))))))
(define-vop (alloc-number-stack-space)
(:info amount)
diff --git a/src/lisp/x86-assem.S b/src/lisp/x86-assem.S
index b01fa5f..f9dee43 100644
--- a/src/lisp/x86-assem.S
+++ b/src/lisp/x86-assem.S
@@ -100,42 +100,10 @@ FUNCDEF(call_into_c)
call *%eax # normal callout using Lisp stack
- movl %eax,%ecx # remember integer return value
-
-/* Check for a return FP value */
- fxam
- fnstsw %ax
- andl $0x4500,%eax
- cmpl $0x4100,%eax
- jne Lfp_rtn_value
-
-/* The return value is in eax, or eax,edx? */
-no_fldz:
-/* Restore the return value */
- movl %ecx,%eax # maybe return value
-
movl $0,GNAME(foreign_function_call_active)
/* Return */
jmp *%ebx
-Lfp_rtn_value:
-
-/*
- * The float result is in st(0). We want it in xmm0. For
- * consistency, save st(0) out as a double and load it into xmm0 as a
- * double. The call-out vop will arrange to convert it to a single-float
- * if necessary.
- */
- subl $8, %esp # Space for a double float
- fstpl 0(%esp)
- movsd 0(%esp), %xmm0
- addl $8, %esp
-
-/* Don't need to restore eax as the result is in st(0) */
-
- movl $0,GNAME(foreign_function_call_active)
-/* Return */
- jmp *%ebx
ENDFUNC(call_into_c)
-----------------------------------------------------------------------
Summary of changes:
src/compiler/x86/sse2-c-call.lisp | 43 +++++++++++++++----------------------
src/lisp/x86-assem.S | 32 ---------------------------
2 files changed, 17 insertions(+), 58 deletions(-)
hooks/post-receive
--
CMU Common Lisp
More information about the cmucl-cvs
mailing list