summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2020-06-06 13:30:59 +0200
committerAndrea Corallo <akrl@sdf.org>2020-06-06 22:03:11 +0100
commite8ab017b6d45aea2514a49f974e649ad1f7297ad (patch)
tree78486df3e023742c8735b435c4e16d6830ad8167 /lisp/emacs-lisp
parente38678b268c2a3f77d1fa32a55706fb9e077405c (diff)
downloademacs-e8ab017b6d45aea2514a49f974e649ad1f7297ad.tar.gz
emacs-e8ab017b6d45aea2514a49f974e649ad1f7297ad.tar.bz2
emacs-e8ab017b6d45aea2514a49f974e649ad1f7297ad.zip
Change 'direct-call' 'direct-callref' LIMPLE ops sematinc
Is cleaner to have the function c-name as first argument of 'direct-call' 'direct-callref'. This is preparatory to anonymous lambdas optimization. * lisp/emacs-lisp/comp.el (comp-propagate-insn): Use c-name when gathering the comp-func definition for direct calls. (comp-call-optim-form-call): Add put c-name as first argument of direct-call direct-callref when optimizing. * src/comp.c (emit_call): Update logic for having c-name as first arg of direct calls. (emit_call_ref): Rename 'subr_sym' into 'func'.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/comp.el25
1 files changed, 13 insertions, 12 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 5116f887220..e776b664812 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -1888,14 +1888,15 @@ Here goes everything that can be done not iteratively (read once).
(pcase insn
(`(set ,lval ,rval)
(pcase rval
- (`(,(or 'call 'direct-call) ,f . ,args)
- (setf (comp-mvar-type lval)
- (alist-get f comp-known-ret-types))
- (comp-function-call-maybe-remove insn f args))
- (`(,(or 'callref 'direct-callref) ,f . ,args)
+ (`(,(or 'call 'callref) ,f . ,args)
(setf (comp-mvar-type lval)
(alist-get f comp-known-ret-types))
(comp-function-call-maybe-remove insn f args))
+ (`(,(or 'direct-call 'direct-callref) ,f . ,args)
+ (let ((f (comp-func-name (gethash f (comp-ctxt-funcs-h comp-ctxt)))))
+ (setf (comp-mvar-type lval)
+ (alist-get f comp-known-ret-types))
+ (comp-function-call-maybe-remove insn f args)))
(_
(comp-mvar-propagate lval rval))))
(`(phi ,lval . ,rest)
@@ -1985,9 +1986,9 @@ Backward propagate array placement properties."
(not (memq callee comp-never-optimize-functions)))
(let* ((f (symbol-function callee))
(subrp (subrp f))
- (callee-in-unit (gethash (gethash callee
- (comp-ctxt-sym-to-c-name-h comp-ctxt))
- (comp-ctxt-funcs-h comp-ctxt))))
+ (comp-func-callee (gethash (gethash callee
+ (comp-ctxt-sym-to-c-name-h comp-ctxt))
+ (comp-ctxt-funcs-h comp-ctxt))))
(cond
((and subrp (not (subr-native-elisp-p f)))
;; Trampoline removal.
@@ -1995,7 +1996,7 @@ Backward propagate array placement properties."
(maxarg (cdr (subr-arity f)))
(call-type (if (if subrp
(not (numberp maxarg))
- (comp-nargs-p callee-in-unit))
+ (comp-nargs-p comp-func-callee))
'callref
'call))
(args (if (eq call-type 'callref)
@@ -2005,14 +2006,14 @@ Backward propagate array placement properties."
;; Intra compilation unit procedure call optimization.
;; Attention speed 3 triggers this for non self calls too!!
((and (>= comp-speed 3)
- callee-in-unit)
- (let* ((func-args (comp-func-args callee-in-unit))
+ comp-func-callee)
+ (let* ((func-args (comp-func-args comp-func-callee))
(nargs (comp-nargs-p func-args))
(call-type (if nargs 'direct-callref 'direct-call))
(args (if (eq call-type 'direct-callref)
args
(fill-args args (comp-args-max func-args)))))
- `(,call-type ,callee ,@args)))
+ `(,call-type ,(comp-func-c-name comp-func-callee) ,@args)))
((comp-type-hint-p callee)
`(call ,callee ,@args)))))))