X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/sod/blobdiff_plain/284f1fa2ace3e276052ff1bd7d66442500e693da..ced609b8c5cc865f25cf5cce91a3d7dc9c85bdee:/src/method-impl.lisp diff --git a/src/method-impl.lisp b/src/method-impl.lisp index e4aaae3..0564d81 100644 --- a/src/method-impl.lisp +++ b/src/method-impl.lisp @@ -53,11 +53,7 @@ (define-on-demand-slot basic-message argument-tail (message) (c-function-arguments (sod-message-type message))))) (define-on-demand-slot basic-message no-varargs-tail (message) - (mapcar (lambda (arg) - (if (eq arg :ellipsis) - (make-argument *sod-ap* c-type-va-list) - arg)) - (sod-message-argument-tail message))) + (reify-variable-argument-tail (sod-message-argument-tail message))) (defmethod sod-message-method-class ((message basic-message) (class sod-class) pset) @@ -147,11 +143,8 @@ (defmethod check-method-type ((method daemon-direct-method) (message sod-message) (type c-function-type)) (with-slots ((msgtype %type)) message - (unless (c-type-equal-p (c-type-subtype type) c-type-void) - (error "Method return type ~A must be `void'" (c-type-subtype type))) - (unless (argument-lists-compatible-p (c-function-arguments msgtype) - (c-function-arguments type)) - (error "Method arguments ~A don't match message ~A" type msgtype)))) + (check-method-return-type type c-type-void) + (check-method-argument-lists type msgtype))) (export 'delegating-direct-method) (defclass delegating-direct-method (basic-direct-method) @@ -420,10 +413,9 @@ (defmethod compute-method-entry-functions ((method basic-effective-method)) ;; Effective method function details. (emf-name (effective-method-function-name method)) (ilayout-type (c-type (* (struct (ilayout-struct-tag class))))) - (emf-arg-tail (sod-message-no-varargs-tail message)) (emf-type (c-type (fun (lisp return-type) ("sod__obj" (lisp ilayout-type)) - . emf-arg-tail)))) + . entry-args)))) (flet ((setup-entry (tail) (let ((head (sod-class-chain-head tail))) @@ -438,7 +430,15 @@ (defmethod compute-method-entry-functions ((method basic-effective-method)) (type (c-type (fun (lisp return-type) ("me" (* (class tail))) . entry-args)))) - (codegen-pop-function codegen name type) + (codegen-pop-function codegen name type + "~@(~@[~A ~]entry~) function ~:_~ + for method `~A.~A' ~:_~ + via chain headed by `~A' ~:_~ + defined on `~A'." + (if parm-n "Indirect argument-tail" nil) + (sod-class-nickname message-class) + (sod-message-name message) + head class) ;; If this is a varargs method then we've made the ;; `:valist' role. Also make the `nil' role. @@ -458,7 +458,15 @@ (defmethod compute-method-entry-functions ((method basic-effective-method)) (deliver-expr codegen target call) (deliver-call codegen :void "va_end" *sod-ap*))) - (codegen-pop-function codegen main main-type)))))) + (codegen-pop-function codegen main main-type + "Variable-length argument list ~:_~ + entry function ~:_~ + for method `~A.~A' ~:_~ + via chain headed by `~A' ~:_~ + defined on `~A'." + (sod-class-nickname message-class) + (sod-message-name message) + head class)))))) ;; Generate the method body. We'll work out what to do with it later. (codegen-push codegen) @@ -492,10 +500,15 @@ (defmethod compute-method-entry-functions ((method basic-effective-method)) ;; function and call it a lot. (codegen-build-function codegen emf-name emf-type vars (nconc insts (and result - (list (make-return-inst result))))) + (list (make-return-inst result)))) + "Effective method function ~:_for `~A.~A' ~:_~ + defined on `~A'." + (sod-class-nickname message-class) + (sod-message-name message) + (effective-method-class method)) (let ((call (apply #'make-call-inst emf-name "sod__obj" - (mapcar #'argument-name emf-arg-tail)))) + (mapcar #'argument-name entry-args)))) (dolist (tail chain-tails) (setup-entry tail) (deliver-expr codegen entry-target call)