X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fdefstruct.lisp;h=c3beef9e47349dce7cf572a3bbfe13dff16ff569;hb=ca308e6377525654efb755fd30af3270a04f099a;hp=27722b030bafba6e79c040b5ea4fb1b5f50977ef;hpb=295fdbaa30b57128da30e1e5fb0c653dd20f46d1;p=sbcl.git diff --git a/src/code/defstruct.lisp b/src/code/defstruct.lisp index 27722b0..c3beef9 100644 --- a/src/code/defstruct.lisp +++ b/src/code/defstruct.lisp @@ -31,20 +31,20 @@ (and layout (typep (layout-info layout) 'defstruct-description)))) (sb!xc:defmacro %make-structure-instance-macro (dd slot-specs &rest slot-vars) - `(truly-the ,(dd-name dd) - ,(if (compiler-layout-ready-p (dd-name dd)) - `(%make-structure-instance ,dd ,slot-specs ,@slot-vars) - ;; Non-toplevel defstructs don't have a layout at compile time, - ;; so we need to construct the actual function at runtime -- but - ;; we cache it at the call site, so that we don't perform quite - ;; so horribly. - `(let* ((cell (load-time-value (list nil))) - (fun (car cell))) - (if (functionp fun) - (funcall fun ,@slot-vars) - (funcall (setf (car cell) - (%make-structure-instance-allocator ,dd ,slot-specs)) - ,@slot-vars)))))) + (if (compiler-layout-ready-p (dd-name dd)) + `(truly-the ,(dd-name dd) + (%make-structure-instance ,dd ,slot-specs ,@slot-vars)) + ;; Non-toplevel defstructs don't have a layout at compile time, + ;; so we need to construct the actual function at runtime -- but + ;; we cache it at the call site, so that we don't perform quite + ;; so horribly. + `(let* ((cell (load-time-value (list nil))) + (fun (car cell))) + (if (functionp fun) + (funcall fun ,@slot-vars) + (funcall (setf (car cell) + (%make-structure-instance-allocator ,dd ,slot-specs)) + ,@slot-vars))))) (declaim (ftype (sfunction (defstruct-description list) function) %make-structure-instance-allocator))