gc-mark-optimization.patch

Kurt Stephens, 07/16/2011 04:45 PM

Download (3.17 KB)

View differences:

gc.c
1786 1786
		gc_mark(objspace, (VALUE)obj->as.node.u2.node, lev);
1787 1787
	    }
1788 1788
	    if (is_pointer_to_heap(objspace, obj->as.node.u3.node)) {
1789
		gc_mark(objspace, (VALUE)obj->as.node.u3.node, lev);
1789
	        ptr = (VALUE)obj->as.node.u3.node; goto again;
1790 1790
	    }
1791 1791
	}
1792 1792
	return;			/* no need to mark class. */
......
1809 1809
	    goto again;
1810 1810
	}
1811 1811
	else {
1812
	    long i, len = RARRAY_LEN(obj);
1813
	    VALUE *ptr = RARRAY_PTR(obj);
1814
	    for (i=0; i < len; i++) {
1815
		gc_mark(objspace, *ptr++, lev);
1816
	    }
1812
	    long len = RARRAY_LEN(obj);
1813
	    VALUE *vptr = RARRAY_PTR(obj);
1814
            if ( len ) {
1815
	        while ( -- len ) {
1816
		    gc_mark(objspace, *vptr++, lev);
1817
	        }
1818
		ptr = *vptr; goto again;
1819
            }
1817 1820
	}
1818 1821
	break;
1819 1822

  
......
1842 1845

  
1843 1846
      case T_OBJECT:
1844 1847
        {
1845
            long i, len = ROBJECT_NUMIV(obj);
1846
	    VALUE *ptr = ROBJECT_IVPTR(obj);
1847
            for (i  = 0; i < len; i++) {
1848
		gc_mark(objspace, *ptr++, lev);
1848
            long len = ROBJECT_NUMIV(obj);
1849
	    VALUE *vptr = ROBJECT_IVPTR(obj);
1850
            if ( len ) {
1851
	        while ( -- len ) {
1852
	            gc_mark(objspace, *vptr++, lev);
1853
                }
1854
	        ptr = *vptr; goto again;
1849 1855
            }
1850 1856
        }
1851 1857
	break;
......
1857 1863
            gc_mark(objspace, obj->as.file.fptr->writeconv_asciicompat, lev);
1858 1864
            gc_mark(objspace, obj->as.file.fptr->writeconv_pre_ecopts, lev);
1859 1865
            gc_mark(objspace, obj->as.file.fptr->encs.ecopts, lev);
1860
            gc_mark(objspace, obj->as.file.fptr->write_lock, lev);
1866
            ptr = obj->as.file.fptr->write_lock; goto again;
1861 1867
        }
1862 1868
        break;
1863 1869

  
1864 1870
      case T_REGEXP:
1865
        gc_mark(objspace, obj->as.regexp.src, lev);
1871
        ptr = obj->as.regexp.src; goto again;
1866 1872
        break;
1867 1873

  
1868 1874
      case T_FLOAT:
......
1871 1877
	break;
1872 1878

  
1873 1879
      case T_MATCH:
1874
	gc_mark(objspace, obj->as.match.regexp, lev);
1875 1880
	if (obj->as.match.str) {
1881
            gc_mark(objspace, obj->as.match.regexp, lev);
1876 1882
	    ptr = obj->as.match.str;
1877 1883
	    goto again;
1878
	}
1884
	} else {
1885
	    ptr = obj->as.match.regexp; goto again;
1886
        }
1879 1887
	break;
1880 1888

  
1881 1889
      case T_RATIONAL:
1882 1890
	gc_mark(objspace, obj->as.rational.num, lev);
1883
	gc_mark(objspace, obj->as.rational.den, lev);
1891
	ptr = obj->as.rational.den; goto again;
1884 1892
	break;
1885 1893

  
1886 1894
      case T_COMPLEX:
1887 1895
	gc_mark(objspace, obj->as.complex.real, lev);
1888
	gc_mark(objspace, obj->as.complex.imag, lev);
1896
	ptr = obj->as.complex.imag; goto again;
1889 1897
	break;
1890 1898

  
1891 1899
      case T_STRUCT:
1892 1900
	{
1893 1901
	    long len = RSTRUCT_LEN(obj);
1894
	    VALUE *ptr = RSTRUCT_PTR(obj);
1902
	    VALUE *vptr = RSTRUCT_PTR(obj);
1895 1903

  
1896
	    while (len--) {
1897
		gc_mark(objspace, *ptr++, lev);
1898
	    }
1904
	    if ( len ) {
1905
	        while ( -- len ) {
1906
		    gc_mark(objspace, *vptr++, lev);
1907
		}
1908
                ptr = *vptr; goto again;
1909
            }
1899 1910
	}
1900 1911
	break;
1901 1912