Commit b8e531b
fix(codegen): wire string_length lowering — sibling to #362's interp binding
The interp binding for string_length landed in #362 (already on main),
but the wasm-backend codegen still does not know it — `codegen.ml`'s
`ExprApp` dispatch fell through to the "Function or variable not found"
error path. The codegen-test fixtures env_at.affine / arg_at.affine /
env_count_and_at.affine all call `string_length(env_at(0))` etc., so
the dune-runtest codegen-fixture loop fails at code-generation time
even after the resolver / typechecker (#332) and interp (#362) layers
were wired.
AS string layout is `[len: i32][bytes...]` at the pointer the arg
evaluates to — reading the length is one `i32.load` at offset 0. Same
shape as the existing tuple-index / record-field load patterns. Three
lines of effective code in the handler.
Closes the gap for ADR-015 S5 (env_at/arg_at) too: their codegen
emits a length-prefixed AS string, and the fixture tests then need
string_length to read that length back. Both pieces (env_at/arg_at
wiring + string_length codegen lowering) are required for the
fixtures to compile end-to-end.
Refs #332 (STDLIB-04e originating ticket), Refs #361 (queue-clearance
incident), follow-on to #362 (interp side) and #364's env_at/arg_at
wiring earlier in this PR.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 7186e06 commit b8e531b
1 file changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
908 | 908 | | |
909 | 909 | | |
910 | 910 | | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
911 | 922 | | |
912 | 923 | | |
913 | 924 | | |
| |||
0 commit comments