Changeset 6464


Ignore:
Timestamp:
May 9, 2007, 7:31:26 AM (15 years ago)
Author:
gb
Message:

Use "tail-aligned" calls for most things, except calls to subprims
that manipulate the stack.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/compiler/X86/X8664/x8664-vinsns.lisp

    r5970 r6464  
    274274  (movsd (:%xmm val) (:@ (:apply + x8664::misc-data-offset (:apply ash idx 3)) (:%q v))))
    275275
     276
     277
    276278(define-x8664-vinsn (call-known-symbol :call) (((result (:lisp x8664::arg_z)))
    277                                                ())
    278   (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
    279   (movq (:@ x8664::symbol.fcell (:% x8664::fname)) (:%q x8664::fn))
    280   (jmp (:%q x8664::fn))
    281   (:align 3)
    282   (:long (:^ :back))
    283   :back
    284   (leaq (:@ (:apply - (:^ :back)) (:% x8664::ra0)) (:%q x8664::fn)))
    285 
    286 ;;; It's neccessary to use x8664:xfn to reference the current function
    287 ;;; when neither x8664::fn nor x8664::ra0 are doing so.
     279                                               ()
     280                                               ((entry (:label 1))))
     281  (:talign 4)
     282  (call (:@ x8664::symbol.fcell (:% x8664::fname)))
     283  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn)))
     284
     285
    288286(define-x8664-vinsn (jump-known-symbol :jumplr) (()
    289287                                                 ())
    290   (movq (:%q x8664::fn) (:%q x8664::xfn))
    291   (movq (:@ x8664::symbol.fcell (:% x8664::fname)) (:%q x8664::fn))
    292   (jmp (:%q x8664::fn)))
     288
     289  (jmp (:@ x8664::symbol.fcell (:% x8664::fname))))
    293290
    294291(define-x8664-vinsn set-nargs (()
     
    416413(define-x8664-vinsn save-lisp-context-no-stack-args (()
    417414                                                     ())
    418   (pushq (:%q x8664::ra0))
    419415  (pushq (:%q x8664::rbp))
    420416  (movq (:%q x8664::rsp) (:%q x8664::rbp)))
     
    422418
    423419(define-x8664-vinsn save-lisp-context-offset (()
    424                                               ((nbytes-pushed :s32const))
    425                                               ((temp :u64)))
    426   (movq (:%q x8664::rbp) (:@ nbytes-pushed (:%q x8664::rsp)))
    427   (leaq (:@ nbytes-pushed (:%q x8664::rsp)) (:%q x8664::rbp))
    428   (movq (:% x8664::ra0) (:@ 8 (:%q x8664::rbp))))
     420                                              ((nbytes-pushed :s32const)))
     421  (movq (:%q x8664::rbp) (:@ (:apply + nbytes-pushed x8664::node-size) (:%q x8664::rsp)))
     422  (leaq (:@ (:apply + nbytes-pushed x8664::node-size) (:%q x8664::rsp)) (:%q x8664::rbp))
     423  (popq  (:@ x8664::node-size (:%q x8664::rbp))))
    429424
    430425(define-x8664-vinsn save-lisp-context-variable-arg-count (()
     
    434429  (subq (:$b (* $numx8664argregs x8664::node-size)) (:%q temp))
    435430  (jle :push)
    436   (movq (:%q x8664::rbp) (:@ (:%q x8664::rsp) (:%q temp)))
    437   (leaq (:@ (:%q x8664::rsp) (:%q temp)) (:%q x8664::rbp))
    438   (movq (:% x8664::ra0) (:@ 8 (:%q x8664::rbp)))
     431  (movq (:%q x8664::rbp) (:@ x8664::node-size (:%q x8664::rsp) (:%q temp)))
     432  (leaq (:@ x8664::node-size (:%q x8664::rsp) (:%q temp)) (:%q x8664::rbp))
     433  (popq (:@ 8 (:%q x8664::rbp)))
    439434  (jmp :done)
    440435  :push
    441   (pushq (:%q x8664::ra0))
    442436  (pushq (:%q x8664::rbp))
    443437  (movq (:%q x8664::rsp) (:%q x8664::rbp))
     
    451445  (movzwl (:%w x8664::nargs) (:%l temp))
    452446  (subq (:$b (* $numx8664argregs x8664::node-size)) (:%q temp))
    453   (movq (:%q x8664::rbp) (:@ (:%q x8664::rsp) (:%q temp)))
    454   (leaq (:@ (:%q x8664::rsp) (:%q temp)) (:%q x8664::rbp))
    455   (movq (:% x8664::ra0) (:@ 8 (:%q x8664::rbp))))
     447  (movq (:%q x8664::rbp) (:@ x8664::node-size (:%q x8664::rsp) (:%q temp)))
     448  (leaq (:@ x8664::node-size (:%q x8664::rsp) (:%q temp)) (:%q x8664::rbp))
     449  (popq  (:@ x8664::node-size (:%q x8664::rbp))))
    456450
    457451
     
    513507     ())
    514508  (leave)
    515   (popq (:%q x8664::ra0))
    516   (jmp (:%q x8664::ra0)))
    517 
    518 (define-x8664-vinsn (restore-full-lisp-context :lispcontext :pop :vsp :lrRestore)
     509  (ret))
     510
     511(define-x8664-vinsn (restore-full-lisp-context :lispcontext :pop :vsp )
    519512    (()
    520513     ())
    521   (leave)
    522   (popq (:%q x8664::ra0)))
     514  (leave))
    523515
    524516(define-x8664-vinsn compare-to-nil (()
     
    869861  (shrq (:$ub x8664::fixnumshift) (:%q dest)))
    870862
     863(define-x8664-vinsn %unbox-u16 (((dest :u16))
     864                              ((src :lisp)))
     865  (movq (:%q src) (:%q dest))
     866  (shrq (:$ub x8664::fixnumshift) (:%q dest)))
     867
    871868(define-x8664-vinsn unbox-s16 (((dest :s16))
    872869                              ((src :lisp)))
     
    883880  (sarq (:$ub x8664::fixnumshift) (:%q dest)))
    884881
     882(define-x8664-vinsn %unbox-s16 (((dest :s16))
     883                                ((src :lisp)))
     884  (movq (:%q src) (:%q dest))
     885  (sarq (:$ub x8664::fixnumshift) (:%q dest)))
     886
    885887(define-x8664-vinsn unbox-u32 (((dest :u32))
    886888                              ((src :lisp)))
     
    890892  (uuo-error-reg-not-type (:%q src) (:$ub arch::error-object-not-unsigned-byte-32))
    891893  :ok
     894  (movq (:%q src) (:%q dest))
     895  (shrq (:$ub x8664::fixnumshift) (:%q dest)))
     896
     897(define-x8664-vinsn %unbox-u32 (((dest :u32))
     898                              ((src :lisp)))
     899
    892900  (movq (:%q src) (:%q dest))
    893901  (shrq (:$ub x8664::fixnumshift) (:%q dest)))
     
    906914  :got-it
    907915  (sarq (:$ub x8664::fixnumshift) (:%q dest)))
     916
     917(define-x8664-vinsn %unbox-s32 (((dest :s32))
     918                               ((src :lisp)))
     919  (movq (:%q src) (:%q dest))
     920  (sarq (:$ub x8664::fixnumshift) (:%q dest)))
     921
    908922
    909923(define-x8664-vinsn unbox-u64 (((dest :u64))
     
    9881002  (jmp (:@ spno)))
    9891003
     1004;;; "call" a subprimitive that manipulates the stack in some way,
     1005;;; using an lea/jmp calling convention.
     1006(define-x8664-vinsn (lea-jmp-subprim :call)  (()
     1007                                              ((spno :s32const))
     1008                                              ((entry (:label 1))))
     1009  (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
     1010  (:talign 4)
     1011  (jmp (:@ spno))
     1012  :back
     1013  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn)))
     1014
     1015;;; Call a subprimitive using a tail-aligned CALL instruction.
    9901016(define-x8664-vinsn (call-subprim :call)  (()
    991                                   ((spno :s32const)))
    992   (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
    993   (jmp (:@ spno))
    994   (:align 3)
    995   (:long (:^ :back))
    996   :back
    997   (leaq (:@ (:apply - (:^ :back)) (:% x8664::ra0)) (:%q x8664::fn)))
     1017                                           ((spno :s32const))
     1018                                           ((entry (:label 1))))
     1019  (:talign 4)
     1020  (call (:@ spno))
     1021  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn)))
    9981022
    9991023(define-x8664-vinsn fixnum-subtract-from (((dest t)
     
    11381162     ((val :lisp))
    11391163     ((unboxed (:s64 #.x8664::imm1))
    1140       (header (:u64 #.x8664::imm0))))
     1164      (header (:u64 #.x8664::imm0))
     1165      (entry (:label 1))))
    11411166  (jno.pt :done)
    11421167  ((:not (:pred = x8664::arg_z
    11431168                (:apply %hard-regspec-value val)))
    11441169   (movq (:%q val) (:%q x8664::arg_z)))
    1145   (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
    1146   (jmp (:@ .SPfix-overflow))
    1147   (:align 3)
    1148   (:long (:^ :back))
    1149   :back
    1150   ;; We don't lose FN while consing the bignum.
     1170  (:talign 4)
     1171  (call (:@ .SPfix-overflow))
     1172  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn))
    11511173  ((:not (:pred = x8664::arg_z
    11521174                (:apply %hard-regspec-value val)))
     
    11591181      (lab :label))
    11601182     ((unboxed (:s64 #.x8664::imm1))
    1161       (header (:u64 #.x8664::imm0))))
     1183      (header (:u64 #.x8664::imm0))
     1184      (entry (:label 1))))
    11621185  (jno.pt lab)
    11631186  ((:not (:pred = x8664::arg_z
    11641187                (:apply %hard-regspec-value val)))
    11651188   (movq (:%q val) (:%q x8664::arg_z)))
    1166   (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
    1167   (jmp (:@ .SPfix-overflow))
    1168   (:align 3)
    1169   (:long (:^ :back))
    1170   :back
    1171   ;; We don't lose FN while consing the bignum.
     1189  (:talign 4)
     1190  (call (:@ .SPfix-overflow))
     1191  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn))
    11721192  ((:not (:pred = x8664::arg_z
    11731193                (:apply %hard-regspec-value val)))
     
    12891309
    12901310(define-x8664-vinsn (call-label :call) (()
    1291                                         ((label :label)))
    1292   (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
    1293   (jmp label)
    1294   (:align 3)
    1295   (:long (:^ :back))
    1296   :back
    1297   (leaq (:@ (:apply - (:^ :back)) (:% x8664::ra0)) (:%q x8664::fn)))
     1311                                        ((label :label))
     1312                                        ((entry (:label 1))))
     1313  (:talign 4)
     1314  (call label)
     1315  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn)))
    12981316
    12991317(define-x8664-vinsn double-float-compare (()
     
    15391557  (pushq (:%q x8664::ra0)))
    15401558
    1541 
     1559;; ????
    15421560(define-x8664-vinsn emit-aligned-label (()
    15431561                                        ((label :label)))
     
    15481566(define-x8664-vinsn pass-multiple-values-symbol (()
    15491567                                                 ())
    1550   (movq (:@ x8664::symbol.fcell (:% x8664::fname)) (:%q x8664::fn))
    1551   (movq (:@ (+ x8664::nil-value (x8664::%kernel-global 'x86::ret1valaddr)))
    1552         (:%q x8664::ra0))
    1553   (jmp (:%q x8664::fn)))
     1568  (pushq (:@ (+ x8664::nil-value (x8664::%kernel-global 'x86::ret1valaddr))))
     1569  (jmp (:@ x8664::symbol.fcell (:% x8664::fname))))
    15541570
    15551571;;; It'd be good to have a variant that deals with a known function
     
    15641580  (jl :bad)
    15651581  (cmoveq (:@ x8664::symbol.fcell (:%q x8664::fname)) (:%q x8664::fn))
    1566   (movq (:@ (+ x8664::nil-value (x8664::%kernel-global 'x86::ret1valaddr)))
    1567         (:%q x8664::ra0))
     1582  (pushq (:@ (+ x8664::nil-value (x8664::%kernel-global 'x86::ret1valaddr))))
    15681583  (jmp (:%q x8664::fn))
    15691584  :bad
     
    15831598
    15841599(define-x8664-vinsn (call-known-function :call) (()
    1585                                                  ())
    1586   (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
    1587   (movq (:%q x8664::temp0) (:%q x8664::fn))
    1588   (jmp (:%q x8664::fn))
    1589   (:align 3)
    1590   (:long (:^ :back))
    1591   :back
    1592   (leaq (:@ (:apply - (:^ :back)) (:% x8664::ra0)) (:%q x8664::fn)))
     1600                                                 ()
     1601                                                 ((entry (:label 1))))
     1602  (:talign 4)
     1603  (call (:%q x8664::temp0))
     1604  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn)))
    15931605
    15941606(define-x8664-vinsn (jump-known-function :jumplr) (()
    15951607                                                   ())
    1596   (Movq (:%q x8664::fn) (:%q x8664::xfn))
     1608  (movq (:%q x8664::fn) (:%q x8664::xfn))
    15971609  (movq (:%q x8664::temp0)  (:%q x8664::fn))
    15981610  (jmp (:%q x8664::fn)))
    15991611
    16001612(define-x8664-vinsn (list :call) (()
    1601                                   ())
     1613                                  ()
     1614                                  ((entry (:label 1))))
    16021615  (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
     1616  (:talign 4)
    16031617  (jmp (:@ .SPconslist))
    1604   (:align 3)
    1605   (:long (:^ :back))
    1606   :back)
     1618  :back
     1619  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn)))
    16071620
    16081621
     
    16751688
    16761689
    1677 (defmacro define-x8664-subprim-call-vinsn ((name &rest other-attrs) spno &optional (recover-fn nil))
    1678   `(define-x8664-vinsn (,name :call :subprim-call ,@other-attrs) (() ())
     1690(defmacro define-x8664-subprim-lea-jmp-vinsn ((name &rest other-attrs) spno)
     1691  `(define-x8664-vinsn (,name :call :subprim-call ,@other-attrs) (() () ((entry (:label 1))))
    16791692    (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
     1693    (:talign 4)
    16801694    (jmp (:@ ,spno))
    1681     (:align 3)
    1682     (:long (:^ :back))
    16831695    :back
    1684     ,@(if recover-fn
    1685           `((leaq (:@ (:apply - (:^ :back)) (:%q x8664::ra0)) (:%q x8664::fn))))))
     1696    (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn))))
     1697
     1698(defmacro define-x8664-subprim-call-vinsn ((name &rest other-attrs) spno)
     1699  `(define-x8664-vinsn (,name :call :subprim-call ,@other-attrs) (() () ((entry (:label 1))))
     1700    (:talign 4)
     1701    (call (:@ ,spno))
     1702    :back
     1703    (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn))))
    16861704
    16871705(defmacro define-x8664-subprim-jump-vinsn ((name &rest other-attrs) spno)
     
    17001718
    17011719
    1702 (define-x8664-subprim-call-vinsn (bind-interrupt-level-0) .SPbind-interrupt-level-0)
     1720(define-x8664-subprim-lea-jmp-vinsn (bind-interrupt-level-0) .SPbind-interrupt-level-0)
    17031721
    17041722(define-x8664-vinsn bind-interrupt-level-0-inline (()
     
    17211739 
    17221740
    1723 (define-x8664-subprim-call-vinsn (bind-interrupt-level-m1) .SPbind-interrupt-level-m1)
     1741(define-x8664-subprim-lea-jmp-vinsn (bind-interrupt-level-m1) .SPbind-interrupt-level-m1)
    17241742
    17251743(define-x8664-vinsn bind-interrupt-level-m1-inline (()
     
    17331751  (movq (:%q x8664::rsp) (:@ (:%seg :rcontext) x8664::tcr.db-link)))
    17341752
    1735 (define-x8664-subprim-call-vinsn (bind-interrupt-level) .SPbind-interrupt-level)
     1753(define-x8664-subprim-lea-jmp-vinsn (bind-interrupt-level) .SPbind-interrupt-level)
    17361754
    17371755(define-x8664-subprim-call-vinsn (unbind-interrupt-level) .SPunbind-interrupt-level)
     
    17631781    (()
    17641782     ())
    1765   (jmp (:%q x8664::ra0)))
    1766 
    1767 (define-x8664-vinsn (mkcatchmv :call :subprim-call) (()
    1768                                                      ((lab :label)))
    1769   (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
     1783  (ret))
     1784
     1785(define-x8664-vinsn (nmkcatchmv :call :subprim-call) (()
     1786                                                     ((lab :label))
     1787                                                     ((entry (:label 1))))
    17701788  (leaq (:@ (:^ lab)  (:%q x8664::fn)) (:%q x8664::xfn))
    1771   (jmp (:@ .SPmkcatchmv))
    1772   (:align 3)
    1773   (:long (:^ :back))
     1789  (:talign 4)
     1790  (call (:@ .SPmkcatchmv))
    17741791  :back
    1775   (leaq (:@ (:apply - (:^ :back)) (:%q x8664::ra0)) (:%q x8664::fn)))
    1776 
    1777 (define-x8664-vinsn (mkcatch1v :call :subprim-call) (()
    1778                                                      ((lab :label)))
    1779   (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
     1792  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn)))
     1793
     1794(define-x8664-vinsn (nmkcatch1v :call :subprim-call) (()
     1795                                                     ((lab :label))
     1796                                                     ((entry (:label 1))))
    17801797  (leaq (:@ (:^ lab)  (:%q x8664::fn)) (:%q x8664::xfn))
    1781   (jmp (:@ .SPmkcatch1v))
    1782   (:align 3)
    1783   (:long (:^ :back))
     1798  (:talign 4)
     1799  (call (:@ .SPmkcatch1v))
    17841800  :back
    1785   (leaq (:@ (:apply - (:^ :back)) (:%q x8664::ra0)) (:%q x8664::fn)))
     1801  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn)))
     1802
     1803
     1804(define-x8664-vinsn (make-simple-unwind :call :subprim-call) (()
     1805                                                     ((protform-lab :label)
     1806                                                      (cleanup-lab :label)))
     1807  (leaq (:@ (:^ protform-lab) (:%q x8664::fn)) (:%q x8664::ra0))
     1808  (leaq (:@ (:^ cleanup-lab)  (:%q x8664::fn)) (:%q x8664::xfn))
     1809  (jmp (:@ .SPmkunwind)))
     1810
     1811(define-x8664-vinsn (nmkunwind :call :subprim-call) (()
     1812                                                     ((protform-lab :label)
     1813                                                      (cleanup-lab :label)))
     1814  (leaq (:@ (:^ protform-lab) (:%q x8664::fn)) (:%q x8664::ra0))
     1815  (leaq (:@ (:^ cleanup-lab)  (:%q x8664::fn)) (:%q x8664::xfn))
     1816  (jmp (:@ .SPnmkunwind)))
     1817
     1818;;; "old" mkunwind.  Used by PROGV, since the binding of *interrupt-level*
     1819;;; on entry to the new mkunwind confuses the issue.
    17861820
    17871821(define-x8664-vinsn (mkunwind :call :subprim-call) (()
     
    17921826  (jmp (:@ .SPmkunwind)))
    17931827
    1794 
    1795 (define-x8664-subprim-call-vinsn (gvector) .SPgvector)
     1828(define-x8664-subprim-lea-jmp-vinsn (gvector) .SPgvector)
    17961829
    17971830(define-x8664-subprim-call-vinsn (getu64) .SPgetu64)
     
    18011834(define-x8664-vinsn funcall (()
    18021835                             ()
    1803                              ((tag :u8)))
    1804   (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
     1836                             ((tag :u8)
     1837                              (entry (:label 1))))
    18051838  (movb (:%b x8664::temp0) (:%b tag))
    18061839  (andb (:$b x8664::fulltagmask) (:%b tag))
    18071840  (cmpb (:$b x8664::fulltag-symbol) (:%b tag))
    1808   (cmovgq (:%q x8664::temp0) (:%q x8664::fn))
    1809   (jl :bad)
    1810   (cmoveq (:@ x8664::symbol.fcell (:%q x8664::fname)) (:%q x8664::fn))
    1811   (jmp (:%q x8664::fn))
    1812   :bad
     1841  (cmovgq (:%q x8664::temp0) (:%q x8664::xfn))
     1842  (jge.pt :call)
    18131843  (uuo-error-not-callable)
    1814   (:align 3)
    1815   (:long (:^ :back))
    1816   :back
    1817   (leaq (:@ (:apply - (:^ :back)) (:%q x8664::ra0)) (:%q x8664::fn)))
     1844  :call
     1845  (cmoveq (:@ x8664::symbol.fcell (:%q x8664::fname)) (:%q x8664::xfn))
     1846  (:talign 4)
     1847  (call (:%q x8664::xfn))
     1848  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn)))
    18181849
    18191850(define-x8664-vinsn tail-funcall (()
    18201851                                  ()
    18211852                                  ((tag :u8)))
    1822   (movq (:%q x8664::fn) (:%q x8664::xfn))
    18231853  (movb (:%b x8664::temp0) (:%b tag))
    18241854  (andb (:$b x8664::fulltagmask) (:%b tag))
    18251855  (cmpb (:$b x8664::fulltag-symbol) (:%b tag))
    1826   (cmovgq (:%q x8664::temp0) (:%q x8664::fn))
     1856  (cmovgq (:%q x8664::temp0) (:%q x8664::xfn))
    18271857  (jl :bad)
    1828   (cmoveq (:@ x8664::symbol.fcell (:%q x8664::fname)) (:%q x8664::fn))
    1829   (jmp (:%q x8664::fn))
     1858  (cmoveq (:@ x8664::symbol.fcell (:%q x8664::fname)) (:%q x8664::xfn))
     1859  (jmp (:%q x8664::xfn))
    18301860  :bad
    18311861  (uuo-error-not-callable))
    18321862                             
    1833  
    1834 
    1835 (define-x8664-vinsn init-closure (()
    1836                                   ((closure :lisp)))
    1837   (movb (:$b 3) (:@ x8664::misc-data-offset (:%q closure))) ; code word count
    1838   (movb (:$b -1) (:@ (+ x8664::misc-data-offset 7) (:%q closure))) ; 1st byte of jmp
    1839   (movl (:$l (:apply logior #x2524 (:apply ash .SPcall-closure 16))) (:@ (+ x8664::misc-data-offset 8) (:%q closure))) ; rest of jmp instruction, low two bytes of subprim address
    1840   ((:not (:pred = 0 (:apply ash .SPcall-closure -16)))
    1841    (movb (:$b (:apply ash .SPcall-closure -16)) (:@ (+ x8664::misc-data-offset 12) (:%q closure))))
    1842   (movb (:$b x8664::function-boundary-marker) (:@ (+ x8664::misc-data-offset 16)  (:%q closure))))
     1863
     1864
     1865;;; Magic numbers in here include the address of .SPcall-closure.
     1866(define-x8664-vinsn init-nclosure (()
     1867                                   ((closure :lisp))
     1868                                   ((imm0 :u64)))
     1869  (movq (:$q #x24fffffffff92d8d) (:%q imm0))
     1870  (movb (:$b 4) (:@ x8664::misc-data-offset (:%q closure))) ; code word count
     1871  (movb (:$b #x4c) (:@ (+ x8664::misc-data-offset 7) (:%q closure))) ; 1st byte of lea
     1872  (movq (:%q imm0) (:@ (+ x8664::misc-data-offset 8) (:%q closure))) ; rest of lea, start of jmp
     1873  (movl (:$l #x00516825) (:@ (+ x8664::misc-data-offset 16) (:%q closure)))
     1874  (movb (:$b x8664::function-boundary-marker) (:@ (+ x8664::misc-data-offset 24)  (:%q closure))))
    18431875
    18441876
     
    18501882(define-x8664-vinsn (ref-symbol-value :call :subprim-call)
    18511883    (((val :lisp))
    1852      ((sym (:lisp (:ne val)))))
    1853   (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
    1854   (jmp (:@ .SPspecrefcheck))
    1855   (:align 3)
    1856   (:long (:^ :back))
    1857   :back)
     1884     ((sym (:lisp (:ne val))))
     1885     ((entry (:label 1))))
     1886  (:talign 4)
     1887  (call (:@ .SPspecrefcheck))
     1888  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn)) )
    18581889
    18591890(define-x8664-vinsn ref-symbol-value-inline (((dest :lisp))
     
    18791910(define-x8664-vinsn (%ref-symbol-value :call :subprim-call)
    18801911    (((val :lisp))
    1881      ((sym (:lisp (:ne val)))))
    1882   (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
     1912     ((sym (:lisp (:ne val))))
     1913     ((entry (:label 1))))
     1914  (:talign 4)
    18831915  (jmp (:@ .SPspecref))
    1884   (:align 3)
    1885   (:long (:^ :back))
    1886   :back)
     1916  :back
     1917  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn)))
    18871918
    18881919(define-x8664-vinsn %ref-symbol-value-inline (((dest :lisp))
     
    19071938  (movq (:@ x8664::INTERRUPT-LEVEL-BINDING-INDEX (:%q temp)) (:%q dest)))
    19081939
    1909 (define-x8664-vinsn save-cleanup-context (()
    1910                                           ((lab :label)))
    1911   (leaq (:@ (:apply - (:^ lab)) (:%q x8664::xfn)) (:%q x8664::fn))
    1912   )
    19131940
    19141941
     
    24352462  (movq (:%q count) (:%q temp))
    24362463  (sarq (:$ub x8664::fixnumshift) (:%q temp))
    2437   (xorl (:%l shiftcount) (:%l shiftcount))
    24382464  (rcmpq (:%q temp) (:$l 63))
    24392465  (cmovbw (:%w temp) (:%w shiftcount))
     
    24412467  (jae :shift-max)
    24422468  (sarq (:%shift x8664::cl) (:%q temp))
    2443   (xorb (:%b x8664::cl) (:%b x8664::cl))
    24442469  (jmp :done)
    24452470  :shift-max
     
    24562481  (movq (:%q count) (:%q temp))
    24572482  (sarq (:$ub x8664::fixnumshift) (:%q temp))
    2458   (xorl (:%l shiftcount) (:%l shiftcount))
    24592483  (rcmpq (:%q temp) (:$l 63))
    24602484  (cmovbw (:%w temp) (:%w shiftcount))
     
    24622486  (jae :shift-max)
    24632487  (shrq (:%shift x8664::cl) (:%q temp))
    2464   (xorb (:%b x8664::cl) (:%b x8664::cl))
    24652488  (jmp :done)
    24662489  :shift-max
     
    24952518  (movq (:%q count) (:%q temp))
    24962519  (sarq (:$ub x8664::fixnumshift) (:%q temp))
    2497   (xorl (:%l shiftcount) (:%l shiftcount))
    24982520  (rcmpq (:%q temp) (:$l 63))
    24992521  (cmovbw (:%w temp) (:%w shiftcount))
     
    25012523  (jae :shift-max)
    25022524  (shlq (:%shift x8664::cl) (:%q temp))
    2503   (xorb (:%b x8664::cl) (:%b x8664::cl))
    25042525  (jmp :done)
    25052526  :shift-max
     
    28722893  (movss (:%xmm x8664::fpzero) (:%xmm dest)))
    28732894
    2874 (define-x8664-subprim-call-vinsn (heap-rest-arg) .SPheap-rest-arg)
    2875 (define-x8664-subprim-call-vinsn (stack-rest-arg) .SPstack-rest-arg)
    2876 (define-x8664-subprim-call-vinsn (req-stack-rest-arg) .SPreq-stack-rest-arg)
     2895(define-x8664-subprim-lea-jmp-vinsn (heap-rest-arg) .SPheap-rest-arg)
     2896(define-x8664-subprim-lea-jmp-vinsn (stack-rest-arg) .SPstack-rest-arg)
     2897(define-x8664-subprim-lea-jmp-vinsn (req-stack-rest-arg) .SPreq-stack-rest-arg)
    28772898
    28782899(define-x8664-subprim-call-vinsn (stack-misc-alloc) .SPstack-misc-alloc)
     
    29522973  (movq (:@ x8664::misc-data-offset (:%q vcell)) (:%q dest)))
    29532974
    2954 ;;; The only current use of this - calling .SPgvset - doesn't need
    2955 ;;; to recover %fn from %ra0.
    29562975(define-x8664-vinsn (call-subprim-3 :call :subprim-call) (((dest t))
    29572976                                                          ((spno :s32const)
    29582977                                                           (x t)
    29592978                                                           (y t)
    2960                                                            (z t)))
    2961   (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
    2962   (jmp (:@ spno))
    2963   (:align 3)
    2964   (:long (:^ :back))
    2965   :back)
     2979                                                           (z t))
     2980                                                          ((entry (:label 1))))
     2981  (:talign 4)
     2982  (call (:@ spno))
     2983  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn)))
    29662984
    29672985(define-x8664-vinsn setup-vcell-allocation (()
     
    29792997(define-x8664-subprim-jump-vinsn (progvrestore) .SPprogvrestore)
    29802998
    2981 (define-x8664-subprim-call-vinsn (simple-keywords) .SPsimple-keywords)
    2982 
    2983 (define-x8664-subprim-call-vinsn (keyword-args) .SPkeyword-args)
    2984 
    2985 (define-x8664-subprim-call-vinsn (keyword-bind) .SPkeyword-bind)
     2999(define-x8664-subprim-lea-jmp-vinsn (simple-keywords) .SPsimple-keywords)
     3000
     3001(define-x8664-subprim-lea-jmp-vinsn (keyword-args) .SPkeyword-args)
     3002
     3003(define-x8664-subprim-lea-jmp-vinsn (keyword-bind) .SPkeyword-bind)
    29863004
    29873005(define-x8664-vinsn scale-nargs (()
     
    31793197    (()
    31803198     ((sym :lisp)
    3181       (val :lisp)))
    3182   (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
    3183   (jmp (:@ .SPspecset))
    3184   (:align 3)
    3185   (:long (:^ :back))
    3186   :back
    3187   (leaq (:@ (:apply - (:^ :back)) (:%q x8664::ra0)) (:%q x8664::fn)))
     3199      (val :lisp))
     3200     ((entry (:label 1))))
     3201  (:talign 4)
     3202  (call (:@ .SPspecset))
     3203  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn)))
    31883204
    31893205(define-x8664-vinsn set-z-flag-if-istruct-typep (()
     
    32093225(define-x8664-subprim-call-vinsn (ksignalerr) .SPksignalerr)
    32103226
    3211 (define-x8664-subprim-call-vinsn (misc-alloc-init) .SPmisc-alloc-init t)
     3227(define-x8664-subprim-call-vinsn (misc-alloc-init) .SPmisc-alloc-init)
    32123228
    32133229(define-x8664-subprim-call-vinsn (misc-alloc) .SPmisc-alloc)
    32143230
    3215 (define-x8664-subprim-call-vinsn (make-stack-gvector)  .SPstkgvector)
     3231(define-x8664-subprim-lea-jmp-vinsn (make-stack-gvector)  .SPstkgvector)
    32163232
    32173233(define-x8664-vinsn load-character-constant (((dest :lisp))
     
    32593275                                                          ((spno :s32const)
    32603276                                                           (y t)
    3261                                                            (z t)))
    3262   (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
    3263   (jmp (:@ spno))
    3264   (:align 3)
    3265   (:long (:^ :back))
    3266   :back
    3267   (leaq (:@ (:apply - (:^ :back)) (:%q x8664::ra0)) (:%q x8664::fn)))
     3277                                                           (z t))
     3278                                                          ((entry (:label 1))))
     3279  (:talign 4)
     3280  (call (:@ spno))
     3281  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn)))
     3282
     3283
    32683284
    32693285(define-x8664-vinsn set-macptr-address (()
     
    33173333(define-x8664-subprim-call-vinsn (misc-set) .SPmisc-set)
    33183334
    3319 (define-x8664-subprim-call-vinsn (slide-values) .SPmvslide)
    3320 
    3321 (define-x8664-subprim-call-vinsn (spread-list)  .SPspreadargz)
     3335(define-x8664-subprim-lea-jmp-vinsn (slide-values) .SPmvslide)
     3336
     3337(define-x8664-subprim-lea-jmp-vinsn (spread-list)  .SPspreadargz)
    33223338
    33233339;;; Even though it's implemented by calling a subprim, THROW is really
     
    33263342;;; transfer & jump ...)
    33273343(define-x8664-vinsn (throw :jump :jump-unknown) (()
    3328                                                  ())
     3344                                                 ()
     3345                                                 ((entry (:label 1))))
    33293346  (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
     3347  (:talign 4)
    33303348  (jmp (:@ .SPthrow))
    3331   (:align 3)
    3332   (:long (:^ :back))
    3333   :back)
     3349  :back
     3350  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn)))
    33343351
    33353352
     
    33443361  :got-it)
    33453362
    3346 (define-x8664-subprim-call-vinsn (save-values) .SPsave-values)
    3347 
    3348 (define-x8664-subprim-call-vinsn (recover-values)  .SPrecover-values)
    3349 
    3350 (define-x8664-subprim-call-vinsn (recover-values-for-mvcall) .SPrecover-values-for-mvcall)
    3351 
    3352 (define-x8664-subprim-call-vinsn (add-values) .SPadd-values)
     3363(define-x8664-subprim-lea-jmp-vinsn (save-values) .SPsave-values)
     3364
     3365(define-x8664-subprim-lea-jmp-vinsn (recover-values)  .SPrecover-values)
     3366
     3367(define-x8664-subprim-lea-jmp-vinsn (recover-values-for-mvcall) .SPrecover-values-for-mvcall)
     3368
     3369(define-x8664-subprim-lea-jmp-vinsn (add-values) .SPadd-values)
    33533370
    33543371(define-x8664-subprim-call-vinsn (make-stack-block)  .SPmakestackblock)
     
    34223439
    34233440
    3424 (define-x8664-subprim-call-vinsn (req-heap-rest-arg) .SPreq-heap-rest-arg)
    3425 
    3426 (define-x8664-subprim-call-vinsn (stack-misc-alloc-init)  .SPstack-misc-alloc-init t)
     3441(define-x8664-subprim-lea-jmp-vinsn (req-heap-rest-arg) .SPreq-heap-rest-arg)
     3442
     3443(define-x8664-subprim-call-vinsn (stack-misc-alloc-init)  .SPstack-misc-alloc-init)
    34273444
    34283445(define-x8664-vinsn fixnum->unsigned-natural (((dest :u64))
     
    35013518(define-x8664-subprim-call-vinsn (setqsym) .SPsetqsym)
    35023519
    3503 (define-x8664-vinsn recover-fn-from-ra0 (()
    3504                                          ((lab :label)))
    3505   (leaq (:@ (:apply - (:^ lab)) (:%q x8664::ra0)) (:%q x8664::fn)))
     3520(define-x8664-vinsn recover-fn-from-rip (()
     3521                                         ())
     3522  (leaq (:@ (:apply - (:^ :disp)) (:%q x8664::rip)) (:%q x8664::fn))
     3523  :disp)
     3524
     3525
    35063526
    35073527(define-x8664-subprim-call-vinsn (makeu64) .SPmakeu64)
     
    35093529(define-x8664-subprim-call-vinsn (makes64) .SPmakes64)
    35103530
    3511 (define-x8664-subprim-call-vinsn (stack-cons-list*)  .SPstkconslist-star)
    3512 
    3513 (define-x8664-subprim-call-vinsn (list*) .SPconslist-star)
     3531(define-x8664-subprim-lea-jmp-vinsn (stack-cons-list*)  .SPstkconslist-star)
     3532
     3533(define-x8664-subprim-lea-jmp-vinsn (list*) .SPconslist-star)
    35143534
    35153535(define-x8664-vinsn make-tsp-vcell (((dest :lisp))
     
    35273547  (leaq (:@ (+ x8664::dnode-size x8664::fulltag-misc) (:%q temp)) (:%q dest)))
    35283548
    3529 (define-x8664-subprim-call-vinsn (bind-nil)  .SPbind-nil)
    3530 
    3531 (define-x8664-subprim-call-vinsn (bind-self)  .SPbind-self)
    3532 
    3533 (define-x8664-subprim-call-vinsn (bind-self-boundp-check)  .SPbind-self-boundp-check)
    3534 
    3535 (define-x8664-subprim-call-vinsn (bind)  .SPbind)
     3549(define-x8664-subprim-lea-jmp-vinsn (bind-nil)  .SPbind-nil)
     3550
     3551(define-x8664-subprim-lea-jmp-vinsn (bind-self)  .SPbind-self)
     3552
     3553(define-x8664-subprim-lea-jmp-vinsn (bind-self-boundp-check)  .SPbind-self-boundp-check)
     3554
     3555(define-x8664-subprim-lea-jmp-vinsn (bind)  .SPbind)
    35363556
    35373557(define-x8664-vinsn (dpayback :call :subprim-call) (()
    35383558                                                    ((n :s16const))
    3539                                                     ((temp (:u32 #.x8664::imm0))))
     3559                                                    ((temp (:u32 #.x8664::imm0))
     3560                                                     (entry (:label 1))))
    35403561  ((:pred > n 0)
    3541    (leaq (:@ (:^ :back) (:%q x8664::fn)) (:%q x8664::ra0))
    35423562   ((:pred > n 1)
    35433563    (movl (:$l n) (:%l temp))
    3544     (jmp (:@ .SPunbind-n)))
     3564    (:talign 4)
     3565    (call (:@ .SPunbind-n)))
    35453566   ((:pred = n 1)
    3546     (jmp (:@ .SPunbind)))
    3547    (:align 3)
    3548    (:long (:^ :back))
    3549    :back)) 
     3567    (:talign 4)
     3568    (call (:@ .SPunbind)))
     3569   (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn)))) 
    35503570
    35513571(define-x8664-subprim-jump-vinsn (tail-call-sym-gen) .SPtcallsymgen)
     
    35593579            (:%q node)) (:%q dest)))
    35603580
    3561 (define-x8664-subprim-call-vinsn (stack-cons-list)  .SPstkconslist)
     3581(define-x8664-subprim-lea-jmp-vinsn (stack-cons-list)  .SPstkconslist)
    35623582
    35633583
     
    35803600  :ok)
    35813601
    3582 (define-x8664-subprim-call-vinsn (heap-cons-rest-arg) .SPheap-cons-rest-arg)
    3583 
    3584 (define-x8664-subprim-call-vinsn (stack-cons-rest-arg) .SPstack-cons-rest-arg)
    3585 
    3586 (define-x8664-subprim-call-vinsn (make-stack-vector)  .SPmkstackv)
     3602(define-x8664-subprim-lea-jmp-vinsn (heap-cons-rest-arg) .SPheap-cons-rest-arg)
     3603
     3604(define-x8664-subprim-lea-jmp-vinsn (stack-cons-rest-arg) .SPstack-cons-rest-arg)
     3605
     3606(define-x8664-subprim-lea-jmp-vinsn (make-stack-vector)  .SPmkstackv)
    35873607
    35883608(define-x8664-vinsn %current-frame-ptr (((dest :imm))
     
    36443664
    36453665
    3646 (define-x8664-subprim-call-vinsn (spread-lexpr)  .SPspread-lexpr-z)
     3666(define-x8664-subprim-lea-jmp-vinsn (spread-lexpr)  .SPspread-lexpr-z)
    36473667
    36483668(define-x8664-vinsn mem-ref-double-float (((dest :double-float))
     
    36643684  (movl (:$l n) (:%l x8664::nargs)))
    36653685
    3666 (define-x8664-subprim-call-vinsn (macro-bind) .SPmacro-bind)
    3667 
    3668 (define-x8664-subprim-call-vinsn (destructuring-bind-inner) .SPdestructuring-bind-inner)
    3669 
    3670 (define-x8664-subprim-call-vinsn (destructuring-bind) .SPdestructuring-bind)
     3686(define-x8664-subprim-lea-jmp-vinsn (macro-bind) .SPmacro-bind)
     3687
     3688(define-x8664-subprim-lea-jmp-vinsn (destructuring-bind-inner) .SPdestructuring-bind-inner)
     3689
     3690(define-x8664-subprim-lea-jmp-vinsn (destructuring-bind) .SPdestructuring-bind)
    36713691
    36723692(define-x8664-vinsn symbol-ref (((dest :lisp))
     
    42214241  (xchgq (:%q a) (:%q b)))
    42224242
     4243(define-x8664-vinsn establish-fn (()
     4244                                  ()
     4245                                  ((entry (:label 1))))
     4246  (leaq (:@ (:^ entry) (:% x8664::rip)) (:%q x8664::fn)))
     4247                                 
    42234248(queue-fixup
    42244249 (fixup-x86-vinsn-templates
Note: See TracChangeset for help on using the changeset viewer.