X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fassembly%2Fx86%2Fsupport.lisp;h=7985f7c4debb8c36bb299b35602b654cd52b375e;hb=f6b2e375747a54a1bfa34ead9f9af2d4e8b5aa38;hp=4bb9167f8cedc6fbc0a15891d799c1741f9c41a0;hpb=78689792e8f8d20b3b931f508f3a9eca81b64f1f;p=sbcl.git diff --git a/src/assembly/x86/support.lisp b/src/assembly/x86/support.lisp index 4bb9167..7985f7c 100644 --- a/src/assembly/x86/support.lisp +++ b/src/assembly/x86/support.lisp @@ -9,7 +9,21 @@ (in-package "SB!VM") -(!def-vm-support-routine generate-call-sequence (name style vop) +;;; The :full-call assembly-routines must use the same full-call +;;; unknown-values return convention as a normal call, as some +;;; of the routines will tail-chain to a static-function. The +;;; routines themselves, however, take all of their arguments +;;; in registers (this will typically be one or two arguments, +;;; and is one of the lower bounds on the number of argument- +;;; passing registers), and thus don't need a call frame, which +;;; simplifies things for the normal call/return case. When it +;;; is neccessary for one of the assembly-functions to call a +;;; static-function it will construct the required call frame. +;;; Also, none of the assembly-routines return other than one +;;; value, which again simplifies the return path. +;;; -- AB, 2006/Feb/05. + +(defun generate-call-sequence (name style vop) (ecase style ((:raw :none) (values @@ -18,19 +32,23 @@ (:full-call (values `((note-this-location ,vop :call-site) - (inst call (make-fixup ',name :assembly-routine)) - (note-this-location ,vop :single-value-return) - (move esp-tn ebx-tn)) + (inst call (make-fixup ',name :assembly-routine)) + (note-this-location ,vop :single-value-return) + (cond + ((member :cmov *backend-subfeatures*) + (inst cmov :c esp-tn ebx-tn)) + (t + (let ((single-value (gen-label))) + (inst jmp :nc single-value) + (move esp-tn ebx-tn) + (emit-label single-value))))) '((:save-p :compute-only)))))) -(!def-vm-support-routine generate-return-sequence (style) +(defun generate-return-sequence (style) (ecase style (:raw `(inst ret)) (:full-call - `( - (inst pop eax-tn) - - (inst add eax-tn 2) - (inst jmp eax-tn))) + `((inst clc) + (inst ret))) (:none)))