mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-03 10:31:37 -08:00
* Introduce `comp-fwprop-max-insns-scan' as heuristic threshold
* lisp/emacs-lisp/comp.el (comp-fwprop-max-insns-scan): New constant. (comp-fwprop*): Give-up when `comp-fwprop-max-insns-scan' is exceeded.
This commit is contained in:
parent
883d937320
commit
339b4a754b
1 changed files with 13 additions and 2 deletions
|
|
@ -2926,6 +2926,11 @@ Return t when one or more block was removed, nil otherwise."
|
||||||
;; This is also responsible for removing function calls to pure functions if
|
;; This is also responsible for removing function calls to pure functions if
|
||||||
;; possible.
|
;; possible.
|
||||||
|
|
||||||
|
(defconst comp-fwprop-max-insns-scan 4500
|
||||||
|
;; Choosen as ~ the greatest required value for full convergence
|
||||||
|
;; native compiling all Emacs codebase.
|
||||||
|
"Max number of scanned insn before giving-up.")
|
||||||
|
|
||||||
(defun comp-copy-insn (insn)
|
(defun comp-copy-insn (insn)
|
||||||
"Deep copy INSN."
|
"Deep copy INSN."
|
||||||
;; Adapted from `copy-tree'.
|
;; Adapted from `copy-tree'.
|
||||||
|
|
@ -3086,7 +3091,9 @@ Fold the call in case."
|
||||||
(defun comp-fwprop* ()
|
(defun comp-fwprop* ()
|
||||||
"Propagate for set* and phi operands.
|
"Propagate for set* and phi operands.
|
||||||
Return t if something was changed."
|
Return t if something was changed."
|
||||||
(cl-loop with modified = nil
|
(cl-loop named outer
|
||||||
|
with modified = nil
|
||||||
|
with i = 0
|
||||||
for b being each hash-value of (comp-func-blocks comp-func)
|
for b being each hash-value of (comp-func-blocks comp-func)
|
||||||
do (cl-loop
|
do (cl-loop
|
||||||
with comp-block = b
|
with comp-block = b
|
||||||
|
|
@ -3094,9 +3101,13 @@ Return t if something was changed."
|
||||||
for orig-insn = (unless modified
|
for orig-insn = (unless modified
|
||||||
;; Save consing after 1th change.
|
;; Save consing after 1th change.
|
||||||
(comp-copy-insn insn))
|
(comp-copy-insn insn))
|
||||||
do (comp-fwprop-insn insn)
|
do
|
||||||
|
(comp-fwprop-insn insn)
|
||||||
|
(cl-incf i)
|
||||||
when (and (null modified) (not (equal insn orig-insn)))
|
when (and (null modified) (not (equal insn orig-insn)))
|
||||||
do (setf modified t))
|
do (setf modified t))
|
||||||
|
when (> i comp-fwprop-max-insns-scan)
|
||||||
|
do (cl-return-from outer nil)
|
||||||
finally return modified))
|
finally return modified))
|
||||||
|
|
||||||
(defun comp-rewrite-non-locals ()
|
(defun comp-rewrite-non-locals ()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue