Commit c810f7d
committed
feat(typecheck): #234 S2b — build the per-call-site effect side-table (ADR-016)
Builds on S2a (lib/effect_sites.ml shared numbering). `Typecheck`
gains `context.call_effects : (int, eff) Hashtbl.t`, keyed by the
shared `Effect_sites` ordinal, populated by `populate_call_effects`
after a successful check + quantity pass (only on the Ok path).
A call site's row is the callee's *declared* effect row when the
callee is a statically-named function (`f(..)`, `m.f(..)`, through
`ExprSpan`), else EPure. Extern fns parse as `TopFn` with
`FnExtern`/`fd_eff` (parser.mly:188,206), so the same `name -> eff`
map (via the existing `lower_effect_expr`) covers stdlib async
primitives (`http_request_thenable` → `/{Net,Async}`) and
user-defined `Async` functions uniformly. `lower_effect_expr` is
wrapped defensively (→ EPure) though the check pass already validated.
GATE-NEUTRAL by construction: the table is built and returned in the
context but NOTHING reads it yet. S3 threads it into codegen and
switches the WasmGC CPS boundary predicate onto it (structural
recogniser stays the sound table-miss fallback); S4 retires the
hardcoded `async_primitives` set.
Tests (test/test_effect_sites.ml +2): the table has one entry per
call site; a call to a `/{Net,Async}` extern carries Async while a
pure call does not; every `Effect_sites` ordinal is present
(producer/consumer-agreement contract). `dune test --force` 290/290.
Zero regression (no codegen/behaviour change).
Refs #234. Not Closes — staged campaign; owner closes per ISSUE-CLOSURE.1 parent f3c765a commit c810f7d
2 files changed
Lines changed: 122 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
192 | 200 | | |
193 | 201 | | |
194 | 202 | | |
| |||
219 | 227 | | |
220 | 228 | | |
221 | 229 | | |
| 230 | + | |
222 | 231 | | |
223 | 232 | | |
224 | 233 | | |
| |||
1754 | 1763 | | |
1755 | 1764 | | |
1756 | 1765 | | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
1757 | 1813 | | |
1758 | 1814 | | |
1759 | 1815 | | |
| |||
1799 | 1855 | | |
1800 | 1856 | | |
1801 | 1857 | | |
1802 | | - | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
1803 | 1863 | | |
1804 | 1864 | | |
1805 | 1865 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
78 | 135 | | |
79 | 136 | | |
80 | 137 | | |
| |||
85 | 142 | | |
86 | 143 | | |
87 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
88 | 149 | | |
0 commit comments