From 50a7dd437c9d3c1ea9bac9ade86e903d12a39eb3 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Mon, 17 Sep 2007 00:39:13 +0200 Subject: Define a compiler macro for PRIMITVE-INVOKE that moves constant selector conversion to load-time. darcs-hash:eacb4258637999d9d3650e877dc7942c5e254ab8 --- Lisp/method-invocation.lisp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Lisp/method-invocation.lisp b/Lisp/method-invocation.lisp index 05b1eab..cfefc8c 100644 --- a/Lisp/method-invocation.lisp +++ b/Lisp/method-invocation.lisp @@ -267,6 +267,20 @@ Returns: *result* --- the return value of the method invocation. return-c-type))))))))))) +;; Optimise constant method names away by converting them to selectors +;; at load-time. +(define-compiler-macro primitive-invoke (&whole form + receiver method-name return-type + &rest args) + (if (and (constantp method-name) + (not (and (listp method-name) + (eq 'load-time-value (car method-name))))) + `(primitive-invoke ,receiver + (load-time-value (selector ,method-name)) + ,return-type ,@args) + form)) + + ;;; (@* "Helper functions") (defun arglist->objc-arglist (arglist) (arglist-intersperse-types (mapcar #'lisp->obj-data arglist))) -- cgit v1.2.3