Changeset 6370 for branches/x8664-call


Ignore:
Timestamp:
Apr 29, 2007, 9:33:52 AM (13 years ago)
Author:
gb
Message:

LAP changes to support new x86-64 calling sequence (multiple-values,
CLOS lexpr stuff, etc.)

Location:
branches/x8664-call/ccl/level-0/X86
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/x8664-call/ccl/level-0/X86/X8664/x8664-bignum.lisp

    r5588 r6370  
    4141;;; Add the 32-bit "prev" digit and the 32-bit carry-in digit to that 64-bit
    4242;;; result; return the halves as (VALUES high low).
    43 (defx86lapfunction %multiply-and-add4 ((x 0) (y arg_x) (prev arg_y) (carry-in arg_z))
     43(defx86lapfunction %multiply-and-add4 ((x 8) #|(ra 0)|# (y arg_x) (prev arg_y) (carry-in arg_z))
    4444  (let ((unboxed-x imm0)
    4545        (unboxed-y imm1)
     
    4949        (high arg_y)
    5050        (low arg_z))
     51    (pop (% ra0))
    5152    (popq (% temp0))
    5253    (discard-reserved-frame)
     54    (push (% ra0))
    5355    (unbox-fixnum temp0 unboxed-x)
    5456    (unbox-fixnum y unboxed-y)
     
    6466    (shr ($ 32) (% unboxed-y))
    6567    (box-fixnum unboxed-y high)
     68    (movq (% rsp) (% temp0))
    6669    (pushq (% high))
    6770    (pushq (% low))
    6871    (set-nargs 2)
    69     (leaq (@ '2 (% rsp)) (% temp0))
    7072    (jmp-subprim .SPvalues)))
    7173
     
    8890    (shr ($ 32) (% unboxed-y))
    8991    (box-fixnum unboxed-y high)
     92    (movq (% rsp) (% temp0))
    9093    (pushq (% high))
    9194    (pushq (% low))
    9295    (set-nargs 2)
    93     (leaq (@ '2 (% rsp)) (% temp0))
    9496    (jmp-subprim .SPvalues)))
    9597
  • branches/x8664-call/ccl/level-0/X86/x86-array.lisp

    r5514 r6370  
    5656(defx86lapfunction %array-header-data-and-offset ((a arg_z))
    5757  (let ((offset arg_y)
    58         (temp temp0))
     58        (temp temp1))
     59    (movq (% rsp) (% temp0))
    5960    (movl ($ '0) (%l offset))
    6061    (movq (% a) (% temp))
     
    6970    (push (% offset))
    7071    (set-nargs 2)
    71     (lea (@ '2 (% rsp)) (% temp0))
    7272    (jmp-subprim  .SPvalues)))
    7373
    7474
    7575
    76 (defx86lapfunction %boole-clr ((idx 0) (b0 arg_x) (b1 arg_y) (dest arg_z))
    77   (pop (% temp0))
    78   (discard-reserved-frame)
     76(defx86lapfunction %boole-clr ((idx 8) #|(ra 0)|# (b0 arg_x) (b1 arg_y) (dest arg_z))
     77  (movq (@ idx (% rsp)) (% temp0))
    7978  (movq ($ 0) (@ x8664::misc-data-offset (% dest) (% temp0)))
    80   (single-value-return))
    81 
    82 (defx86lapfunction %boole-set ((idx 0) (b0 arg_x) (b1 arg_y) (dest arg_z))
    83   (pop (% temp0))
    84   (discard-reserved-frame)
     79  (single-value-return 3))
     80
     81(defx86lapfunction %boole-set ((idx 8) #|(ra 0)|# (b0 arg_x) (b1 arg_y) (dest arg_z))
     82  (movq (@ idx (% rsp)) (% temp0))
    8583  (movq ($ -1) (@ x8664::misc-data-offset (% dest) (% temp0)))
    86   (single-value-return))
    87 
    88 (defx86lapfunction %boole-1 ((idx 0) (b0 arg_x) (b1 arg_y) (dest arg_z))
    89   (pop (% temp0))
    90   (discard-reserved-frame)
    91   (movq (@ x8664::misc-data-offset (% b0) (% temp0)) (% imm0))
    92   (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
    93   (single-value-return))
    94 
    95 (defx86lapfunction %boole-2 ((idx 0) (b0 arg_x) (b1 arg_y) (dest arg_z))
    96   (pop (% temp0))
    97   (discard-reserved-frame)
    98   (movq (@ x8664::misc-data-offset (% b1) (% temp0)) (% imm0))
    99   (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
    100   (single-value-return))
    101 
    102 (defx86lapfunction %boole-c1 ((idx 0) (b0 arg_x) (b1 arg_y) (dest arg_z))
    103   (pop (% temp0))
    104   (discard-reserved-frame)
    105   (movq (@ x8664::misc-data-offset (% b0) (% temp0)) (% imm0))
    106   (notq (% imm0))
    107   (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
    108   (single-value-return))
    109 
    110 (defx86lapfunction %boole-c2 ((idx 0) (b0 arg_x) (b1 arg_y) (dest arg_z))
    111   (pop (% temp0))
    112   (discard-reserved-frame)
    113   (movq (@ x8664::misc-data-offset (% b1) (% temp0)) (% imm0))
    114   (notq (% imm0))
    115   (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
    116   (single-value-return))
    117 
    118 (defx86lapfunction %boole-and ((idx 0) (b0 arg_x) (b1 arg_y) (dest arg_z))
    119   (pop (% temp0))
    120   (discard-reserved-frame)
     84  (single-value-return 3))
     85
     86(defx86lapfunction %boole-1 ((idx 8) #|(ra 0)|# (b0 arg_x) (b1 arg_y) (dest arg_z))
     87  (movq (@ idx (% rsp)) (% temp0))
     88  (movq (@ x8664::misc-data-offset (% b0) (% temp0)) (% imm0))
     89  (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
     90  (single-value-return 3))
     91
     92(defx86lapfunction %boole-2 ((idx 8) #|(ra 0)|# (b0 arg_x) (b1 arg_y) (dest arg_z))
     93  (movq (@ idx (% rsp)) (% temp0))
     94  (movq (@ x8664::misc-data-offset (% b1) (% temp0)) (% imm0))
     95  (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
     96  (single-value-return 3))
     97
     98(defx86lapfunction %boole-c1 ((idx 8) #|(ra 0)|# (b0 arg_x) (b1 arg_y) (dest arg_z))
     99  (movq (@ idx (% rsp)) (% temp0))
     100  (movq (@ x8664::misc-data-offset (% b0) (% temp0)) (% imm0))
     101  (notq (% imm0))
     102  (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
     103  (single-value-return 3))
     104
     105(defx86lapfunction %boole-c2 ((idx 8) #|(ra 0)|# (b0 arg_x) (b1 arg_y) (dest arg_z))
     106  (movq (@ idx (% rsp)) (% temp0))
     107  (movq (@ x8664::misc-data-offset (% b1) (% temp0)) (% imm0))
     108  (notq (% imm0))
     109  (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
     110  (single-value-return 3))
     111
     112(defx86lapfunction %boole-and ((idx 8) #|(ra 0)|# (b0 arg_x) (b1 arg_y) (dest arg_z))
     113  (movq (@ idx (% rsp)) (% temp0))
    121114  (movq (@ x8664::misc-data-offset (% b0) (% temp0)) (% imm0))
    122115  (andq (@ x8664::misc-data-offset (% b1) (% temp0)) (% imm0))
    123116  (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
    124   (single-value-return))
    125 
    126 (defx86lapfunction %boole-ior ((idx 0) (b0 arg_x) (b1 arg_y) (dest arg_z))
    127   (pop (% temp0))
    128   (discard-reserved-frame)
     117  (single-value-return 3))
     118
     119(defx86lapfunction %boole-ior ((idx 8) #|(ra 0)|# (b0 arg_x) (b1 arg_y) (dest arg_z))
     120  (movq (@ idx (% rsp)) (% temp0))
    129121  (movq (@ x8664::misc-data-offset (% b0) (% temp0)) (% imm0))
    130122  (orq (@ x8664::misc-data-offset (% b1) (% temp0)) (% imm0))
    131123  (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
    132   (single-value-return))
    133 
    134 (defx86lapfunction %boole-xor ((idx 0) (b0 arg_x) (b1 arg_y) (dest arg_z))
    135   (pop (% temp0))
    136   (discard-reserved-frame)
    137   (movq (@ x8664::misc-data-offset (% b0) (% temp0)) (% imm0))
     124  (single-value-return 3))
     125
     126(defx86lapfunction %boole-xor ((idx 8) #|(ra 0)|# (b0 arg_x) (b1 arg_y) (dest arg_z))
     127  (movq (@ idx (% rsp)) (% temp0))
     128n  (movq (@ x8664::misc-data-offset (% b0) (% temp0)) (% imm0))
    138129  (xorq (@ x8664::misc-data-offset (% b1) (% temp0)) (% imm0))
    139130  (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
    140   (single-value-return))
    141 
    142 (defx86lapfunction %boole-eqv ((idx 0) (b0 arg_x) (b1 arg_y) (dest arg_z))
    143   (pop (% temp0))
    144   (discard-reserved-frame)
     131  (single-value-return 3))
     132
     133(defx86lapfunction %boole-eqv ((idx 8) #|(ra 0)|# (b0 arg_x) (b1 arg_y) (dest arg_z))
     134  (movq (@ idx (% rsp)) (% temp0))
    145135  (movq (@ x8664::misc-data-offset (% b0) (% temp0)) (% imm0))
    146136  (xorq (@ x8664::misc-data-offset (% b1) (% temp0)) (% imm0))
    147137  (notq (% imm0))
    148138  (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
    149   (single-value-return))
    150 
    151 (defx86lapfunction %boole-nand ((idx 0) (b0 arg_x) (b1 arg_y) (dest arg_z))
    152   (pop (% temp0))
    153   (discard-reserved-frame)
     139  (single-value-return 3))
     140
     141(defx86lapfunction %boole-nand ((idx 8) #|(ra 0)|# (b0 arg_x) (b1 arg_y) (dest arg_z))
     142  (movq (@ idx (% rsp)) (% temp0))
    154143  (movq (@ x8664::misc-data-offset (% b0) (% temp0)) (% imm0))
    155144  (andq (@ x8664::misc-data-offset (% b1) (% temp0)) (% imm0))
    156145  (notq (% imm0))
    157146  (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
    158   (single-value-return))
    159 
    160 (defx86lapfunction %boole-nor ((idx 0) (b0 arg_x) (b1 arg_y) (dest arg_z))
    161   (pop (% temp0))
    162   (discard-reserved-frame)
     147  (single-value-return 3))
     148
     149(defx86lapfunction %boole-nor ((idx 8) #|(ra 0)|# (b0 arg_x) (b1 arg_y) (dest arg_z))
     150  (movq (@ idx (% rsp)) (% temp0))
    163151  (movq (@ x8664::misc-data-offset (% b0) (% temp0)) (% imm0))
    164152  (orq (@ x8664::misc-data-offset (% b1) (% temp0)) (% imm0))
    165153  (notq (% imm0))
    166154  (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
    167   (single-value-return))
    168 
    169 (defx86lapfunction %boole-andc1 ((idx 0) (b0 arg_x) (b1 arg_y) (dest arg_z))
    170   (pop (% temp0))
    171   (discard-reserved-frame)
     155  (single-value-return 3))
     156
     157(defx86lapfunction %boole-andc1 ((idx 8) #|(ra 0)|# (b0 arg_x) (b1 arg_y) (dest arg_z))
     158  (movq (@ idx (% rsp)) (% temp0))
    172159  (movq (@ x8664::misc-data-offset (% b0) (% temp0)) (% imm0))
    173160  (notq (% imm0))
    174161  (andq (@ x8664::misc-data-offset (% b1) (% temp0)) (% imm0))
    175162  (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
    176   (single-value-return))
    177 
    178 (defx86lapfunction %boole-andc2 ((idx 0) (b0 arg_x) (b1 arg_y) (dest arg_z))
    179   (pop (% temp0))
    180   (discard-reserved-frame)
     163  (single-value-return 3))
     164
     165(defx86lapfunction %boole-andc2 ((idx 8) #|(ra 0)|# (b0 arg_x) (b1 arg_y) (dest arg_z))
     166  (movq (@ idx (% rsp)) (% temp0))
    181167  (movq (@ x8664::misc-data-offset (% b1) (% temp0)) (% imm0))
    182168  (notq (% imm0))
    183169  (andq (@ x8664::misc-data-offset (% b0) (% temp0)) (% imm0))
    184170  (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
    185   (single-value-return))
    186 
    187 (defx86lapfunction %boole-orc1 ((idx 0) (b0 arg_x) (b1 arg_y) (dest arg_z))
    188   (pop (% temp0))
    189   (discard-reserved-frame)
     171  (single-value-return 3))
     172
     173(defx86lapfunction %boole-orc1 ((idx 8) #|(ra 0)|# (b0 arg_x) (b1 arg_y) (dest arg_z))
     174  (movq (@ idx (% rsp)) (% temp0))
    190175  (movq (@ x8664::misc-data-offset (% b0) (% temp0)) (% imm0))
    191176  (notq (% imm0))
    192177  (orq (@ x8664::misc-data-offset (% b1) (% temp0)) (% imm0))
    193178  (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
    194   (single-value-return))
    195 
    196 (defx86lapfunction %boole-orc2 ((idx 0) (b0 arg_x) (b1 arg_y) (dest arg_z))
    197   (pop (% temp0))
    198   (discard-reserved-frame)
     179  (single-value-return 3))
     180
     181(defx86lapfunction %boole-orc2 ((idx 8) #|(ra 0)|# (b0 arg_x) (b1 arg_y) (dest arg_z))
     182  (movq (@ idx (% rsp)) (% temp0))
    199183  (movq (@ x8664::misc-data-offset (% b1) (% temp0)) (% imm0))
    200184  (notq (% imm0))
    201185  (orq (@ x8664::misc-data-offset (% b0) (% temp0)) (% imm0))
    202186  (movq (% imm0) (@ x8664::misc-data-offset (% dest) (% temp0)))
    203   (single-value-return))
     187  (single-value-return 3))
    204188
    205189(defparameter *simple-bit-boole-functions* ())
  • branches/x8664-call/ccl/level-0/X86/x86-clos.lisp

    r6325 r6370  
    7272  (movq (@ x8664::misc-data-offset (% temp0) (% imm1) 8) (% arg_z))
    7373  (movq (@ 'class (% fn)) (% arg_x))
    74   (movq (@ '%maybe-std-std-value-using-class (% fn)) (% xfn))
    75   (xchgq (% xfn) (% fn))
    76   (set-nargs 3)
    77   (jmp (% fn))
     74  (set-nargs 3)
     75  (jmp (@ '%maybe-std-std-value-using-class (% fn)))
    7876  @missing                              ; (%slot-id-ref-missing instance id)
    79   (movq (@'%slot-id-ref-missing (% fn)) (% xfn))
    80   (xchgq (% xfn) (% fn))
    8177  (set-nargs 2)
    82   (jmp (% fn)))
     78  (jmp (@'%slot-id-ref-missing (% fn))))
    8379
    8480(defx86lapfunction %large-slot-id-value ((instance arg_y) (slot-id arg_z)) 
     
    9793  (movq (@ x8664::misc-data-offset (% temp0) (% imm1) 8) (% arg_z))
    9894  (movq (@ 'class (% fn)) (% arg_x))
    99   (movq (@ '%maybe-std-std-value-using-class (% fn)) (% xfn))
    100   (xchgq (% xfn) (% fn))
    101   (set-nargs 3)
    102   (jmp (% fn))
     95  (set-nargs 3)
     96  (jmp (@ '%maybe-std-std-value-using-class (% fn)))
    10397  @missing                              ; (%slot-id-ref-missing instance id)
    104   (movq (@'%slot-id-ref-missing (% fn)) (% xfn))
    105   (xchgq (% xfn) (% fn))
    10698  (set-nargs 2)
    107   (jmp (% fn)))
     99  (jmp (@'%slot-id-ref-missing (% fn))))
    108100
    109101 
     
    121113  (testl (%l imm1) (%l imm1))
    122114  (je @missing)
     115  (popq (% ra0))
    123116  (pushq ($ 0))                         ; reserve frame
    124117  (pushq ($ 0))
    125118  (pushq (@ 'class (% fn)))
    126119  (movq (@ x8664::misc-data-offset (% temp0) (% imm1) 8) (% arg_y))
    127   (movq (@ '%maybe-std-setf-slot-value-using-class (% fn)) (% xfn))
    128   (xchgq (% xfn) (% fn))
    129120  (set-nargs 4)
    130   (jmp (% fn))
     121  (pushq (% ra0))
     122  (jmp (@ '%maybe-std-setf-slot-value-using-class (% fn)))
    131123  @missing                              ; (%slot-id-set-missing instance id new-value)
    132   (movq (@ '%slot-id-set-missing (% fn)) (% xfn))
    133   (xchgq (% xfn) (% fn))
    134   (set-nargs 3)
    135   (jmp (% fn)))
     124  (set-nargs 3)
     125  (jmp (@ '%slot-id-set-missing (% fn))))
    136126
    137127
     
    149139  (testl (%l imm1) (%l imm1))
    150140  (je @missing)
     141  (popq (% ra0))
    151142  (pushq ($ 0))                         ; reserve frame
    152143  (pushq ($ 0))
    153144  (pushq (@ 'class (% fn)))
     145  (pushq (% ra0))
    154146  (movq (@ x8664::misc-data-offset (% temp0) (% imm1) 8) (% arg_y))
    155   (movq (@ '%maybe-std-setf-slot-value-using-class (% fn)) (% xfn))
    156   (xchgq (% xfn) (% fn))
    157147  (set-nargs 4)
    158   (jmp (% fn))
     148  (jmp (@ '%maybe-std-setf-slot-value-using-class (% fn)))
    159149  @missing                              ; (%slot-id-set-missing instance id new-value)
    160   (movq (@'%slot-id-ref-missing (% fn)) (% xfn))
    161   (xchgq (% xfn) (% fn))
    162   (set-nargs 3)
    163   (jmp (% fn)))
     150  (set-nargs 3)
     151  (jmp (@'%slot-id-ref-missing (% fn))))
    164152
    165153
     
    178166      (:fixed-constants (class-wrapper slots dispatch-table dcode hash))
    179167      (:code-size x8664::gf-code-size)
     168      (movq (@ (% rsp)) (% ra0))
    180169      (save-frame-variable-arg-count)
    181170      (push-argregs)
     
    192181      (movq (% imm0) (% ra0))
    193182      @call
     183      (push (% ra0))
    194184      (movq (@ 'dispatch-table (% fn)) (% arg_y))
    195185      (set-nargs 2)
    196       (movq (@ 'dcode (% fn)) (% xfn))  ; dcode function
    197       (xchgq (% xfn) (% fn))
    198       (jmp (% fn))))))
     186      (jmp (@ 'dcode (% fn)))  ; dcode function
     187      ))))
    199188
    200189;;; is a winner - saves ~15%
     
    205194  (movq (@ 'dispatch-table (% fn)) (% arg_y))
    206195  (set-nargs 2)
    207   (movq (% fn) (% xfn))               ; don't let %fn get GCed
    208   (movq (@ 'dcode (% fn)) (% fn))
    209   (jmp (% fn)))
     196  (jmp (@ 'dcode (% fn))))
    210197
    211198(defx86lapfunction gag-two-arg ((arg0 arg_y) (arg1 arg_z))
     
    215202  (movq (@ 'dispatch-table (% fn)) (% arg_x))
    216203  (set-nargs 3)
    217   (movq (% fn) (% xfn))               ; don't let %fn get GCed
    218   (movq (@ 'dcode (% fn)) (% fn))
    219   (jmp (% fn)))
    220 
     204  (jmp (@ 'dcode (% fn))))
    221205
    222206
     
    224208  (:fixed-constants (class-wrapper slots dispatch-table dcode hash))
    225209  (:code-size x8664::gf-code-size)
    226   (movq (@ 'dcode (% fn)) (% xfn))
    227   (xchgq (% fn) (% xfn))
    228   (jmp (% fn)))
     210  (jmp (@ 'dcode (% fn))))
    229211
    230212
     
    235217  (:code-size x8664::gf-code-size)
    236218  (save-frame-variable-arg-count)
    237   (call-subprim .SPheap-rest-arg nil)
     219  (call-subprim .SPheap-rest-arg)
    238220  (pop (% arg_z))
    239221  (movq ($ '#.$XNOFINFUNCTION) (% arg_x))
     
    255237      ()
    256238      (:fixed-constants (thing dcode gf bits))
     239      (movq (@ (% rsp)) (% ra0))
    257240      (save-frame-variable-arg-count)
    258241      (push-argregs)
     
    269252      (movq (% imm0) (% ra0))
    270253      @call
     254      (push (% ra0))
    271255      (movq (@ 'thing (% fn)) (% arg_y))
    272       (movq (@ 'dcode (% fn)) (% xfn))
    273256      (set-nargs 2)
    274       (xchgq (% xfn) (% fn))
    275       (jmp (% fn))))))
    276 
    277 
    278 
    279 
     257      (jmp (@ 'dcode (% fn)))))))
     258
     259
     260
     261
  • branches/x8664-call/ccl/level-0/X86/x86-def.lisp

    r6305 r6370  
    9292  (jmp-subprim .SPvalues))
    9393 
    94 
    9594       
    9695
     
    156155
    157156(defx86lapfunction %fixnum-ref ((fixnum arg_y) #| &optional |# (offset arg_z))
     157  (:arglist (fixnum &optional offset))
    158158  (check-nargs 1 2)
    159159  (cmpw ($ x8664::fixnumone) (% nargs))
     
    167167
    168168(defx86lapfunction %fixnum-ref-natural ((fixnum arg_y) #| &optional |# (offset arg_z))
     169  (:arglist (fixnum &optional offset))
    169170  (check-nargs 1 2)
    170171  (cmpw ($ x8664::fixnumone) (% nargs))
     
    178179
    179180(defx86lapfunction %fixnum-set ((fixnum arg_x) (offset arg_y) #| &optional |# (new-value arg_z))
     181  (:arglist (fixnum offset &optional newval))
    180182  (check-nargs 2 3)
    181183  (cmpw ($ '2) (% nargs))
     
    190192
    191193
    192 
    193194(defx86lapfunction %fixnum-set-natural ((fixnum arg_x) (offset arg_y) #| &optional |# (new-value arg_z))
     195  (:arglist (fixnum offset &optional newval))
    194196  (check-nargs 2 3)
    195197  (save-simple-frame)
     
    223225  (single-value-return))
    224226
    225 ;;; Look for "lea -nnnn(%rip),%fn" AT the tra; if that's
    226 ;;; present, use the dispacement -nnnn to find the function.
    227 ;;; The end of the encoded displacement is 7 bytes from the
    228 ;;; tra.
     227;;; Look for "lea -nnnn(%rip),%fn" AT the tra; if that's present, use
     228;;; the dispacement -nnnn to find the function.  The end of the
     229;;; encoded displacement is
     230;;; x8664::recover-fn-from-rip-disp-offset (= 7) bytes from the tra.
    229231(defx86lapfunction %return-address-function ((r arg_z))
    230232  (extract-lisptag r imm0)
     
    339341  ;;   but preserves x866::xfn/x8664::next-method-context.
    340342  ;; Jump to the function in x8664::xfn.
     343  (popq (% ra0))
    341344  (movq (% magic) (% next-method-context))
    342345  (movq (% function) (% xfn))
     
    370373  (jmp @three)
    371374  @go
    372   (xchgq (% xfn) (% fn))
    373   (jmp (% fn)))
     375  (push (% ra0))
     376  (jmp (% xfn)))
    374377
    375378(defx86lapfunction %apply-with-method-context ((magic arg_x)
     
    382385  ;;   but preserves x8664::xfn/x8664::next-method-context.
    383386  ;; Jump to the function in x8664::xfn.
    384   ;; We need to inline the "spreadargz" operation, 'cause there's no
    385   ;; good place to keep %ra0.
     387  (pop (% ra0)) 
    386388  (movq (% magic) (% x8664::next-method-context))
    387389  (movq (% function) (% x8664::xfn))
     
    420422  (je @discard-and-go)
    421423  @go
    422   (xchgq (% xfn) (% fn))
    423   (jmp (% fn))
     424  (push (% ra0))
     425  (jmp (% xfn))
    424426  @bad
    425427  (addq (% imm0) (% rsp))
     
    436438;;; entry must be in %rbp.
    437439(defx86lapfunction %apply-lexpr-tail-wise ((method arg_y) (args arg_z))
     440  (addq ($ x8664::node-size) (% rsp))   ; discard extra return address
    438441  (movq (% method) (% xfn))
    439442  (movq (% args) (% rsp))
     
    467470  (discard-reserved-frame)
    468471  @popped
    469   (xchgq (% xfn) (% fn))
    470   (jmp (% fn)))
     472  (push (% ra0))
     473  (jmp (% xfn)))
    471474
    472475
     
    484487(defun apply+ (&lap function arg1 arg2 &rest other-args)
    485488  (x86-lap-function apply+ ()
     489   (:arglist (function arg1 arg2 &rest other-args))
    486490   (check-nargs 3 nil)
    487491   (cmpw ($ '3) (% nargs))
     492   (pop (% ra0))
    488493   (ja @no-frame)
    489494   (pushq ($ x8664::reserved-frame-marker))
     
    522527   @no-discard
    523528   (load-constant funcall temp0)
     529   (push (% ra0))
    524530   (jmp-subprim .SPfuncall)
    525531   @bad                                 ; error spreading list.
     
    530536   (jmp-subprim .SPksignalerr) ))
    531537
    532 (lfun-bits #'apply+ (logior $lfbits-rest-bit
    533                             (dpb 3 $lfbits-numreq 0)))
     538
    534539
    535540;;; This needs to:
     
    540545;;;     (%rax/%xmm0) there
    541546(defx86lapfunction %do-ff-call ((nfp 0) (frame arg_x) (fp-regs arg_y) (entry arg_z))
     547  (popq (% ra0))
    542548  (popq (% rax))
    543   (movq (% rbp) (@ @ (% rsp)))
     549  (movq (% rbp) (@ (% rsp)))
    544550  (movq (% rsp) (% rbp))
    545551  (movq (% ra0) (@ 8 (% rbp)))
  • branches/x8664-call/ccl/level-0/X86/x86-float.lisp

    r5627 r6370  
    3434
    3535
    36 (defx86lapfunction %make-float-from-fixnums ((float 8)(hi 0) (lo arg_x) (exp arg_y) (sign arg_z))
     36(defx86lapfunction %make-float-from-fixnums ((float 16 )(hi 8) #|(ra 0)|#(lo arg_x) (exp arg_y) (sign arg_z))
    3737  (mov (% sign) (% imm1))
    3838  (sar ($ 63) (% imm1))
    3939  (shl ($ 63) (% imm1))
    40   (pop (% imm0))                        ;hi
     40  (movq (@ hi (% rsp)) (% imm0))                        ;hi
    4141  (andl ($ (ash (1- (ash 1 24)) x8664::fixnumshift)) (%l imm0))
    4242  (shl ($ (- 28 x8664::fixnumshift)) (% imm0))
     
    4848  (shl ($ (- ieee-double-float-exponent-offset x8664::fixnumshift)) (% imm0))
    4949  (or (% imm0) (% imm1))
    50   (pop (% arg_z))
     50  (movq (@ float (% rsp)) (% arg_z))
    5151  (mov (% imm1) (@ x8664::double-float.value (% arg_z)))
    52   (discard-reserved-frame)                  ; discard empty frame
    53   (single-value-return))
     52  (single-value-return 4))
    5453
    5554
  • branches/x8664-call/ccl/level-0/X86/x86-misc.lisp

    r6180 r6370  
    2727;;; Does no arg checking of any kind.  Really.
    2828
    29 (defx86lapfunction %copy-ptr-to-ivector ((src (* 1 x8664::node-size) )
    30                                          (src-byte-offset 0)
     29(defx86lapfunction %copy-ptr-to-ivector ((src (* 2 x8664::node-size) )
     30                                         (src-byte-offset (* 1 x8664::node-size))
     31                                         #|(ra 0)|#
    3132                                         (dest arg_x)
    3233                                         (dest-byte-offset arg_y)
     
    3536        (rsrc-byte-offset temp1))
    3637    (testq (% nbytes) (% nbytes))
    37     (popq (% rsrc-byte-offset))         ; boxed src-byte-offset
    38     (popq (% rsrc))                     ; src macptr
     38    (movq (@ src-byte-offset (% rsp)) (% rsrc-byte-offset))         ; boxed src-byte-offset
     39    (movq (@ src (% rsp)) (% rsrc))     ; src macptr
    3940    (jmp @test)
    4041    @loop
     
    5051    (jne @loop)
    5152    (movq (% dest) (% arg_z))
    52     (discard-reserved-frame)
    53     (single-value-return)))
    54 
    55 (defx86lapfunction %copy-ivector-to-ptr ((src (* 1 x8664::node-size))
    56                                          (src-byte-offset 0)
     53    (single-value-return 4)))
     54
     55(defx86lapfunction %copy-ivector-to-ptr ((src (* 2 x8664::node-size))
     56                                         (src-byte-offset (* 1 x8664::node-size))
     57                                         #|(ra 0)|#
    5758                                         (dest arg_x)
    5859                                         (dest-byte-offset arg_y)
     
    6162        (rsrc-byte-offset temp1))
    6263    (testq (% nbytes) (% nbytes))
    63     (popq (% rsrc-byte-offset))
    64     (popq (% rsrc))
     64    (movq (@ src-byte-offset (% rsp)) (% rsrc-byte-offset))
     65    (movq (@ src (% rsp)) (% rsrc))
    6566    (jmp @test)
    6667    @loop
     
    7677    (jne @loop)
    7778    (movq (% dest) (% arg_z))
    78     (discard-reserved-frame)
    79     (single-value-return)))
    80 
    81 
    82 
    83 (defx86lapfunction %copy-ivector-to-ivector ((src-offset 8)
    84                                              (src-byte-offset 0)
     79    (single-value-return 4)))
     80
     81
     82
     83(defx86lapfunction %copy-ivector-to-ivector ((src-offset 16)
     84                                             (src-byte-offset 8)
     85                                             #|(ra 0)|#
    8586                                             (dest arg_x)
    8687                                             (dest-byte-offset arg_y)
     
    8889  (let ((rsrc temp0)
    8990        (rsrc-byte-offset temp1))
    90     (pop (% rsrc-byte-offset))
    91     (pop (% rsrc))
     91    (movq (@ src-byte-offset (% rsp)) (% rsrc-byte-offset))
     92    (movq (@ src-offset (% rsp)) (% rsrc))
    9293    (cmpq (% dest) (% rsrc))
    9394    (jne @front)
     
    108109    (jne @front-loop)
    109110    (movq (% dest) (% arg_z))
    110     (discard-reserved-frame)
    111     (single-value-return)
     111    (single-value-return 4)
    112112    @back
    113113    (addq (% nbytes) (% rsrc-byte-offset))
     
    126126    (jne @back-loop)
    127127    (movq (% dest) (% arg_z))
    128     (discard-reserved-frame)
    129     (single-value-return)))
     128    (single-value-return 4)))
    130129 
    131130
    132 (defx86lapfunction %copy-gvector-to-gvector ((src (* 1 x8664::node-size))
    133                                              (src-element 0)
     131(defx86lapfunction %copy-gvector-to-gvector ((src (* 2 x8664::node-size))
     132                                             (src-element (* 1 x8664::node-size))
     133                                             #|(ra 0)|#
    134134                                             (dest arg_x)
    135135                                             (dest-element arg_y)
     
    138138        (rsrc-element imm1)
    139139        (val temp1))
    140     (popq (% rsrc-element))
    141     (popq (% rsrc))
     140    (movq (@ src-element (% rsp)) (% rsrc-element))
     141    (movq (@ src (% rsp)) (% rsrc))
    142142    (cmpq (% rsrc) (% dest))
    143143    (jne @front)
     
    156156    (jne @front-loop)
    157157    (movq (% dest) (% arg_z))
    158     (discard-reserved-frame)
    159     (single-value-return)
     158    (single-value-return 4)
    160159    @back
    161160    (addq (% nelements) (% rsrc-element))
     
    172171    (jne @back-loop)
    173172    (movq (% dest) (% arg_z))
    174     (discard-reserved-frame)
    175     (single-value-return)))
     173    (single-value-return 4)))
    176174
    177175(defx86lapfunction %heap-bytes-allocated ()
     
    192190(defx86lapfunction values ()
    193191  (:arglist (&rest values))
     192  (save-frame-variable-arg-count)
    194193  (push-argregs)
    195   (movzwl (%w nargs) (%l nargs))
    196   (rcmpw (% nargs) ($ '3))
    197   (lea (@ (% rsp) (%q nargs)) (% temp0))
    198   (lea (@ '2 (% temp0)) (% temp1))
    199   (cmovaq (% temp1) (% temp0))
    200   (jmp-subprim .SPvalues))
     194  (jmp-subprim .SPnvalret))
    201195
    202196(defx86lapfunction rdtsc ()
     
    327321
    328322;;; This needs to be done out-of-line, to handle EGC memoization.
    329 (defx86lapfunction %store-node-conditional ((offset 0) (object arg_x) (old arg_y) (new arg_z))
    330   (pop (% temp0))
    331   (discard-reserved-frame)
    332   (jmp-subprim .SPstore-node-conditional))
    333 
    334 (defx86lapfunction %store-immediate-conditional ((offset 0) (object arg_x) (old arg_y) (new arg_z))
    335   (pop (% temp0))
    336   (discard-reserved-frame)
     323(defx86lapfunction %store-node-conditional ((offset 8) #|(ra 0)|# (object arg_x) (old arg_y) (new arg_z))
     324  (movq (@ offset (% rsp)) (% temp0))
     325  (save-simple-frame)
     326  (call-subprim .SPstore-node-conditional)
     327  (restore-simple-frame)
     328  (single-value-return 3))
     329
     330(defx86lapfunction %store-immediate-conditional ((offset 8) #|(ra 0)|# (object arg_x) (old arg_y) (new arg_z))
     331  (movq (@ offset (% rsp)) (% temp0))
    337332  (unbox-fixnum temp0 imm1)
    338333  @again
     
    344339  (jne @again)
    345340  (movl ($ x8664::t-value) (%l arg_z))
    346   (single-value-return)
     341  (single-value-return 3)
    347342  @lose
    348343  (movl ($ x8664::nil-value) (%l arg_z))
    349   (single-value-return))
     344  (single-value-return 3))
    350345
    351346(defx86lapfunction set-%gcable-macptrs% ((ptr x8664::arg_z))
     
    744739  (jmp done)
    745740  (:tra done)
     741  (recover-fn-from-rip)
    746742  (movq ($ 0) (@ (% :rcontext) x8664::tcr.safe-ref-address))
    747743  (movq (% imm0) (@ x8664::macptr.address (% dest)))
     
    749745  (single-value-return))
    750746
     747;;; This was intentded to work around a bug in #_nanosleep in early
     748;;; Leopard test releases.  It's probably not necessary any more; is
     749;;; it still called ?
    751750(defx86lapfunction %valid-remaining-timespec-time-p ((seconds arg_y) (ptr arg_z))
    752751  (macptr-ptr arg_z imm0)
  • branches/x8664-call/ccl/level-0/X86/x86-numbers.lisp

    r6010 r6370  
    2929  (single-value-return))
    3030
    31 ;;; see %logcount (ppc-bignum.lisp)
     31;;; see %logcount.
    3232(defx86lapfunction %ilogcount ((number arg_z))
    3333  (let ((rshift imm0)
     
    4848  (unbox-fixnum count imm1)
    4949  (unbox-fixnum number imm0)
    50   (xorq (% rcx) (% rcx))                ;rcx = temp1
     50  (xorq (% rcx) (% rcx))                ;rcx = temp2
    5151  (testq (% count) (% count))
    5252  (jge @left)
     
    136136  (cmoveq (% imm0) (% arg_z))
    137137  (single-value-return))
    138  
    139 
    140 
    141 
    142138
    143139
  • branches/x8664-call/ccl/level-0/X86/x86-pred.lisp

    r6302 r6370  
    7171  (movq (@ x8664::ratio.numer (% x)) (% x))       ; aka complex.realpart
    7272  (movq (@ x8664::ratio.numer (% y)) (% y))       ; aka complex.realpart
    73   (lea (@ (:^ @back) (% fn)) (% ra0))
    74   (jmp @top)
    75   (:tra @back)
     73  (:talign 3)
     74  (call @top)
    7675  (recover-fn-from-rip)
    7776  (cmp-reg-to-nil arg_z)
     
    142141  (movq (% temp0) (% x))
    143142  (movq (% temp1) (% y))
    144   (lea (@ (:^ @back) (% fn)) (% ra0))
    145   (jmp @top)
    146   (:tra @back)
     143  (:talign 4)
     144  (call @top)
    147145  (recover-fn-from-rip)
    148146  (cmp-reg-to-nil arg_z)
  • branches/x8664-call/ccl/level-0/X86/x86-utils.lisp

    r6303 r6370  
    120120    (movq (% obj) (% prev))
    121121    (movq (% obj) (% arg_z))
    122     (lea (@ (:^ @back-from-misc) (% fn)) (% ra0))
    123122    (set-nargs 1)
    124     (movq (% fun) (% fn))
    125     (jmp (% fn))
    126     (:tra @back-from-misc)
     123    (:talign 4)
     124    (call (% fun))
    127125    (recover-fn-from-rip)
    128126    (getvheader obj imm1)
     
    166164    (movq (% obj) (% arg_z))
    167165    (set-nargs 1)
    168     (lea (@ (:^ @back-from-cons) (% fn)) (% ra0))
    169     (movq (% fun) (% fn))
    170     (jmp (% fn))
    171     (:tra @back-from-cons)
     166    (:talign 4)
     167    (call (% fun))
    172168    (recover-fn-from-rip)
    173169    (addq ($ (- x8664::cons.size x8664::fulltag-cons)) (% obj))
     
    246242    (movq (% obj) (% arg_z))
    247243    (movq (% obj) (% prev))
    248     (lea (@ (:^ @back-from-misc) (% fn)) (% ra0))
    249244    (set-nargs 1)
    250     (movq (% fun) (% fn))
    251     (jmp (% fn))
    252     (:tra @back-from-misc)
     245    (:talign 4)
     246    (call (% fun))
    253247    (recover-fn-from-rip)
    254248    (getvheader obj imm1)
     
    294288    (movq (% obj) (% prev))
    295289    (set-nargs 1)
    296     (lea (@ (:^ @back-from-cons) (% fn)) (% ra0))
    297     (movq (% fun) (% fn))
    298     (jmp (% fn))
    299     (:tra @back-from-cons)
     290    (:talign 4)
     291    (call (% fun))
    300292    (recover-fn-from-rip)
    301293    (addq ($ (- x8664::cons.size x8664::fulltag-cons)) (% obj))
     
    351343  (cmpb ($ x8664::fulltag-function) (%b imm0))
    352344  (jne @ret)
    353   (xchgq (% temp0)(% fn))
    354345  (set-nargs 1)
    355   (jmp (% fn))
     346  (jmp (% temp0))
    356347  @bad
    357   (movq (@ 'no-class-error (% fn)) (% fname))
     348  (load-constant no-class-error fname)
    358349  (set-nargs 1)
    359   (movq (% fn) (% xfn))
    360   (movq (@ x8664::symbol.fcell (% fname)) (% fn))
    361   (jmp (% fn))
     350  (jmp  (@ x8664::symbol.fcell (% fname)))
    362351  @ret
    363352  (movq (% temp0) (% arg_z))  ; return frob from table
Note: See TracChangeset for help on using the changeset viewer.