Changeset 6477


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

New calling sequence. %rcx is %imm2 now, not %temp2, and no need
to be so careful with it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-0/X86/x86-clos.lisp

    r5947 r6477  
    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))
     169      (save-frame-variable-arg-count)
     170      (push-argregs)
     171      (movzwl (% nargs) (%l nargs))
     172      (pushq (%q nargs))
     173      (movq (% rsp) (% arg_z))
     174      (ref-global.l ret1valaddr imm0)
     175      (cmpq (% ra0) (% imm0))
     176      (je @multiple)
     177      (ref-global.l lexpr-return1v ra0)
     178      (jmp @call)
     179      @multiple
     180      (pushq (@ (+ x8664::nil-value (x8664::%kernel-global 'lexpr-return))))
     181      (movq (% imm0) (% ra0))
     182      @call
     183      (push (% ra0))
     184      (movq (@ 'dispatch-table (% fn)) (% arg_y))
     185      (set-nargs 2)
     186      (jmp (@ 'dcode (% fn)))  ; dcode function
     187      ))))
     188
     189;;; is a winner - saves ~15%
     190(defx86lapfunction gag-one-arg ((arg arg_z))
     191  (:fixed-constants (class-wrapper slots dispatch-table dcode hash))
     192  (:code-size x8664::gf-code-size)
     193  (check-nargs 1)
     194  (movq (@ 'dispatch-table (% fn)) (% arg_y))
     195  (set-nargs 2)
     196  (jmp (@ 'dcode (% fn))))
     197
     198(defx86lapfunction gag-two-arg ((arg0 arg_y) (arg1 arg_z))
     199  (:fixed-constants (class-wrapper slots dispatch-table dcode hash))
     200  (:code-size x8664::gf-code-size)
     201  (check-nargs 2)
     202  (movq (@ 'dispatch-table (% fn)) (% arg_x))
     203  (set-nargs 3)
     204  (jmp (@ 'dcode (% fn))))
     205
     206
     207(defx86lapfunction funcallable-trampoline ()
     208  (:fixed-constants (class-wrapper slots dispatch-table dcode hash))
     209  (:code-size x8664::gf-code-size)
     210  (jmp (@ 'dcode (% fn))))
     211
     212
     213;;; This is in LAP so that it can reference itself in the error message.
     214;;; (It needs to be cloned, so %fn will be unique to each copy.)
     215;;; It can't work for this to reference any of its own constants.
     216(defx86lapfunction unset-fin-trampoline ()
     217  (:code-size x8664::gf-code-size)
     218  (save-frame-variable-arg-count)
     219  (call-subprim .SPheap-rest-arg)
     220  (pop (% arg_z))
     221  (movq ($ '#.$XNOFINFUNCTION) (% arg_x))
     222  (movq (% fn) (% arg_y))
     223  (set-nargs 3)
     224  (call-subprim .SPksignalerr)
     225  ;(movq ($ x8664::nil-value) (% arg_z))
     226  (leave)
     227  (single-value-return))
     228
     229
     230
     231(defparameter *cm-proto*
     232  (nfunction
     233   gag
     234   (lambda (&lap &lexpr args)
     235     (x86-lap-function
     236      gag
     237      ()
     238      (:fixed-constants (thing dcode gf bits))
     239      (movq (@ (% rsp)) (% ra0))
    180240      (save-frame-variable-arg-count)
    181241      (push-argregs)
     
    192252      (movq (% imm0) (% ra0))
    193253      @call
    194       (movq (@ 'dispatch-table (% fn)) (% arg_y))
     254      (push (% ra0))
     255      (movq (@ 'thing (% fn)) (% arg_y))
    195256      (set-nargs 2)
    196       (movq (@ 'dcode (% fn)) (% xfn))  ; dcode function
    197       (xchgq (% xfn) (% fn))
    198       (jmp (% fn))))))
    199 
    200 ;;; is a winner - saves ~15%
    201 (defx86lapfunction gag-one-arg ((arg arg_z))
    202   (:fixed-constants (class-wrapper slots dispatch-table dcode hash))
    203   (:code-size x8664::gf-code-size)
    204   (check-nargs 1)
    205   (movq (@ 'dispatch-table (% fn)) (% arg_y))
    206   (set-nargs 2)
    207   (movq (% fn) (% xfn))               ; don't let %fn get GCed
    208   (movq (@ 'dcode (% fn)) (% fn))
    209   (jmp (% fn)))
    210 
    211 (defx86lapfunction gag-two-arg ((arg0 arg_y) (arg1 arg_z))
    212   (:fixed-constants (class-wrapper slots dispatch-table dcode hash))
    213   (:code-size x8664::gf-code-size)
    214   (check-nargs 2)
    215   (movq (@ 'dispatch-table (% fn)) (% arg_x))
    216   (set-nargs 3)
    217   (movq (% fn) (% xfn))               ; don't let %fn get GCed
    218   (movq (@ 'dcode (% fn)) (% fn))
    219   (jmp (% fn)))
    220 
    221 
    222 
    223 (defx86lapfunction funcallable-trampoline ()
    224   (:fixed-constants (class-wrapper slots dispatch-table dcode hash))
    225   (:code-size x8664::gf-code-size)
    226   (movq (@ 'dcode (% fn)) (% xfn))
    227   (xchgq (% fn) (% xfn))
    228   (jmp (% fn)))
    229 
    230 
    231 ;;; This is in LAP so that it can reference itself in the error message.
    232 ;;; (It needs to be cloned, so %fn will be unique to each copy.)
    233 ;;; It can't work for this to reference any of its own constants.
    234 (defx86lapfunction unset-fin-trampoline ()
    235   (:code-size x8664::gf-code-size)
    236   (save-frame-variable-arg-count)
    237   (call-subprim .SPheap-rest-arg nil)
    238   (pop (% arg_z))
    239   (movq ($ '#.$XNOFINFUNCTION) (% arg_x))
    240   (movq (% fn) (% arg_y))
    241   (set-nargs 3)
    242   (call-subprim .SPksignalerr)
    243   (movq ($ x8664::nil-value) (% arg_z))
    244   (leave)
    245   (single-value-return))
    246 
    247 
    248 
    249 (defparameter *cm-proto*
    250   (nfunction
    251    gag
    252    (lambda (&lap &lexpr args)
    253      (x86-lap-function
    254       gag
    255       ()
    256       (:fixed-constants (thing dcode gf bits))
    257       (save-frame-variable-arg-count)
    258       (push-argregs)
    259       (movzwl (% nargs) (%l nargs))
    260       (pushq (%q nargs))
    261       (movq (% rsp) (% arg_z))
    262       (ref-global ret1valaddr imm0)
    263       (cmpq (% ra0) (% imm0))
    264       (je @multiple)
    265       (ref-global lexpr-return1v ra0)
    266       (jmp @call)
    267       @multiple
    268       (pushq (@ (+ x8664::nil-value (x8664::%kernel-global 'lexpr-return))))
    269       (movq (% imm0) (% ra0))
    270       @call
    271       (movq (@ 'thing (% fn)) (% arg_y))
    272       (movq (@ 'dcode (% fn)) (% xfn))
    273       (set-nargs 2)
    274       (xchgq (% xfn) (% fn))
    275       (jmp (% fn))))))
    276 
    277 
    278 
    279 
     257      (jmp (@ 'dcode (% fn)))))))
     258
     259
     260
     261
Note: See TracChangeset for help on using the changeset viewer.