From 2c3feb09d55dd32958880de564c642cace63024a Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Sun, 29 Nov 2009 22:00:29 +0100 Subject: [PATCH] Provide compiler macros for the slot accessors of the root classes. --- src/cmp/cmpclos.lsp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/cmp/cmpclos.lsp b/src/cmp/cmpclos.lsp index ca55805ad..1d740bf4c 100644 --- a/src/cmp/cmpclos.lsp +++ b/src/cmp/cmpclos.lsp @@ -114,3 +114,18 @@ (when (si::fixnump index) (c1expr `(si::instance-set ,(second args) ,index ,(first args)))))))))) +(progn . + #.(loop for var in '(clos::+standard-generic-function-slots+ + clos::+standard-method-slots+ + clos::+standard-class-slots+ + clos::+class-slots+) + for slot-list = (symbol-value var) + nconc + (loop for i from 0 + for slot-definition in slot-list + for accessor = (cadr (member :accessor slot-definition)) + when accessor + collect `(define-compiler-macro ,accessor (&whole whole obj &environment env) + (if (policy-inline-slot-access-p env) + `(si::instance-ref ,obj ,,i) + whole))))) \ No newline at end of file