From 1a4f75204cb4640d5744ab0a1d31248ca71b66c4 Mon Sep 17 00:00:00 2001 From: dtc <dtc> Date: Fri, 5 Dec 1997 06:55:32 +0000 Subject: [PATCH] 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. --- assembly/x86/arith.lisp | 62 ++++++++++++++----------------------- compiler/x86/static-fn.lisp | 26 +++++++--------- 2 files changed, 36 insertions(+), 52 deletions(-) diff --git a/assembly/x86/arith.lisp b/assembly/x86/arith.lisp index a36189f22..e7f29bf48 100644 --- a/assembly/x86/arith.lisp +++ b/assembly/x86/arith.lisp @@ -7,7 +7,7 @@ ;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; (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 @@ (:temp eax dword-reg eax-offset) (:temp ebx dword-reg ebx-offset) (:temp ecx dword-reg ecx-offset)) - ;; for now, pass this off - ;; (inst jmp DO-STATIC-FUN) - ;; ebx ; ignorable + (declare (ignorable ebx)) + (inst test x 3) ; fixnum? (inst jmp :nz DO-STATIC-FUN) ; no - do generic (inst test y 3) ; fixnum? @@ -55,13 +54,9 @@ (inst sub esp-tn (fixnum 2)) (inst push eax) ; callers return addr (inst mov ecx (fixnum 2)) ; arg count - - (inst mov ebx - (make-ea :dword - :disp (+ nil-value (static-function-offset - ',(symbolicate "TWO-ARG-" fun))))) - - (inst jmp ebx) + (inst jmp (make-ea :dword + :disp (+ nil-value (static-function-offset + ',(symbolicate "TWO-ARG-" fun))))) DO-BODY ,@body)) @@ -154,11 +149,8 @@ (inst sub esp-tn (fixnum 2)) (inst push eax) (inst mov ecx (fixnum 1)) ; arg count - - (inst mov eax - (make-ea :dword - :disp (+ nil-value (static-function-offset '%negate)))) - (inst jmp eax) + (inst jmp (make-ea :dword + :disp (+ nil-value (static-function-offset '%negate)))) FIXNUM (move res x) @@ -204,22 +196,20 @@ (inst sub esp-tn (fixnum 2)) (inst push eax) (inst mov ecx (fixnum 2)) - - (inst mov eax (make-ea :dword - :disp (+ nil-value - (static-function-offset ',static-fn)))) + (inst jmp (make-ea :dword + :disp (+ nil-value + (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) - 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) - - TRUE - (load-symbol res t))) + TRUE + (load-symbol res t))) ); eval-when @@ -259,10 +249,8 @@ (inst sub esp-tn (fixnum 2)) (inst push eax) (inst mov ecx (fixnum 2)) - - (inst mov eax (make-ea :dword - :disp (+ nil-value (static-function-offset 'eql)))) - (inst jmp eax) + (inst jmp (make-ea :dword + :disp (+ nil-value (static-function-offset 'eql)))) RETURN-T (load-symbol res t)) @@ -300,10 +288,8 @@ (inst sub esp-tn (fixnum 2)) (inst push eax) (inst mov ecx (fixnum 2)) - - (inst mov eax (make-ea :dword - :disp (+ nil-value (static-function-offset 'two-arg-=)))) - (inst jmp eax) + (inst jmp (make-ea :dword + :disp (+ nil-value (static-function-offset 'two-arg-=)))) RETURN-T (load-symbol res t)) diff --git a/compiler/x86/static-fn.lisp b/compiler/x86/static-fn.lisp index c5340fa47..618887650 100644 --- a/compiler/x86/static-fn.lisp +++ b/compiler/x86/static-fn.lisp @@ -7,7 +7,7 @@ ;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; (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 @@ (:variant-vars function) (:vop-var vop) (: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)) ebx) (:temporary (:sc dword-reg :offset ecx-offset :from (:eval 0) :to (:eval 2)) @@ -107,27 +105,27 @@ ;; original ESP, so we fix it up afterwards. (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) '(inst xor ecx ecx) `(inst mov ecx (fixnum ,num-args))) (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 - (inst call eax) + (inst call (make-ea :dword + :disp (+ nil-value + (static-function-offset function)))) #+x86-lra (progn ;; Push the return address. (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) (inst lra-header-word) (inst nop) -- GitLab