diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-03-19 12:44:39 +0100 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-03-19 12:44:39 +0100 |
commit | 4b98e8d6f54256810b243afe9ea9abf5ad6d445b (patch) | |
tree | e81dfc256ec064af0e9140221fb4624fba8f51ff /Lisp | |
parent | f9180cd67505f16a8588a83da82f263bc395b347 (diff) |
Move (OBJECT-GET-CLASS RECEIVER) from INVOKE-BY-NAME-SUPER-V to RETRIEVE-METHOD-SIGNATURE-INFO.
darcs-hash:1fd46a3dbdb3a5e2ec284be3255dd08b2b074414
Diffstat (limited to 'Lisp')
-rw-r--r-- | Lisp/libobjcl.lisp | 4 | ||||
-rw-r--r-- | Lisp/method-invocation.lisp | 22 |
2 files changed, 10 insertions, 16 deletions
diff --git a/Lisp/libobjcl.lisp b/Lisp/libobjcl.lisp index 38b244f..fab195e 100644 --- a/Lisp/libobjcl.lisp +++ b/Lisp/libobjcl.lisp @@ -731,10 +731,6 @@ separating parts by hyphens works nicely in all of the `:INVERT`, (%objcl-object-is-meta-class (pointer obj))) (defun object-get-class (obj) - ;; OPTIMISE: Both find-objc-class-by-name and %objcl-class-name are - ;; slow and mostly unneeded. We can simply retrieve classes by class - ;; pointer if they have already been registered in a hash table - ;; somewhere. (intern-pointer-wrapper 'objective-c-class :pointer (%objcl-object-get-class (pointer obj)))) diff --git a/Lisp/method-invocation.lisp b/Lisp/method-invocation.lisp index c4ba3fc..29ad3c6 100644 --- a/Lisp/method-invocation.lisp +++ b/Lisp/method-invocation.lisp @@ -215,17 +215,13 @@ easier to use with __apply__. ;; TODO: Support varargs. (let* ((selector (if (typep method-name 'selector) method-name - (find-selector method-name))) - (class (object-get-class receiver))) + (find-selector method-name)))) (multiple-value-bind (argc method-return-typestring method-return-type method-arg-typestrings method-arg-types) - (retrieve-method-signature-info class selector - (if (object-is-class-p receiver) - :class - :instance)) + (retrieve-method-signature-info receiver selector) (assert (= argc (+ 2 (length args))) (args) "Wrong number of arguments (expected ~A, got ~A)." @@ -296,17 +292,19 @@ easier to use with __apply__. (define-cached-function retrieve-method-signature-info - (class selector &optional (instance-or-class :instance)) - (cons (cffi:pointer-address (pointer-to class)) + (receiver selector + &aux (class-ptr (%objcl-object-get-class (pointer receiver)))) + (cons (cffi:pointer-address class-ptr) (cffi:pointer-address (pointer-to selector))) - (let* ((signature - (objc-or (if (eq instance-or-class :instance) + (let* ((class (object-get-class receiver)) + (signature + (objc-or (if (object-is-class-p receiver) (primitive-invoke class - "instanceMethodSignatureForSelector:" + "methodSignatureForSelector:" 'id selector) (primitive-invoke class - "methodSignatureForSelector:" + "instanceMethodSignatureForSelector:" 'id selector)) (error (make-condition 'message-not-understood |