Commit ab810cb
PR-5c. After PR-5a (#201) the function-value callback ABI passes a
handler as a closure pointer, not a bare __indirect_function_table
index. wrapHandler still did tbl.get(idx)() — wrong on the wasm path
(it would index the table with a heap pointer).
wrapHandler now reads the 8-byte closure pair from exported memory
([i32 function_id @ +0][i32 env_ptr @ +4], per codegen.ml), looks the
compiled lambda up by function_id in __indirect_function_table, and
invokes it with env_ptr as the first argument (the closure calling
convention, codegen.ml:794), zero-filling any further declared params
(the `Unit` handler arg) via fn.length. Returns the handler's result.
registerCommand / onDidSaveTextDocument call sites unchanged; the
now-misnamed `handlerIdx` params renamed to `handlerPtr`.
JS-only (mod.js is not dune-built — no 253 impact). node --check clean.
Correctness is by construction against the documented closure layout +
calling convention. Unblocks the rsr-certifier pilot (PR-5d).
Refs #199
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1e7dfc7 commit ab810cb
1 file changed
Lines changed: 23 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
54 | 59 | | |
55 | 60 | | |
56 | | - | |
| 61 | + | |
| 62 | + | |
57 | 63 | | |
58 | | - | |
59 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
60 | 72 | | |
61 | 73 | | |
62 | 74 | | |
| |||
66 | 78 | | |
67 | 79 | | |
68 | 80 | | |
69 | | - | |
| 81 | + | |
70 | 82 | | |
71 | | - | |
| 83 | + | |
72 | 84 | | |
73 | 85 | | |
74 | 86 | | |
| |||
302 | 314 | | |
303 | 315 | | |
304 | 316 | | |
305 | | - | |
306 | | - | |
| 317 | + | |
| 318 | + | |
307 | 319 | | |
308 | 320 | | |
309 | 321 | | |
| |||
0 commit comments