add direct-call direct-callref into frontend

This commit is contained in:
Andrea Corallo 2019-09-21 09:47:02 +02:00
parent 4088e467b3
commit c31b471cad

View file

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