Changeset 14695


Ignore:
Timestamp:
Mar 23, 2011, 9:41:10 PM (9 years ago)
Author:
gb
Message:

In x862-%ilog[ior|and|xor]2 (and in some subset of the analogous
functions in the PPC and ARM backends), misparenthesization caused
a runtime operation to be performed even when both args were constants
(and the constant had already been referenced.) On x86, this caused
extra problems when the vreg was the special :PUSH token (the value
was pushed twice, causing problems like those described in ticket:837.

The code in that example should never have been called; the constant-
folding should have been handled earlier (by
ACODE-CONSTANT-FOLD-INTEGER-BINOP.) Unfortunately, that function was
trying to do arithmetic on acode expressions, not on the constant values
that those expressions might represent.

Location:
trunk/source/compiler
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/ARM/arm2.lisp

    r14558 r14695  
    54175417         (fix2 (acode-fixnum-form-p form2)))
    54185418    (if (and fix1 fix2)
    5419       (arm2-use-operator (%nx1-operator fixnum) seg vreg xfer (logior fix1 fix2)))
    5420     (let* ((fixval (or fix1 fix2))
     5419      (arm2-use-operator (%nx1-operator fixnum) seg vreg xfer (logior fix1 fix2))
     5420      (let* ((fixval (or fix1 fix2))
    54215421           (unboxed-fixval (if fixval (ash fixval *arm2-target-fixnum-shift*)))
    54225422           (ok-imm (and unboxed-fixval
     
    54305430        (multiple-value-bind (r1 r2) (arm2-two-untargeted-reg-forms seg form1 arm::arg_y form2 arm::arg_z)
    54315431          (if vreg (ensuring-node-target (target vreg) (! %logior2 target r1 r2)))))   
    5432       (^))))
     5432      (^)))))
    54335433
    54345434
     
    54595459         (fix2 (acode-fixnum-form-p form2)))
    54605460    (if (and fix1 fix2)
    5461       (arm2-use-operator (%nx1-operator fixnum) seg vreg xfer (logxor fix1 fix2)))
     5461      (arm2-use-operator (%nx1-operator fixnum) seg vreg xfer (logxor fix1 fix2))
    54625462    (let* ((fixval (or fix1 fix2))
    54635463           (unboxed-fixval (if fixval (ash fixval *arm2-target-fixnum-shift*)))
     
    54715471        (multiple-value-bind (r1 r2) (arm2-two-untargeted-reg-forms seg form1 arm::arg_y form2 arm::arg_z)
    54725472          (if vreg (ensuring-node-target (target vreg) (! %logxor2 vreg r1 r2)))))
    5473       (^))))
     5473      (^)))))
    54745474
    54755475(defarm2 arm2-%ineg %ineg (seg vreg xfer n)
  • trunk/source/compiler/PPC/ppc2.lisp

    r14417 r14695  
    56335633         (fix2 (acode-fixnum-form-p form2)))
    56345634    (if (and fix1 fix2)
    5635       (ppc2-use-operator (%nx1-operator fixnum) seg vreg xfer (logior fix1 fix2)))
     5635      (ppc2-use-operator (%nx1-operator fixnum) seg vreg xfer (logior fix1 fix2))
    56365636    (let* ((fixval (or fix1 fix2))
    56375637           (unboxed-fixval (if fixval (ash fixval *ppc2-target-fixnum-shift*)))
     
    56485648        (multiple-value-bind (r1 r2) (ppc2-two-untargeted-reg-forms seg form1 ppc::arg_y form2 ppc::arg_z)
    56495649          (if vreg (ensuring-node-target (target vreg) (! %logior2 target r1 r2)))))   
    5650       (^))))
     5650      (^)))))
    56515651
    56525652;;; in a lot of (typical ?) cases, it might be possible to use a
     
    56905690         (fix2 (acode-fixnum-form-p form2)))
    56915691    (if (and fix1 fix2)
    5692       (ppc2-use-operator (%nx1-operator fixnum) seg vreg xfer (logxor fix1 fix2)))
    5693     (let* ((fixval (or fix1 fix2))
     5692      (ppc2-use-operator (%nx1-operator fixnum) seg vreg xfer (logxor fix1 fix2))
     5693      (let* ((fixval (or fix1 fix2))
    56945694           (unboxed-fixval (if fixval (ash fixval *ppc2-target-fixnum-shift*)))
    56955695           (high (if fixval (if (= unboxed-fixval (logand #xffff0000 unboxed-fixval)) (ash unboxed-fixval -16))))
     
    57055705        (multiple-value-bind (r1 r2) (ppc2-two-untargeted-reg-forms seg form1 ppc::arg_y form2 ppc::arg_z)
    57065706          (if vreg (ensuring-node-target (target vreg) (! %logxor2 vreg r1 r2)))))
    5707       (^))))
     5707      (^)))))
    57085708
    57095709(defppc2 ppc2-%ineg %ineg (seg vreg xfer n)
  • trunk/source/compiler/X86/x862.lisp

    r14417 r14695  
    66166616         (fix2 (acode-fixnum-form-p form2)))
    66176617    (if (and fix1 fix2)
    6618       (x862-use-operator (%nx1-operator fixnum) seg vreg xfer (logior fix1 fix2)))
    6619     (let* ((fixval (or fix1 fix2))
    6620            (fiximm (if fixval (<= (integer-length fixval)
    6621                                   (- 31 *x862-target-fixnum-shift*))))
    6622            (otherform (when fiximm (if fix1 form2 form1))))
    6623       (if otherform
    6624         (if (null vreg)
    6625           (x862-form seg nil xfer otherform)
    6626           (ensuring-node-target (target vreg)
    6627             (x862-one-targeted-reg-form seg otherform target)
    6628             (! %logior-c target target (ash fixval *x862-target-fixnum-shift*))))
    6629          (multiple-value-bind (r1 r2) (x862-two-untargeted-reg-forms seg form1 *x862-arg-y* form2 *x862-arg-z*)
     6618      (x862-use-operator (%nx1-operator fixnum) seg vreg xfer (logior fix1 fix2))
     6619      (let* ((fixval (or fix1 fix2))
     6620             (fiximm (if fixval (<= (integer-length fixval)
     6621                                    (- 31 *x862-target-fixnum-shift*))))
     6622             (otherform (when fiximm (if fix1 form2 form1))))
     6623        (if otherform
     6624          (if (null vreg)
     6625            (x862-form seg nil xfer otherform)
     6626            (ensuring-node-target (target vreg)
     6627              (x862-one-targeted-reg-form seg otherform target)
     6628              (! %logior-c target target (ash fixval *x862-target-fixnum-shift*))))
     6629          (multiple-value-bind (r1 r2) (x862-two-untargeted-reg-forms seg form1 *x862-arg-y* form2 *x862-arg-z*)
    66306630            (if vreg (ensuring-node-target (target vreg) (! %logior2 target r1 r2)))))
    6631       (^))))
     6631        (^)))))
    66326632
    66336633;;; in a lot of (typical ?) cases, it might be possible to use a
     
    66386638         (fix2 (acode-fixnum-form-p form2)))
    66396639    (if (and fix1 fix2)
    6640       (x862-use-operator (%nx1-operator fixnum) seg vreg xfer (logand fix1 fix2)))
     6640      (x862-use-operator (%nx1-operator fixnum) seg vreg xfer (logand fix1 fix2))
    66416641    (let* ((fixval (or fix1 fix2))
    66426642           (fiximm (if fixval (<= (integer-length fixval)
     
    66516651        (multiple-value-bind (r1 r2) (x862-two-untargeted-reg-forms seg form1 *x862-arg-y* form2 *x862-arg-z*)
    66526652          (if vreg (ensuring-node-target (target vreg) (! %logand2 target r1 r2)))))
    6653       (^))))
     6653      (^)))))
    66546654
    66556655(defx862 x862-%ilogxor2 %ilogxor2 (seg vreg xfer form1 form2)
     
    66576657         (fix2 (acode-fixnum-form-p form2)))
    66586658    (if (and fix1 fix2)
    6659       (x862-use-operator (%nx1-operator fixnum) seg vreg xfer (logxor fix1 fix2)))
    6660     (let* ((fixval (or fix1 fix2))
    6661            (fiximm (if fixval (<= (integer-length fixval)
    6662                                   (- 31 *x862-target-fixnum-shift*))))
    6663            (otherform (when fiximm (if fix1 form2 form1))))
    6664       (if otherform
    6665         (if (null vreg)
    6666           (x862-form seg nil xfer otherform)
    6667           (ensuring-node-target (target vreg)
    6668             (x862-one-targeted-reg-form seg otherform target)
    6669             (! %logxor-c target target (ash fixval *x862-target-fixnum-shift*))))
    6670          (multiple-value-bind (r1 r2) (x862-two-untargeted-reg-forms seg form1 *x862-arg-y* form2 *x862-arg-z*)
     6659      (x862-use-operator (%nx1-operator fixnum) seg vreg xfer (logxor fix1 fix2))
     6660      (let* ((fixval (or fix1 fix2))
     6661             (fiximm (if fixval (<= (integer-length fixval)
     6662                                    (- 31 *x862-target-fixnum-shift*))))
     6663             (otherform (when fiximm (if fix1 form2 form1))))
     6664        (if otherform
     6665          (if (null vreg)
     6666            (x862-form seg nil xfer otherform)
     6667            (ensuring-node-target (target vreg)
     6668              (x862-one-targeted-reg-form seg otherform target)
     6669              (! %logxor-c target target (ash fixval *x862-target-fixnum-shift*))))
     6670          (multiple-value-bind (r1 r2) (x862-two-untargeted-reg-forms seg form1 *x862-arg-y* form2 *x862-arg-z*)
    66716671            (if vreg (ensuring-node-target (target vreg) (! %logxor2 target r1 r2)))))
    6672       (^))))
     6672        (^)))))
    66736673
    66746674(defx862 x862-%ineg %ineg (seg vreg xfer n)
  • trunk/source/compiler/nx2.lisp

    r14348 r14695  
    282282  (let* ((const-x (acode-integer-form-p x))
    283283         (const-y (acode-integer-form-p y))
    284          (result (and const-x const-y (ignore-errors (funcall function x y)))))
     284         (result (and const-x const-y (ignore-errors (funcall function const-x const-y)))))
    285285    (when result
    286286      (backend-use-operator (if (nx1-target-fixnump result)
     
    436436(defun acode-optimize-logior2 (seg vreg xfer num1 num2 trust-decls &optional (result-type 'integer))
    437437  (declare (ignorable result-type))
    438   (or (acode-constant-fold-integer-binop seg vreg xfer num1 num2 'logior)
     438  (or (and nil (acode-constant-fold-integer-binop seg vreg xfer num1 num2 'logior))
    439439      (let* ((unsigned-natural-type *nx-target-natural-type*)
    440440             (target-fixnum-type *nx-target-fixnum-type*))
Note: See TracChangeset for help on using the changeset viewer.