Commit 64b6450
committed
Use destroy stack for multi-branch deeply nested arrays
The single-child tail-call only defers one array per level. When
multiple children all reach refcount zero (e.g. two independent
deep chains in one array), the extras still recursed through
rc_dtor_func and could overflow the C stack.
Replace the fallback rc_dtor_func call for additional array children
with a heap-backed destroy stack (small on-stack buffer for the
common case, grows via emalloc when needed). Linear chains still
use the zero-allocation tail-call path.1 parent def9d3c commit 64b6450
2 files changed
+60
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1821 | 1821 | | |
1822 | 1822 | | |
1823 | 1823 | | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
1824 | 1831 | | |
1825 | 1832 | | |
1826 | 1833 | | |
| |||
1841 | 1848 | | |
1842 | 1849 | | |
1843 | 1850 | | |
1844 | | - | |
1845 | | - | |
1846 | | - | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
1847 | 1856 | | |
1848 | 1857 | | |
1849 | 1858 | | |
1850 | 1859 | | |
1851 | | - | |
1852 | | - | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
1853 | 1876 | | |
1854 | 1877 | | |
1855 | 1878 | | |
| |||
1906 | 1929 | | |
1907 | 1930 | | |
1908 | 1931 | | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
1909 | 1941 | | |
1910 | 1942 | | |
1911 | 1943 | | |
| |||
0 commit comments