Changeset 110
- Timestamp:
- Dec 12, 2003, 1:10:44 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/ccl/level-1/l1-dcode.lisp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/level-1/l1-dcode.lisp
r85 r110 1818 1818 1819 1819 1820 1821 1822 1823 (defun %%reader-dcode-no-lexpr (dt arg)1824 (locally (declare (optimize (speed 3)(safety 0)))1825 (let* ((gf (%gf-dispatch-table-gf dt))1826 (instance (if (%standard-instance-p arg) arg (%maybe-gf-instance arg))))1827 (unless instance1828 (let ((args-list (cons arg nil)))1829 (declare (dynamic-extent args-list))1830 (reader-trap-no-method gf args-list)))1831 (let* ((wrapper (instance.class-wrapper instance)))1832 (when (eql 0 (%wrapper-hash-index wrapper))1833 (update-obsolete-instance arg)1834 (setq wrapper (instance.class-wrapper instance))1835 (setq dt (%gf-dispatch-table gf))) ; may have changed1836 (let* ((mask (%gf-dispatch-table-mask dt))1837 (index (%ilogand mask (%wrapper-hash-index wrapper)))1838 table-wrapper flag)1839 (declare (fixnum index mask))1840 ;;(print (list 'first-index index wrapper))1841 (setq index (+ index index)) ; +2 ??1842 (loop1843 (if (eq (setq table-wrapper (%gf-dispatch-table-ref dt index)) wrapper)1844 (let* ((the-pos (%gf-dispatch-table-ref dt (the fixnum (1+ index)))))1845 (if (fixnump the-pos)1846 (locally (declare (fixnum the-pos))1847 (let* ((the-val (%svref (instance.slots instance) (the fixnum (+ the-pos 1)))))1848 (if (eq the-val (%slot-unbound-marker))1849 (return (slot-unbound1850 (%wrapper-class wrapper)1851 arg1852 (%svref (%wrapper-instance-slots wrapper) the-pos)))1853 (return the-val))))1854 (let ((the-val (cdr the-pos)))1855 (if (eq the-val (%slot-unbound-marker))1856 (return (slot-unbound (%wrapper-class wrapper) arg (car the-pos)))1857 (return the-val)))))1858 ; shit after here re class slots etc., forwarded instance1859 (progn1860 (when (null (%gf-dispatch-table-ref dt (the fixnum (1+ index))))1861 (if (or (neq table-wrapper (%unbound-marker-8))1862 (eq 0 flag))1863 (without-interrupts1864 (return1865 (let ((args-list (cons arg nil)))1866 (declare (dynamic-extent args-list))1867 (reader-trap-2 gf wrapper arg args-list))))1868 (setq flag 0 index -2)))1869 (setq index (+ 2 index))))))))))1870 1871 (defun %%writer-dcode-no-lexpr (dt arg0 arg)1872 (locally (declare (optimize (speed 3)(safety 0)))1873 (let* ((gf (%gf-dispatch-table-gf dt))1874 (instance (if (%standard-instance-p arg) arg (%maybe-gf-instance arg))))1875 (unless instance1876 (let* ((tail (cons arg nil))1877 (args-list (cons arg0 tail)))1878 (declare (dynamic-extent args-list tail))1879 (reader-trap-no-method gf args-list)))1880 (let* ((wrapper (instance.class-wrapper instance)))1881 (when (eql 0 (%wrapper-hash-index wrapper))1882 (update-obsolete-instance arg)1883 (setq wrapper (instance.class-wrapper instance))1884 (setq dt (%gf-dispatch-table gf))) ; may have changed1885 (let* ((mask (%gf-dispatch-table-mask dt))1886 (index (%ilsl 1 (%ilogand mask (%wrapper-hash-index wrapper))))1887 table-wrapper flag)1888 (declare (fixnum index mask))1889 (loop1890 (if (neq (setq table-wrapper (%gf-dispatch-table-ref dt index)) wrapper)1891 (progn1892 (when (null (%gf-dispatch-table-ref dt (the fixnum (1+ index))))1893 (if (or (neq table-wrapper (%unbound-marker-8))1894 (eql 0 flag))1895 (without-interrupts1896 (return1897 (let* ((tail (cons arg nil))1898 (args-list (cons arg0 tail)))1899 (declare (dynamic-extent args-list tail))1900 (reader-trap-2 gf wrapper arg args-list))))1901 (setq flag 0 index -2)))1902 (setq index (+ 2 index)))1903 (let* ((the-pos (%gf-dispatch-table-ref dt (the fixnum (1+ index))))1904 (the-val arg0))1905 (if (fixnump the-pos)1906 (locally (declare (fixnum the-pos))1907 (return (setf (%svref (instance.slots instance) (the fixnum (+ the-pos 1)))1908 the-val)))1909 (return (setf (cdr the-pos) the-val)))))))))))1910 1911 (defun reader-trap-no-method (gf args)1912 (if (listp args)1913 (apply #'no-applicable-method gf args)1914 (apply #'no-applicable-method gf (collect-lexpr-args args 0))))1915 1916 1917 (defun reader-trap-2 (gf wrapper instance args)1918 ;(declare (dynamic-extent args))1919 (let ((method (and wrapper (car (compute-applicable-methods gf args)))))1920 (if (not method)1921 (apply #'no-applicable-method gf args)1922 (let ((slots (%wrapper-instance-slots wrapper))1923 (slot-name (method-slot-name method)))1924 (when (eql 0 slots)1925 (error "Obsolete instance in reader-trap-2"))1926 (let ((idx (or (%vector-member slot-name slots)1927 (let* ((slotd (find-slotd1928 slot-name1929 (class-slots (%wrapper-class wrapper)))))1930 (if slotd (%slot-definition-location slotd))))))1931 (unless idx1932 (error "~s has no slot named ~s" instance slot-name))1933 (let ((table (%gf-dispatch-table gf)))1934 (multiple-value-bind (index obsolete-wrappers-p)1935 (find-gf-dispatch-table-index table wrapper)1936 (if index1937 (setf (%gf-dispatch-table-ref table index) wrapper1938 (%gf-dispatch-table-ref table (%i+ index 1)) idx)1939 (grow-gf-dispatch-table gf wrapper idx obsolete-wrappers-p))))1940 (apply (%method.function method) args))))))1941 1942 1943 1820 ; Support CALL-METHOD in DEFINE-METHOD-COMBINATION 1944 1821 (defun %%call-method* (method next-methods args)
Note:
See TracChangeset
for help on using the changeset viewer.
