summaryrefslogtreecommitdiff
path: root/Lisp/method-invocation.lisp
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2007-09-17 00:39:13 +0200
committerMatthias Benkard <code@mail.matthias.benkard.de>2007-09-17 00:39:13 +0200
commit50a7dd437c9d3c1ea9bac9ade86e903d12a39eb3 (patch)
tree3ec6b41513b021d610d0fbadd8d23f6161b205a3 /Lisp/method-invocation.lisp
parent69e4519cc42f43814ae617dd2d7fb8bf06599e5c (diff)
Define a compiler macro for PRIMITVE-INVOKE that moves constant selector conversion to load-time.
darcs-hash:eacb4258637999d9d3650e877dc7942c5e254ab8
Diffstat (limited to 'Lisp/method-invocation.lisp')
-rw-r--r--Lisp/method-invocation.lisp14
1 files changed, 14 insertions, 0 deletions
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)))