Remove combination-implementation-style.

This commit is contained in:
Stas Boukarev 2024-03-06 17:38:23 +03:00
parent 9ed74fa10a
commit 564aef8890
16 changed files with 13 additions and 90 deletions

View file

@ -195,31 +195,6 @@ To do this, extend ALLOCATE-VECTOR with ALLOW-JUNK argument, and when
stack allocating don't zero if it is true -- and probably ALLOW-JUNK iff stack allocating don't zero if it is true -- and probably ALLOW-JUNK iff
the vector is a specialized one (cannot have pointers.) the vector is a specialized one (cannot have pointers.)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
#29
Python is overly zealous when converting high-level CL functions, such
as MIN/MAX, LOGBITP, and LOGTEST, to low-level CL functions. Reducing
Python's aggressiveness would make it easier to effect changes such as
x86-64:
* direct MIN/MAX on {SINGLE,DOUBLE}-FLOATs ({MIN,MAX}S{S,D})
x86-64:
* direct LOGBITP on word-sized integers and fixnums (BT + JC)
x86{,-64}/PPC:
* branch-free MIN/MAX on word-sized integers and fixnums (floats could
be handled too, modulo safety considerations on the PPC)
x86-64:
* efficient LOGTESTs on word-sized integers and fixnums (TEST)
etc., etc.
(The framework for this has been implemented as of 0.9.9.18; see the
vm-support-routine COMBINATION-IMPLEMENTATION-STYLE and its use in
src/compiler/ir1opt.lisp, IR1-OPTIMIZE-COMBINATION. The above
optimizations are left as an exercise for the reader.)
--------------------------------------------------------------------------------
#31 #31
The typecheck generated for a declaration like (integer 0 45) on x86 looks The typecheck generated for a declaration like (integer 0 45) on x86 looks
like: like:

View file

@ -1448,7 +1448,6 @@ like *STACK-TOP-HINT* and unsupported stuff like *TRACED-FUN-LIST*.")
"CHANGE-VOP-FLAGS" "CONDITIONAL-FLAGS-FLAGS" "CHANGE-VOP-FLAGS" "CONDITIONAL-FLAGS-FLAGS"
"IMMEDIATE-CONSTANT-SC" "IMMEDIATE-CONSTANT-SC"
"BOXED-IMMEDIATE-SC-P" "BOXED-IMMEDIATE-SC-P"
"COMBINATION-IMPLEMENTATION-STYLE"
"CONVERT-CONDITIONAL-MOVE-P" "CONVERT-CONDITIONAL-MOVE-P"
"LOCATION-PRINT-NAME" "LOCATION-PRINT-NAME"
"MAKE-CALL-OUT-TNS" "MAKE-CALL-OUT-TNS"

View file

@ -285,10 +285,6 @@
(immediate-constant "Immed") (immediate-constant "Immed")
(float-registers (format nil "F~D" offset))))) (float-registers (format nil "F~D" offset)))))
(defun combination-implementation-style (node)
(declare (ignore node))
(values :default nil))
(defun primitive-type-indirect-cell-type (ptype) (defun primitive-type-indirect-cell-type (ptype)
(declare (ignore ptype)) (declare (ignore ptype))
nil) nil)

View file

@ -314,9 +314,6 @@
((double-reg complex-single-reg) "D") ((double-reg complex-single-reg) "D")
(complex-double-reg "Q")) (complex-double-reg "Q"))
offset))))) offset)))))
(defun combination-implementation-style (node)
(declare (ignore node))
(values :default nil))
(defun primitive-type-indirect-cell-type (ptype) (defun primitive-type-indirect-cell-type (ptype)
(declare (ignore ptype)) (declare (ignore ptype))

View file

@ -93,7 +93,6 @@
;;; from vm.lisp ;;; from vm.lisp
;;; immediate-constant-sc ;;; immediate-constant-sc
;;; location-print-name ;;; location-print-name
;;; combination-implementation-style
;;; convert-conditional-move-p ;;; convert-conditional-move-p
;;; boxed-immediate-sc-p ;;; boxed-immediate-sc-p

View file

@ -1200,27 +1200,18 @@
(let ((optimizer (fun-info-optimizer info))) (let ((optimizer (fun-info-optimizer info)))
(unless (and optimizer (funcall optimizer node)) (unless (and optimizer (funcall optimizer node))
;; First give the VM a peek at the call (dolist (x (fun-info-transforms info))
(multiple-value-bind (style) (when (eq show :all)
(combination-implementation-style node) (let* ((lvar (basic-combination-fun node))
(ecase style (fname (lvar-fun-name lvar t)))
(:direct (format *trace-output*
;; The VM knows how to handle this. "~&trying transform ~s for ~s"
) (transform-type x) fname)))
((:default :maybe) (unless (ir1-transform node x show)
;; Let transforms have a crack at it. (when (eq show :all)
(dolist (x (fun-info-transforms info)) (format *trace-output*
(when (eq show :all) "~&quitting because IR1-TRANSFORM result was NIL"))
(let* ((lvar (basic-combination-fun node)) (return))))))))))
(fname (lvar-fun-name lvar t)))
(format *trace-output*
"~&trying transform ~s for ~s"
(transform-type x) fname)))
(unless (ir1-transform node x show)
(when (eq show :all)
(format *trace-output*
"~&quitting because IR1-TRANSFORM result was NIL"))
(return)))))))))))))
(values)) (values))
(defun xep-tail-combination-p (node) (defun xep-tail-combination-p (node)

View file

@ -365,10 +365,6 @@
(constant (format nil "Const~D" offset)) (constant (format nil "Const~D" offset))
(immediate-constant "Immed")))) (immediate-constant "Immed"))))
(defun combination-implementation-style (node)
(declare (type sb-c::combination node) (ignore node))
(values :default nil))
(defun primitive-type-indirect-cell-type (ptype) (defun primitive-type-indirect-cell-type (ptype)
(declare (ignore ptype)) (declare (ignore ptype))
nil) nil)

View file

@ -869,9 +869,6 @@
(((constant-arg (mod #.n-word-bits)) word) *)) * :vop t) (((constant-arg (mod #.n-word-bits)) word) *)) * :vop t)
t) t)
;;; We only handle the constant cases because those are the only ones
;;; guaranteed to make it past COMBINATION-IMPLEMENTATION-STYLE.
;;; --njf, 06-02-2006
(define-vop (fast-logbitp-c/fixnum fast-conditional-c/fixnum) (define-vop (fast-logbitp-c/fixnum fast-conditional-c/fixnum)
(:translate logbitp) (:translate logbitp)
(:arg-types (:constant (integer 0 29)) tagged-num) (:arg-types (:constant (integer 0 29)) tagged-num)

View file

@ -335,10 +335,6 @@
(constant (format nil "Const~D" offset)) (constant (format nil "Const~D" offset))
(immediate-constant "Immed")))) (immediate-constant "Immed"))))
(defun combination-implementation-style (node)
(declare (ignore node))
(values :default nil))
(defun primitive-type-indirect-cell-type (ptype) (defun primitive-type-indirect-cell-type (ptype)
(declare (ignore ptype)) (declare (ignore ptype))
nil) nil)

View file

@ -696,9 +696,6 @@
(((constant-arg (mod #.n-word-bits)) word) *)) * :vop t) (((constant-arg (mod #.n-word-bits)) word) *)) * :vop t)
t) t)
;;; We only handle the constant cases because those are the only ones
;;; guaranteed to make it past COMBINATION-IMPLEMENTATION-STYLE.
;;; --njf, 06-02-2006
#+nil (define-vop (fast-logbitp-c/fixnum fast-conditional-c/fixnum) #+nil (define-vop (fast-logbitp-c/fixnum fast-conditional-c/fixnum)
(:translate logbitp) (:translate logbitp)
(:arg-types (:constant (integer 0 29)) tagged-num) (:arg-types (:constant (integer 0 29)) tagged-num)

View file

@ -326,10 +326,6 @@
(constant (format nil "Const~D" offset)) (constant (format nil "Const~D" offset))
(immediate-constant "Immed")))) (immediate-constant "Immed"))))
(defun combination-implementation-style (node)
(declare (type sb-c::combination node) (ignore node))
(values :default nil))
(defun primitive-type-indirect-cell-type (ptype) (defun primitive-type-indirect-cell-type (ptype)
(declare (ignore ptype)) (declare (ignore ptype))
nil) nil)

View file

@ -298,10 +298,6 @@
(constant (format nil "Const~D" offset)) (constant (format nil "Const~D" offset))
(immediate-constant "Immed")))) (immediate-constant "Immed"))))
(defun combination-implementation-style (node)
(declare (type sb-c::combination node) (ignore node))
(values :default nil))
(defun primitive-type-indirect-cell-type (ptype) (defun primitive-type-indirect-cell-type (ptype)
(declare (ignore ptype)) (declare (ignore ptype))
nil) nil)

View file

@ -360,10 +360,6 @@
(constant (format nil "Const~D" offset)) (constant (format nil "Const~D" offset))
(immediate-constant "Immed")))) (immediate-constant "Immed"))))
(defun combination-implementation-style (node)
(declare (type sb-c::combination node) (ignore node))
(values :default nil))
(defun primitive-type-indirect-cell-type (ptype) (defun primitive-type-indirect-cell-type (ptype)
(declare (ignore ptype)) (declare (ignore ptype))
nil) nil)

View file

@ -2660,7 +2660,7 @@
(deftransform logbitp ((index integer) (:or ((signed-word signed-word) *) (deftransform logbitp ((index integer) (:or ((signed-word signed-word) *)
((word word) *)) * :vop t) ((word word) *)) * :vop t)
(not (sb-c::logbitp-to-minusp-p index integer))t) (not (sb-c::logbitp-to-minusp-p index integer)))
;;; TODO: The TEST instruction preceding this JEQ is entirely superfluous ;;; TODO: The TEST instruction preceding this JEQ is entirely superfluous
;;; and can be removed with a vop optimizer: ;;; and can be removed with a vop optimizer:

View file

@ -582,10 +582,6 @@
(defconstant nargs-offset rcx-offset) (defconstant nargs-offset rcx-offset)
(defconstant cfp-offset rbp-offset) ; pfw - needed by stuff in /code (defconstant cfp-offset rbp-offset) ; pfw - needed by stuff in /code
(defun combination-implementation-style (node)
(declare (ignore node))
(values :default nil))
(defvar *register-names* +qword-register-names+) (defvar *register-names* +qword-register-names+)
;;; See WRITE-FUNINSTANCE-PROLOGUE in x86-64-vm. ;;; See WRITE-FUNINSTANCE-PROLOGUE in x86-64-vm.

View file

@ -446,7 +446,3 @@
(constant (format nil "Const~D" offset)) (constant (format nil "Const~D" offset))
(immediate-constant "Immed") (immediate-constant "Immed")
(noise (symbol-name (sc-name sc)))))) (noise (symbol-name (sc-name sc))))))
(defun combination-implementation-style (node)
(declare (ignore node))
(values :default nil))