]> git.eshelyaron.com Git - emacs.git/commitdiff
add direct-call direct-callref into frontend
authorAndrea Corallo <akrl@sdf.org>
Sat, 21 Sep 2019 07:47:02 +0000 (09:47 +0200)
committerAndrea Corallo <akrl@sdf.org>
Wed, 1 Jan 2020 10:37:50 +0000 (11:37 +0100)
lisp/emacs-lisp/comp.el

index 551fdf80389fdfd8f4f30a64d27b341625058b5e..3ccdf4f2e464f55d76eda6586db350ceb8e5e62d 100644 (file)
@@ -1308,20 +1308,22 @@ This can run just once."
            (subrp (subrp f))
            (callee-in-unit (gethash callee
                                     (comp-ctxt-funcs-h comp-ctxt))))
-      (when-let* ((optimize (or (and subrp
-                                     (not (subr-native-elispp f)))
-                                (eq callee self)
-                                ;; Attention speed 3 optimize inter compilation
-                                ;; unit calls!!
-                                (and (>= comp-speed 3)
-                                     callee-in-unit)))
-                  (call-type (if (if subrp
-                                     (not (numberp (cdr (subr-arity f))))
-                                   (comp-nargs-p callee-in-unit))
-                                 'callref
-                               'call)))
-        (comp-add-subr-to-relocs callee)
-        `(,call-type ,callee ,@args)))))
+      (if (and subrp (not (subr-native-elispp f)))
+          (let ((call-type (if (if subrp
+                                    (not (numberp (cdr (subr-arity f))))
+                                  (comp-nargs-p callee-in-unit))
+                                'callref
+                             'call)))
+            (comp-add-subr-to-relocs callee)
+            `(,call-type ,callee ,@args))
+        ;; Intra compilation unit procedure call optimization.
+        (when (or (eq callee self)
+                  ;; Attention speed 3 triggers that for non self calls too!!
+                  (and (>= comp-speed 3)
+                       callee-in-unit))
+          (let* ((nargs (comp-nargs-p (comp-func-args callee-in-unit)))
+                 (call-type (if nargs 'direct-callref 'direct-call)))
+            `(,call-type ,callee ,@args)))))))
 
 (defun comp-call-optim (funcs)
   "Given FUNCS try to avoid funcall trampoline usage when possible."