]> git.eshelyaron.com Git - emacs.git/commitdiff
guard comp-call-optim-form-call for byte compiled callee
authorAndrea Corallo <akrl@sdf.org>
Wed, 18 Sep 2019 23:25:46 +0000 (01:25 +0200)
committerAndrea Corallo <akrl@sdf.org>
Wed, 1 Jan 2020 10:37:50 +0000 (11:37 +0100)
lisp/emacs-lisp/comp.el
src/comp.c

index ad64ee76183188e074aa10941a3b48cdc765fb78..551fdf80389fdfd8f4f30a64d27b341625058b5e 100644 (file)
@@ -1301,27 +1301,27 @@ This can run just once."
 ;;; Call optimizer pass specific code.
 ;; Try to avoid funcall trampoline use when possible.
 
-(defun comp-call-optim-form-call (calle args self)
+(defun comp-call-optim-form-call (callee args self)
   ""
-  (let* ((f (symbol-function calle))
-         (subrp (subrp f))
-         (calle-in-unit (gethash calle
-                                 (comp-ctxt-funcs-h comp-ctxt))))
-    (when-let* ((optimize (or (and subrp
-                                   (or
-                                    (not (subr-native-elispp f)))
-                                   ;; Attention speed 3 optimize inter compilation unit
-                                   ;; calls!!
-)
-                              (eq calle self)
-                              (and (>= comp-speed 3)
-                                   calle-in-unit)))
-                (call-type (if (if subrp
-                                   (not (numberp (cdr (subr-arity f))))
-                                 (comp-nargs-p calle-in-unit))
-                               'callref
-                             'call)))
-      `(,call-type ,calle ,@args))))
+  (when (symbolp callee) ; Do nothing if callee is a byte compiled func.
+    (let* ((f (symbol-function callee))
+           (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)))))
 
 (defun comp-call-optim (funcs)
   "Given FUNCS try to avoid funcall trampoline usage when possible."
index ca22b81de133e82c6d3067a49e8d55a11c50830a..ef10c466cf2feaaf257b60da0470309aeb6fc754 100644 (file)
@@ -1048,7 +1048,7 @@ emit_mvar_val (Lisp_Object mvar)
       if (FIXNUMP (constant))
        {
          /* We can still emit directly objects that are selfcontained in a word
-            read (fixnums).  */
+            (read fixnums).  */
          emit_comment (SSDATA (Fprin1_to_string (constant, Qnil)));
          gcc_jit_rvalue *word =
            gcc_jit_context_new_rvalue_from_ptr(comp.ctxt,