Changeset 9350


Ignore:
Timestamp:
May 3, 2008, 12:00:21 PM (11 years ago)
Author:
gb
Message:

Define compiler-macros for some things used (perhaps heavily) in
the CLOS runtime. The INSTANCE-SLOTS compiler-macro depends on the
change in r9349, and may lead to benign warnings about calls to
%NON-STANDARD-INSTANCE-SLOTS while bootstrapping.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711/ccl/compiler/optimizers.lisp

    r9338 r9350  
    20552055           (eql (typecode instance) (nx-lookup-target-uvector-subtag :instance)))
    20562056    `(instance.slots ,instance)
    2057     w))
     2057    (let* ((itemp (gensym))
     2058           (typecode (gensym)))
     2059      `(let* ((,itemp ,instance)
     2060              (,typecode (typecode ,itemp)))
     2061        (declare (type (unsigned-byte 8) ,typecode))
     2062        (if (eql ,typecode ,(nx-lookup-target-uvector-subtag :instance))
     2063          (instance.slots ,itemp)
     2064          (%non-standard-instance-slots ,itemp ,typecode))))))
     2065
     2066(define-compiler-macro instance-class-wrapper (instance)
     2067  (let* ((itemp (gensym)))
     2068    `(let* ((,itemp ,instance))
     2069      (if (eql (the (unsigned-byte 8) (typecode ,itemp))
     2070               ,(nx-lookup-target-uvector-subtag :instance))
     2071        (instance.class-wrapper ,itemp)
     2072        (funcall 'instance-class-wrapper ,itemp)))))
     2073
     2074;; Instance must be a standard-instance.
     2075(define-compiler-macro %class-of-instance (instance)
     2076  `(%wrapper-class (instance.class-wrapper ,instance)))
     2077
     2078(define-compiler-macro standard-object-p (thing)
     2079  (let* ((temp (gensym))
     2080         (typecode (gensym)))
     2081    `(let* ((,temp ,thing)
     2082            (,typecode (typecode ,temp)))
     2083      (declare (type (unsigned-byte 8) ,typecode))
     2084      (if (= ,typecode ,(nx-lookup-target-uvector-subtag :instance))
     2085        (instance.class-wrapper ,temp)
     2086        (if (= ,typecode ,(nx-lookup-target-uvector-subtag :macptr))
     2087          (foreign-instance-class-wrapper ,temp))))))
    20582088
    20592089(define-compiler-macro unsigned-byte-p (x)
Note: See TracChangeset for help on using the changeset viewer.