Changeset 8472
- Timestamp:
- Feb 12, 2008, 3:17:14 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/source/lisp-kernel/x86-gc.c (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/lisp-kernel/x86-gc.c
r8369 r8472 1656 1656 new; 1657 1657 natural 1658 subtag = header_subtag(header), 1659 element_count = header_element_count(header), 1658 start = (natural)old, 1660 1659 physbytes; 1661 1660 1662 switch(subtag) { 1663 case subtag_simple_base_string: 1664 physbytes = node_size + (element_count << 2); 1665 break; 1666 1667 #ifndef X86 1668 case subtag_code_vector: 1669 physbytes = node_size + (element_count << 2); 1670 break; 1671 #endif 1672 1673 default: 1674 Bug(NULL, "Can't purify object at 0x%08x", obj); 1675 return obj; 1676 } 1677 physbytes = (physbytes+(dnode_size-1))&~(dnode_size-1); 1661 physbytes = ((natural)(skip_over_ivector(start,header))) - start; 1662 1678 1663 dest->active += physbytes; 1679 1664 … … 1706 1691 1707 1692 1708 #define FORWARD_ONLY 01709 #define COPY_CODE (1<<0)1710 #define COPY_STRINGS (1<<1)1711 1693 1712 1694 … … 1763 1745 1764 1746 Boolean 1765 copy_ivector_reference(LispObj *ref, BytePtr low, BytePtr high, area *dest , int what_to_copy)1747 copy_ivector_reference(LispObj *ref, BytePtr low, BytePtr high, area *dest) 1766 1748 { 1767 1749 LispObj obj = *ref, header, new; … … 1779 1761 header_tag = fulltag_of(header); 1780 1762 if (immheader_tag_p(header_tag)) { 1781 header_subtag = header_subtag(header); 1782 if ((what_to_copy & COPY_STRINGS) && 1783 ((header_subtag == subtag_simple_base_string))) { 1784 new = purify_object(obj, dest); 1785 *ref = new; 1786 changed = (new != obj); 1787 } 1763 new = purify_object(obj, dest); 1764 *ref = new; 1765 changed = (new != obj); 1788 1766 } 1789 1767 } … … 1793 1771 1794 1772 1795 void purify_headerless_range(LispObj *start, LispObj *end, BytePtr low, BytePtr high, area *to, int what) 1773 void 1774 purify_gcable_ptrs(BytePtr low, BytePtr high, area *to) 1775 { 1776 LispObj *prev = &(lisp_global(GCABLE_POINTERS)), next; 1777 1778 while ((*prev) != (LispObj)NULL) { 1779 copy_ivector_reference(prev, low, high, to); 1780 next = *prev; 1781 prev = &(((xmacptr *)ptr_from_lispobj(untag(next)))->link); 1782 } 1783 } 1784 void 1785 purify_headerless_range(LispObj *start, LispObj *end, BytePtr low, BytePtr high, area *to) 1796 1786 { 1797 1787 while (start < end) { 1798 copy_ivector_reference(start, low, high, to , what);1788 copy_ivector_reference(start, low, high, to); 1799 1789 start++; 1800 1790 } … … 1802 1792 1803 1793 void 1804 purify_range(LispObj *start, LispObj *end, BytePtr low, BytePtr high, area *to , int what)1794 purify_range(LispObj *start, LispObj *end, BytePtr low, BytePtr high, area *to) 1805 1795 { 1806 1796 LispObj header; … … 1829 1819 nwords -= skip; 1830 1820 while(skip--) { 1831 copy_ivector_reference(start, low, high, to , what);1821 copy_ivector_reference(start, low, high, to); 1832 1822 start++; 1833 1823 } … … 1838 1828 nwords >>= 1; 1839 1829 while(nwords--) { 1840 if (copy_ivector_reference(start, low, high, to , what) && hashp) {1830 if (copy_ivector_reference(start, low, high, to) && hashp) { 1841 1831 hashp->flags |= nhash_key_moved_mask; 1842 1832 hashp = NULL; 1843 1833 } 1844 1834 start++; 1845 copy_ivector_reference(start, low, high, to , what);1835 copy_ivector_reference(start, low, high, to); 1846 1836 start++; 1847 1837 } … … 1855 1845 start++; 1856 1846 while(nwords--) { 1857 copy_ivector_reference(start, low, high, to , what);1847 copy_ivector_reference(start, low, high, to); 1858 1848 start++; 1859 1849 } … … 1861 1851 } else { 1862 1852 /* Not a header, just a cons cell */ 1863 copy_ivector_reference(start, low, high, to , what);1853 copy_ivector_reference(start, low, high, to); 1864 1854 start++; 1865 copy_ivector_reference(start, low, high, to , what);1855 copy_ivector_reference(start, low, high, to); 1866 1856 start++; 1867 1857 } … … 1872 1862 /* Purify references from tstack areas */ 1873 1863 void 1874 purify_tstack_area(area *a, BytePtr low, BytePtr high, area *to , int what)1864 purify_tstack_area(area *a, BytePtr low, BytePtr high, area *to) 1875 1865 { 1876 1866 LispObj … … 1886 1876 next = (LispObj *) ptr_from_lispobj(*current); 1887 1877 end = ((next >= start) && (next < limit)) ? next : limit; 1888 if (current[1] == 0) { 1889 purify_range(current+2, end, low, high, to, what); 1890 } 1878 purify_range(current+2, end, low, high, to); 1891 1879 } 1892 1880 } … … 1894 1882 /* Purify a vstack area */ 1895 1883 void 1896 purify_vstack_area(area *a, BytePtr low, BytePtr high, area *to , int what)1884 purify_vstack_area(area *a, BytePtr low, BytePtr high, area *to) 1897 1885 { 1898 1886 LispObj … … 1900 1888 *q = (LispObj *) a->high; 1901 1889 1902 purify_headerless_range(p, q, low, high, to , what);1903 } 1904 1905 1906 void 1907 purify_xp(ExceptionInformation *xp, BytePtr low, BytePtr high, area *to , int what)1890 purify_headerless_range(p, q, low, high, to); 1891 } 1892 1893 1894 void 1895 purify_xp(ExceptionInformation *xp, BytePtr low, BytePtr high, area *to) 1908 1896 { 1909 1897 natural *regs = (natural *) xpGPRvector(xp); … … 1911 1899 1912 1900 #ifdef X8664 1913 copy_ivector_reference(&(regs[Iarg_z]), low, high, to , what);1914 copy_ivector_reference(&(regs[Iarg_y]), low, high, to , what);1915 copy_ivector_reference(&(regs[Iarg_x]), low, high, to , what);1916 copy_ivector_reference(&(regs[Isave3]), low, high, to , what);1917 copy_ivector_reference(&(regs[Isave2]), low, high, to , what);1918 copy_ivector_reference(&(regs[Isave1]), low, high, to , what);1919 copy_ivector_reference(&(regs[Isave0]), low, high, to , what);1920 copy_ivector_reference(&(regs[Ifn]), low, high, to , what);1921 copy_ivector_reference(&(regs[Itemp0]), low, high, to , what);1922 copy_ivector_reference(&(regs[Itemp1]), low, high, to , what);1923 copy_ivector_reference(&(regs[Itemp2]), low, high, to , what);1901 copy_ivector_reference(&(regs[Iarg_z]), low, high, to); 1902 copy_ivector_reference(&(regs[Iarg_y]), low, high, to); 1903 copy_ivector_reference(&(regs[Iarg_x]), low, high, to); 1904 copy_ivector_reference(&(regs[Isave3]), low, high, to); 1905 copy_ivector_reference(&(regs[Isave2]), low, high, to); 1906 copy_ivector_reference(&(regs[Isave1]), low, high, to); 1907 copy_ivector_reference(&(regs[Isave0]), low, high, to); 1908 copy_ivector_reference(&(regs[Ifn]), low, high, to); 1909 copy_ivector_reference(&(regs[Itemp0]), low, high, to); 1910 copy_ivector_reference(&(regs[Itemp1]), low, high, to); 1911 copy_ivector_reference(&(regs[Itemp2]), low, high, to); 1924 1912 #if 0 1925 purify_locref(&(regs[Iip]), low, high, to , what);1913 purify_locref(&(regs[Iip]), low, high, to); 1926 1914 #endif 1927 1915 #else … … 1930 1918 1931 1919 void 1932 purify_tcr_tlb(TCR *tcr, BytePtr low, BytePtr high, area *to , int what)1920 purify_tcr_tlb(TCR *tcr, BytePtr low, BytePtr high, area *to) 1933 1921 { 1934 1922 natural n = tcr->tlb_limit; 1935 1923 LispObj *start = tcr->tlb_pointer, *end = (LispObj *) ((BytePtr)start+n); 1936 1924 1937 purify_range(start, end, low, high, to , what);1938 } 1939 1940 void 1941 purify_tcr_xframes(TCR *tcr, BytePtr low, BytePtr high, area *to , int what)1925 purify_range(start, end, low, high, to); 1926 } 1927 1928 void 1929 purify_tcr_xframes(TCR *tcr, BytePtr low, BytePtr high, area *to) 1942 1930 { 1943 1931 xframe_list *xframes; … … 1946 1934 xp = tcr->gc_context; 1947 1935 if (xp) { 1948 purify_xp(xp, low, high, to , what);1936 purify_xp(xp, low, high, to); 1949 1937 } 1950 1938 1951 1939 for (xframes = tcr->xframe; xframes; xframes = xframes->prev) { 1952 purify_xp(xframes->curr, low, high, to , what);1953 } 1954 } 1955 1956 1957 void 1958 purify_areas(BytePtr low, BytePtr high, area *target , int what)1940 purify_xp(xframes->curr, low, high, to); 1941 } 1942 } 1943 1944 1945 void 1946 purify_areas(BytePtr low, BytePtr high, area *target) 1959 1947 { 1960 1948 area *next_area; … … 1964 1952 switch (code) { 1965 1953 case AREA_TSTACK: 1966 purify_tstack_area(next_area, low, high, target , what);1954 purify_tstack_area(next_area, low, high, target); 1967 1955 break; 1968 1956 1969 1957 case AREA_VSTACK: 1970 purify_vstack_area(next_area, low, high, target , what);1958 purify_vstack_area(next_area, low, high, target); 1971 1959 break; 1972 1960 1973 1961 case AREA_CSTACK: 1974 #ifdef PPC1975 purify_cstack_area(next_area, low, high, target, what);1976 #endif1977 1962 break; 1978 1963 1979 1964 case AREA_STATIC: 1980 1965 case AREA_DYNAMIC: 1981 purify_range((LispObj *) next_area->low, (LispObj *) next_area->active, low, high, target , what);1966 purify_range((LispObj *) next_area->low, (LispObj *) next_area->active, low, high, target); 1982 1967 break; 1983 1968 … … 2011 1996 2012 1997 2013 max_pure_size = interned_pname_bytes_in_range((LispObj *)(a->low + (static_dnodes_for_area(a) << dnode_shift)),1998 max_pure_size = unboxed_bytes_in_range((LispObj *)(a->low + (static_dnodes_for_area(a) << dnode_shift)), 2014 1999 (LispObj *) a->active); 2015 2000 new_pure_area = extend_readonly_area(max_pure_size); … … 2019 2004 2020 2005 /* 2021 First, loop thru *all-packages* and purify the pnames of all 2022 interned symbols. Then walk every place that could reference 2023 a heap-allocated object (all_areas, the xframe_list) and 2024 purify code_vectors (and update the odd case of a shared 2025 reference to a pname.) 2006 2026 2007 2027 2008 Make the new_pure_area executable, just in case. … … 2031 2012 */ 2032 2013 2033 { 2034 lispsymbol *rawsym = (lispsymbol *)(&(nrs_ALL_PACKAGES)); 2035 LispObj pkg_list = rawsym->vcell, htab, obj; 2036 package *p; 2037 cons *c; 2038 natural elements, i; 2039 2040 while (fulltag_of(pkg_list) == fulltag_cons) { 2041 c = (cons *) ptr_from_lispobj(untag(pkg_list)); 2042 p = (package *) ptr_from_lispobj(untag(c->car)); 2043 pkg_list = c->cdr; 2044 c = (cons *) ptr_from_lispobj(untag(p->itab)); 2045 htab = c->car; 2046 elements = header_element_count(header_of(htab)); 2047 for (i = 1; i<= elements; i++) { 2048 obj = deref(htab,i); 2049 if (fulltag_of(obj) == fulltag_symbol) { 2050 rawsym = (lispsymbol *) ptr_from_lispobj(untag(obj)); 2051 copy_ivector_reference(&(rawsym->pname), a->low, a->active, new_pure_area, COPY_STRINGS); 2052 } 2053 } 2054 c = (cons *) ptr_from_lispobj(untag(p->etab)); 2055 htab = c->car; 2056 elements = header_element_count(header_of(htab)); 2057 for (i = 1; i<= elements; i++) { 2058 obj = deref(htab,i); 2059 if (fulltag_of(obj) == fulltag_symbol) { 2060 rawsym = (lispsymbol *) ptr_from_lispobj(untag(obj)); 2061 copy_ivector_reference(&(rawsym->pname), a->low, a->active, new_pure_area, COPY_STRINGS); 2062 } 2063 } 2064 } 2065 } 2014 2066 2015 2067 purify_areas(a->low, a->active, new_pure_area , FORWARD_ONLY);2016 purify_areas(a->low, a->active, new_pure_area); 2068 2017 2069 2018 other_tcr = tcr; 2070 2019 do { 2071 purify_tcr_xframes(other_tcr, a->low, a->active, new_pure_area , FORWARD_ONLY);2072 purify_tcr_tlb(other_tcr, a->low, a->active, new_pure_area , FORWARD_ONLY);2020 purify_tcr_xframes(other_tcr, a->low, a->active, new_pure_area); 2021 purify_tcr_tlb(other_tcr, a->low, a->active, new_pure_area); 2073 2022 other_tcr = other_tcr->next; 2074 2023 } while (other_tcr != tcr); 2075 2024 2076 2025 purify_gcable_ptrs(a->low, a->active, new_pure_area); 2077 2026 { 2078 2027 natural puresize = (unsigned) (new_pure_area->active-new_pure_start);
Note:
See TracChangeset
for help on using the changeset viewer.
