Skip to content
Snippets Groups Projects
Commit b7594e60 authored by dtc's avatar dtc
Browse files

Cleanup the static function call VOP; smaller faster instruction

sequence.
parent 6f0ef1ed
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/x86/static-fn.lisp,v 1.1 1997/01/18 14:31:22 ram Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/x86/static-fn.lisp,v 1.2 1997/12/03 15:34:10 dtc Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
;;; Written by William Lott. ;;; Written by William Lott.
;;; ;;;
;;; Debugged by Paul F. Werkowski Spring/Summer 1995. ;;; Debugged by Paul F. Werkowski Spring/Summer 1995.
;;; Enhancements/debugging by Douglas T. Crosher 1996,1997.
;;; ;;;
(in-package :x86) (in-package :x86)
...@@ -27,11 +28,10 @@ ...@@ -27,11 +28,10 @@
(:variant-vars function) (:variant-vars function)
(:vop-var vop) (:vop-var vop)
(:node-var node) (:node-var node)
#+nil (:temporary (:sc dword-reg :offset eax-offset :from (:eval 0) :to (:eval 2))
(:temporary (:sc dword-reg :offset eax-offset) eax) ; used for call eax)
(:temporary (:sc dword-reg :offset ebx-offset :from (:eval 1) :to (:eval 2)) (:temporary (:sc dword-reg :offset ebx-offset :from (:eval 0) :to (:eval 2))
ebx) ebx)
(:ignore #+nil eax ebx)
(:temporary (:sc dword-reg :offset ecx-offset :from (:eval 0) :to (:eval 2)) (:temporary (:sc dword-reg :offset ecx-offset :from (:eval 0) :to (:eval 2))
ecx)) ecx))
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
(dotimes (i num-temps) (dotimes (i num-temps)
(let ((temp-name (intern (format nil "TEMP-~D" i)))) (let ((temp-name (intern (format nil "TEMP-~D" i))))
(temp-names temp-name) (temp-names temp-name)
(temps `(:temporary (:sc dword-reg (temps `(:temporary (:sc descriptor-reg
:offset ,(nth i register-arg-offsets) :offset ,(nth i register-arg-offsets)
:from ,(if (< i num-args) :from ,(if (< i num-args)
`(:argument ,i) `(:argument ,i)
...@@ -88,43 +88,46 @@ ...@@ -88,43 +88,46 @@
(:results ,@(results)) (:results ,@(results))
(:generator ,(+ 50 num-args num-results) (:generator ,(+ 50 num-args num-results)
,@(moves (temp-names) (arg-names)) ,@(moves (temp-names) (arg-names))
;; If speed is more important than size, duplicate the effect of
;; the ENTER with discrete instructions. Takes 9 bytes/6 cycles ;; If speed not more important than size, duplicate the
;; as opposed to 4 bytes/10 cycles. ;; effect of the ENTER with discrete instructions. Takes
(cond ((policy node (> speed space)) ;; 2+1+3+2=8 bytes as opposed to 4+3=7 bytes.
(cond ((policy node (>= speed space))
(inst mov ebx esp-tn)
;; Save the old-fp
(inst push ebp-tn) (inst push ebp-tn)
(inst mov ebp-tn esp-tn) ;; Ensure that at least three slots are available; one
(inst sub esp-tn (fixnum 3))) ; pw -- was 2 ;; above, two more needed.
(inst sub esp-tn (fixnum 2))
(inst mov ebp-tn ebx))
(t (t
(inst enter (fixnum 3)))) ; pw -- was 2 (inst enter (fixnum 2))
;; The enter instruction pushes EBP and then copies ESP into ;; The enter instruction pushes EBP and then copies
;; EBP. We want the new EBP to be the original ESP, so we fix it ;; ESP into EBP. We want the new EBP to be the
;; up afterwards. ;; original ESP, so we fix it up afterwards.
(inst add ebp-tn (fixnum 1)) (inst add ebp-tn (fixnum 1))))
(inst mov ecx (fixnum ,num-args))
;; Static-function-offset gives the offset from the start of
;; jrd fixed it up this way, to deal with the fact that the thing in ;; the nil object to the static function fdefn and has the
;; static-symbols is the fdefn ;; low tag of 1 added. When the nil symbol value with its
;; pfw says this is no longer true ;; low tag of 3 is added the resulting value points to the
(inst mov eax-tn ;; entry point of the fdefn (at +4).
(make-ea :dword (inst mov eax (make-ea :dword
:disp (+ nil-value (static-function-offset function)))) :disp (+ nil-value
(static-function-offset function))))
;; Save the return address.
#+x86-lra ,(if (zerop num-args)
(storew (make-fixup nil :code-object return) '(inst xor ecx ecx)
ebp-tn (- (1+ return-pc-save-offset))) `(inst mov ecx (fixnum ,num-args)))
;; Push the return address for backward compatability.
#+x86-lra
(inst push (make-ea :dword :base ebp-tn :disp -8))
(note-this-location vop :call-site) (note-this-location vop :call-site)
#-x86-lra #-x86-lra
(inst call eax-tn) (inst call eax)
#+x86-lra #+x86-lra
(progn (progn
(inst jmp eax-tn) ;; Push the return address.
(inst push (make-fixup nil :code-object return))
(inst jmp eax)
(align lowtag-bits #x90) (align lowtag-bits #x90)
(inst lra-header-word) (inst lra-header-word)
(inst nop) (inst nop)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment