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

For the static function calls, don't bother loading a register with

the raw address before calling, saving two bytes. This was probably
done in case the static function is a closure, but to work this would
need to load EAX with the fdefn pointer and jump to the fdefn raw slot
- none of the static functions are closures anyway.
parent 5edcfc7e
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/assembly/x86/arith.lisp,v 1.7 1997/12/03 15:40:59 dtc Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/x86/arith.lisp,v 1.8 1997/12/05 06:55:30 dtc Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -40,9 +40,8 @@ ...@@ -40,9 +40,8 @@
(:temp eax dword-reg eax-offset) (:temp eax dword-reg eax-offset)
(:temp ebx dword-reg ebx-offset) (:temp ebx dword-reg ebx-offset)
(:temp ecx dword-reg ecx-offset)) (:temp ecx dword-reg ecx-offset))
;; for now, pass this off (declare (ignorable ebx))
;; (inst jmp DO-STATIC-FUN)
;; ebx ; ignorable
(inst test x 3) ; fixnum? (inst test x 3) ; fixnum?
(inst jmp :nz DO-STATIC-FUN) ; no - do generic (inst jmp :nz DO-STATIC-FUN) ; no - do generic
(inst test y 3) ; fixnum? (inst test y 3) ; fixnum?
...@@ -55,13 +54,9 @@ ...@@ -55,13 +54,9 @@
(inst sub esp-tn (fixnum 2)) (inst sub esp-tn (fixnum 2))
(inst push eax) ; callers return addr (inst push eax) ; callers return addr
(inst mov ecx (fixnum 2)) ; arg count (inst mov ecx (fixnum 2)) ; arg count
(inst jmp (make-ea :dword
(inst mov ebx :disp (+ nil-value (static-function-offset
(make-ea :dword ',(symbolicate "TWO-ARG-" fun)))))
:disp (+ nil-value (static-function-offset
',(symbolicate "TWO-ARG-" fun)))))
(inst jmp ebx)
DO-BODY DO-BODY
,@body)) ,@body))
...@@ -154,11 +149,8 @@ ...@@ -154,11 +149,8 @@
(inst sub esp-tn (fixnum 2)) (inst sub esp-tn (fixnum 2))
(inst push eax) (inst push eax)
(inst mov ecx (fixnum 1)) ; arg count (inst mov ecx (fixnum 1)) ; arg count
(inst jmp (make-ea :dword
(inst mov eax :disp (+ nil-value (static-function-offset '%negate))))
(make-ea :dword
:disp (+ nil-value (static-function-offset '%negate))))
(inst jmp eax)
FIXNUM FIXNUM
(move res x) (move res x)
...@@ -204,22 +196,20 @@ ...@@ -204,22 +196,20 @@
(inst sub esp-tn (fixnum 2)) (inst sub esp-tn (fixnum 2))
(inst push eax) (inst push eax)
(inst mov ecx (fixnum 2)) (inst mov ecx (fixnum 2))
(inst jmp (make-ea :dword
(inst mov eax (make-ea :dword :disp (+ nil-value
:disp (+ nil-value (static-function-offset ',static-fn))))
(static-function-offset ',static-fn))))
DO-COMPARE
(inst cmp x y)
(inst jmp ,test TRUE)
(inst mov res nil-value)
(inst pop eax)
(inst add eax 2)
(inst jmp eax) (inst jmp eax)
DO-COMPARE TRUE
(inst cmp x y) (load-symbol res t)))
(inst jmp ,test TRUE)
(inst mov res nil-value)
(inst pop eax)
(inst add eax 2)
(inst jmp eax)
TRUE
(load-symbol res t)))
); eval-when ); eval-when
...@@ -259,10 +249,8 @@ ...@@ -259,10 +249,8 @@
(inst sub esp-tn (fixnum 2)) (inst sub esp-tn (fixnum 2))
(inst push eax) (inst push eax)
(inst mov ecx (fixnum 2)) (inst mov ecx (fixnum 2))
(inst jmp (make-ea :dword
(inst mov eax (make-ea :dword :disp (+ nil-value (static-function-offset 'eql))))
:disp (+ nil-value (static-function-offset 'eql))))
(inst jmp eax)
RETURN-T RETURN-T
(load-symbol res t)) (load-symbol res t))
...@@ -300,10 +288,8 @@ ...@@ -300,10 +288,8 @@
(inst sub esp-tn (fixnum 2)) (inst sub esp-tn (fixnum 2))
(inst push eax) (inst push eax)
(inst mov ecx (fixnum 2)) (inst mov ecx (fixnum 2))
(inst jmp (make-ea :dword
(inst mov eax (make-ea :dword :disp (+ nil-value (static-function-offset 'two-arg-=))))
:disp (+ nil-value (static-function-offset 'two-arg-=))))
(inst jmp eax)
RETURN-T RETURN-T
(load-symbol res t)) (load-symbol res t))
......
...@@ -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.2 1997/12/03 15:34:10 dtc Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/x86/static-fn.lisp,v 1.3 1997/12/05 06:55:32 dtc Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
(:variant-vars function) (:variant-vars function)
(:vop-var vop) (:vop-var vop)
(:node-var node) (:node-var node)
(:temporary (:sc dword-reg :offset eax-offset :from (:eval 0) :to (:eval 2))
eax)
(:temporary (:sc dword-reg :offset ebx-offset :from (:eval 0) :to (:eval 2)) (:temporary (:sc dword-reg :offset ebx-offset :from (:eval 0) :to (:eval 2))
ebx) 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))
...@@ -107,27 +105,27 @@ ...@@ -107,27 +105,27 @@
;; original ESP, so we fix it up afterwards. ;; original ESP, so we fix it up afterwards.
(inst add ebp-tn (fixnum 1)))) (inst add ebp-tn (fixnum 1))))
;; Static-function-offset gives the offset from the start of
;; the nil object to the static function fdefn and has the
;; low tag of 1 added. When the nil symbol value with its
;; low tag of 3 is added the resulting value points to the
;; entry point of the fdefn (at +4).
(inst mov eax (make-ea :dword
:disp (+ nil-value
(static-function-offset function))))
,(if (zerop num-args) ,(if (zerop num-args)
'(inst xor ecx ecx) '(inst xor ecx ecx)
`(inst mov ecx (fixnum ,num-args))) `(inst mov ecx (fixnum ,num-args)))
(note-this-location vop :call-site) (note-this-location vop :call-site)
;; Static-function-offset gives the offset from the start of
;; the nil object to the static function fdefn and has the
;; low tag of 1 added. When the nil symbol value with its
;; low tag of 3 is added the resulting value points to the
;; raw address slot of the fdefn (at +4).
#-x86-lra #-x86-lra
(inst call eax) (inst call (make-ea :dword
:disp (+ nil-value
(static-function-offset function))))
#+x86-lra #+x86-lra
(progn (progn
;; Push the return address. ;; Push the return address.
(inst push (make-fixup nil :code-object return)) (inst push (make-fixup nil :code-object return))
(inst jmp eax) (inst jmp (make-ea :dword
:disp (+ nil-value
(static-function-offset function))))
(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