X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fmips%2Fmacros.lisp;h=1598bc6c89a8c8b727555e626de9a3e7ef965e07;hb=9b1fade83db8453b75b8c7380eb12ce41b5b889c;hp=7351e01d3d8ee575c86c73025163f6906a0026bf;hpb=fe9173b98a9ddeb703a98b89f38ee7115c1b6717;p=sbcl.git diff --git a/src/compiler/mips/macros.lisp b/src/compiler/mips/macros.lisp index 7351e01..1598bc6 100644 --- a/src/compiler/mips/macros.lisp +++ b/src/compiler/mips/macros.lisp @@ -26,7 +26,7 @@ (defmacro move (dst src &optional (always-emit-code-p nil)) #!+sb-doc "Move SRC into DST (unless they are location= and ALWAYS-EMIT-CODE-P - is nil)." +is nil)." (once-only ((n-dst dst) (n-src src)) `(if (location= ,n-dst ,n-src) @@ -64,7 +64,7 @@ (defmacro load-type (target source &optional (offset 0)) #!+sb-doc "Loads the type bits of a pointer into target independent of - byte-ordering issues." +byte-ordering issues." (once-only ((n-target target) (n-source source) (n-offset offset)) @@ -143,21 +143,39 @@ ;;;; Storage allocation: -(defmacro with-fixed-allocation ((result-tn flag-tn temp-tn type-code size) +(defmacro with-fixed-allocation ((result-tn flag-tn temp-tn type-code + size dynamic-extent-p + &key (lowtag other-pointer-lowtag)) &body body) + #!+sb-doc "Do stuff to allocate an other-pointer object of fixed Size with a single - word header having the specified Type-Code. The result is placed in - Result-TN, Flag-Tn must be wired to NL4-OFFSET, and Temp-TN is a non- - descriptor temp (which may be randomly used by the body.) The body is - placed inside the PSEUDO-ATOMIC, and presumably initializes the object." +word header having the specified Type-Code. The result is placed in +Result-TN, Flag-Tn must be wired to NL4-OFFSET, and Temp-TN is a non- +descriptor temp (which may be randomly used by the body.) The body is +placed inside the PSEUDO-ATOMIC, and presumably initializes the object." (unless body (bug "empty &body in WITH-FIXED-ALLOCATION")) - (once-only ((result-tn result-tn) (temp-tn temp-tn) (size size)) - `(pseudo-atomic (,flag-tn :extra (pad-data-block ,size)) - (inst or ,result-tn alloc-tn other-pointer-lowtag) - (inst li ,temp-tn (logior (ash (1- ,size) n-widetag-bits) ,type-code)) - (storew ,temp-tn ,result-tn 0 other-pointer-lowtag) - ,@body))) + (once-only ((result-tn result-tn) (flag-tn flag-tn) (temp-tn temp-tn) + (type-code type-code) (size size) + (dynamic-extent-p dynamic-extent-p) + (lowtag lowtag)) + `(if ,dynamic-extent-p + (pseudo-atomic (,flag-tn) + (align-csp ,temp-tn) + (inst or ,result-tn csp-tn ,lowtag) + (inst li ,temp-tn (logior (ash (1- ,size) n-widetag-bits) ,type-code)) + (inst addu csp-tn (pad-data-block ,size)) + (storew ,temp-tn ,result-tn 0 ,lowtag) + ,@body) + (pseudo-atomic (,flag-tn :extra (pad-data-block ,size)) + ;; The pseudo-atomic bit in alloc-tn is set. If the lowtag also + ;; has a 1 bit in the same position, we're all set. Otherwise, + ;; we need to subtract the pseudo-atomic bit. + (inst or ,result-tn alloc-tn ,lowtag) + (unless (logbitp 0 ,lowtag) (inst sub ,result-tn 1)) + (inst li ,temp-tn (logior (ash (1- ,size) n-widetag-bits) ,type-code)) + (storew ,temp-tn ,result-tn 0 ,lowtag) + ,@body)))) (defun align-csp (temp) ;; is used for stack allocation of dynamic-extent objects @@ -200,7 +218,7 @@ ;;;; Error Code -(eval-when (:compile-toplevel :load-toplevel :execute) +(eval-when (#-sb-xc :compile-toplevel :load-toplevel :execute) (defun emit-error-break (vop kind code values) (let ((vector (gensym))) `((let ((vop ,vop))