X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fgeneric%2Fearly-type-vops.lisp;h=06d21b386d6b682446fa40c41b19785d70d4b78f;hb=9c9c68bd6e5e3c6d02e9f1bfd583b87bb9e85eea;hp=d3572d6812e78b654f0f68474a23a70c5b83df6c;hpb=d007a04970c7daa85d522a1816e3ffc7a3bf1913;p=sbcl.git diff --git a/src/compiler/generic/early-type-vops.lisp b/src/compiler/generic/early-type-vops.lisp index d3572d6..06d21b3 100644 --- a/src/compiler/generic/early-type-vops.lisp +++ b/src/compiler/generic/early-type-vops.lisp @@ -1,12 +1,21 @@ -(in-package "SB!VM") +;;;; generic type testing and checking apparatus +;;;; This software is part of the SBCL system. See the README file for +;;;; more information. +;;;; +;;;; This software is derived from the CMU CL system, which was +;;;; written at Carnegie Mellon University and released into the +;;;; public domain. The software is in the public domain and is +;;;; provided with absolutely no warranty. See the COPYING and CREDITS +;;;; files for more information. +(in-package "SB!VM") + (defparameter *immediate-types* (list unbound-marker-widetag base-char-widetag)) (defparameter *fun-header-widetags* (list funcallable-instance-header-widetag simple-fun-header-widetag - closure-fun-header-widetag closure-header-widetag)) (defun canonicalize-headers (headers) @@ -31,7 +40,10 @@ (emit-test))) (results))) -(defmacro test-type (value target not-p &rest type-codes) +(defmacro test-type (value target not-p + (&rest type-codes) + &rest other-args + &key &allow-other-keys) ;; Determine what interesting combinations we need to test for. (let* ((type-codes (mapcar #'eval type-codes)) (fixnump (and (member even-fixnum-lowtag type-codes) @@ -62,8 +74,10 @@ (error "can't mix fixnum testing with other immediates")) (if headers `(%test-fixnum-and-headers ,value ,target ,not-p - ',(canonicalize-headers headers)) - `(%test-fixnum ,value ,target ,not-p))) + ',(canonicalize-headers headers) + ,@other-args) + `(%test-fixnum ,value ,target ,not-p + ,@other-args))) (immediates (when headers (error "can't mix testing of immediates with testing of headers")) @@ -71,18 +85,18 @@ (error "can't mix testing of immediates with testing of lowtags")) (when (cdr immediates) (error "can't test multiple immediates at the same time")) - `(%test-immediate ,value ,target ,not-p ,(car immediates))) + `(%test-immediate ,value ,target ,not-p ,(car immediates) + ,@other-args)) (lowtags (when (cdr lowtags) (error "can't test multiple lowtags at the same time")) - (if headers - `(%test-lowtag-and-headers - ,value ,target ,not-p ,(car lowtags) - ,function-p ',(canonicalize-headers headers)) - `(%test-lowtag ,value ,target ,not-p ,(car lowtags)))) + (when headers + (error "can't test non-fixnum lowtags and headers at the same time")) + `(%test-lowtag ,value ,target ,not-p ,(car lowtags) ,@other-args)) (headers `(%test-headers ,value ,target ,not-p ,function-p - ',(canonicalize-headers headers))) + ',(canonicalize-headers headers) + ,@other-args)) (t (error "nothing to test?")))))