Changeset 16476


Ignore:
Timestamp:
Jul 14, 2015, 8:52:46 AM (4 years ago)
Author:
gb
Message:

Self-calls again, or at least some cases.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/lscan/source/compiler/X86/x862.lisp

    r16464 r16476  
    76067606                  (setq optsupvloc (- *x862-vstack* (* num-opt *x862-target-node-size*)))))))
    76077607          ;; Caller's context is saved; *x862-vstack* is valid.  Might
    7608          ;; still have method-var to worry about.
     7608          ;; still have method-var to worry about.
    76097609          (unless handled-lambda
    7610           (when *backend-use-linear-scan*
    7611             (! reserve-spill-area))
    7612           (! save-nfp))
     7610            (when *backend-use-linear-scan*
     7611              (! reserve-spill-area))
     7612            (! save-nfp))
    76137613          (unless (= 0 pregs)
    76147614            ;; Save NVRs; load constants into any that get constants.
     
    76367636                  *x862-tail-arg-vars* (reverse rev-fixed)
    76377637                  *x862-tail-vsp* *x862-vstack*)
    7638             (let* ((stack-arg-var (if (> max-args *x862-target-num-arg-regs*)
    7639                                     (car *x862-tail-arg-vars*))))
    7640               (when (and stack-arg-var (not (var-nvr stack-arg-var)))
    7641                 (x862-stack-to-register seg (x862-vloc-ea 0) *x862-temp0*)))
     7638            (unless *backend-use-linear-scan*
     7639              (let* ((stack-arg-var (if (> max-args *x862-target-num-arg-regs*)
     7640                                      (car *x862-tail-arg-vars*))))
     7641                (when (and stack-arg-var (not (var-nvr stack-arg-var)))
     7642                  (x862-stack-to-register seg (x862-vloc-ea 0) *x862-temp0*))))
    76427643            (setq *x862-tail-label* (backend-get-next-label)))
    76437644          (when method-var
     
    76827683                  (vinsn-list-max-spill-depth vl) nspilled)
    76837684            (unless (zerop nspilled)
    7684             ;; every var pn *x852-stack-vars* should have an lreg,
    7685             ;; and that lreg should be "pre-spilled" with a spill-offset
    7686             ;; < nspilled.  for extra credit, every potential offset < nspilled
    7687             ;; should correspond to the offset of some var.  Check these things.
    7688             (let*  ((used-offsets (make-array nspilled :element-type 'bit)))
     7685              ;; every var pn *x852-stack-vars* should have an lreg,
     7686              ;; and that lreg should be "pre-spilled" with a spill-offset
     7687              ;; < nspilled.  for extra credit, every potential offset < nspilled
     7688              ;; should correspond to the offset of some var.  Check these things.
     7689              (let*  ((used-offsets (make-array nspilled :element-type 'bit)))
    76897690                (dolist (var *x862-stack-vars*)
    76907691                  (let*  ((lreg (var-lreg var)))
     
    85568557  (x862-call-fn seg vreg xfer fn arglist spread-p))
    85578558
     8559
    85588560(defx862 x862-self-call self-call (seg vreg xfer arglist &optional spread-p)
    8559   (cond (*backend-use-linear-scan*
    8560          (break)
    8561          )
    8562         (t
    8563          (progn
    8564            (setq arglist (x862-augment-arglist *x862-cur-afunc* arglist (if spread-p 1 *x862-target-num-arg-regs*)))
    8565            (let* ((nargs *x862-tail-nargs*))
    8566              (if (and nargs (x862-tailcallok xfer) (not spread-p)
    8567                       (eql nargs (+ (length (car arglist))
    8568                                     (length (cadr arglist)))))
    8569                (let* ((forms (append (car arglist) (reverse (cadr arglist))))
    8570                       (vars *x862-tail-arg-vars*)
    8571                       (regs (ecase nargs
     8561  (setq arglist (x862-augment-arglist *x862-cur-afunc* arglist (if spread-p 1 *x862-target-num-arg-regs*)))
     8562  (let* ((nargs *x862-tail-nargs*))
     8563    (if (and nargs (x862-tailcallok xfer) (not spread-p)
     8564             (eql nargs (+ (length (car arglist))
     8565                           (length (cadr arglist)))))
     8566      (let* ((forms (append (car arglist) (reverse (cadr arglist))))
     8567             (vars *x862-tail-arg-vars*))
     8568        (cond (*backend-use-linear-scan*
     8569               (let* ((push-later ()))
     8570               (case nargs
     8571                 (0)
     8572                 (1 (x862-one-targeted-reg-form seg (car forms) ($ x8664::arg_z)))
     8573                 (2 (x862-two-targeted-reg-forms seg (car forms) ($ x8664::arg_y) (cadr forms)($ x8664::arg_z)))
     8574                 (3 (x862-three-targeted-reg-forms seg (car forms) ($ x8664::arg_x) (cadr forms)($ x8664::arg_y) (caddr forms) ($ x8664::arg_z)))
     8575                 (4 (push (x862-four-targeted-reg-forms seg (car forms) ($ x8664::temp0) (cadr forms) ($ x8664::arg_x) (caddr forms)($ x8664::arg_y) (cadddr forms) ($ x8664::arg_z)) push-later))
     8576                 (t (linear-scan-bailout "too many args in self tail call")))
     8577               (! reuse-frame)
     8578               (dolist (later push-later) (x862-vpush-register seg later))
     8579               (! prepare-tail-call)
     8580               (! jump (aref *backend-labels* *x862-fixed-self-tail-call-label*))
     8581               ))
     8582              (t
     8583               (let* ((regs (ecase nargs
    85728584                              (0 ())
    85738585                              (1 (list ($ *x862-arg-z*)))
     
    86358647                   (unless (eql 0 diff)
    86368648                     (! adjust-vsp diff))
    8637                    (! jump (aref *backend-labels* *x862-tail-label*))))
    8638                (x862-call-fn seg vreg xfer -2 arglist spread-p)))))))
     8649                   (! jump (aref *backend-labels* *x862-tail-label*))))))
     8650        (x862-call-fn seg vreg xfer -2 arglist spread-p)))))
     8651
     8652
    86398653
    86408654
Note: See TracChangeset for help on using the changeset viewer.