Complete the ChildTyper migration of validator child-type checks
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
Research direction
Start with src/wasm/wasm-validator.cpp and src/ir/child-typer.h, then run the coverage diff described in the issue for each remaining validator method. Migrate methods whose child-type cases match, document methods dominated by non-child checks, and extend ChildTyper first when validator cases are missing; run python3 check.py lit and repeat the coverage diffs for each batch.
Written by the indexing model from the issue text.
Description
Problem:
#6613 migrated four methods (visitUnary, visitBinary,
visitRefIsNull, visitRefEq) to a ValidatorTypeChecker subclass of
ChildTyper. Roughly 70 methods with ChildTyper counterparts
remain unmigrated. The issue's stated goal — "Using ChildTyper
would delete code and improve correctness" — is partially
achieved.
Migrated (4):
visitUnary, visitBinary, visitRefIsNull, visitRefEq.
Blocked by sharedness (2), see the sibling issue:
visitI31Get, visitCallRef.
Deliberately skipped, with reasoning:
SIMD family (7 methods). Switch is dominated by immediate
validation (lane index range), memory helpers (validateOffset,
validateAlignment), and result-type computation. At most one
child-type check per method; migration would add a cross-file
dependency without code reduction.
Tuple family (visitTupleExtract, visitTupleMake). Result-type
checks, not child-type checks.
visitRefI31, visitRefAs. Feature-gate switches with one
migratable child-type check apiece.
Not yet examined:
visitCall, visitCallIndirect visitStructGet, visitStructSet, visitStructRMW, visitStructCmpxchg, visitStructWait visitArrayNew, visitArrayNewData, visitArrayNewElem, visitArrayNewFixed, visitArrayGet, visitArraySet, visitArrayLoad, visitArrayStore, visitArrayLen, visitArrayCopy, visitArrayFill, visitArrayInitData, visitArrayInitElem, visitArrayRMW, visitArrayCmpxchg visitStringNew, visitStringMeasure, visitStringEncode, visitStringConcat, visitStringEq, visitStringTest, visitStringWTF16Get, visitStringSliceWTF visitContNew, visitContBind, visitSuspend, visitResume, visitResumeThrow, visitStackSwitch visitTryTable, visitThrow, visitThrowRef visitBrOn, visitRefTest, visitRefCast, visitRefGetDesc visitDrop, visitReturn, visitMemoryGrow visitTableGet, visitTableSet, visitTableGrow, visitTableFill, visitTableCopy, visitTableInit visitMemoryInit, visitMemoryCopy, visitMemoryFill visitAtomicRMW, visitAtomicCmpxchg, visitAtomicWait, visitAtomicNotify
and others.
Proposed approach: For each remaining method, run the same
coverage diff that #6613 used:
git show HEAD:src/wasm/wasm-validator.cpp \
| awk '/^void FunctionValidator::visitM(/{p=1} p{print} p && /^}/{exit}' \
| grep -oE 'case [A-Za-z0-9_]+:' | sort -u > /tmp/val.txt
sed -n '/void visitM(/,/^ }/p' src/ir/child-typer.h \
| grep -oE 'case [A-Za-z0-9_]+:' | sort -u > /tmp/ct.txt
diff /tmp/val.txt /tmp/ct.txt
If the diff is empty, migrate. If the method's switch is dominated
by non-child checks, skip and document. If the diff is non-empty
in the validator direction, ChildTyper is missing opcodes and
must be extended first.
Verification per batch: python3 check.py lit, plus the coverage
diff for each migrated method.
Follow-up: Batch 2 of this work is the array and struct accessor
families, which are structurally similar and likely share a
common migration pattern.
Refs #6613.
- Dominant language
- WebAssembly
- Stars
- 8.6k
- Forks
- 885
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 64
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from WebAssembly/binaryen
-
Difficulty 2/5 Half a day Newbie friendliness 76/100
WebAssembly/binaryen#9018 · 3 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
WebAssembly/binaryen#9122 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
WebAssembly/binaryen#9086 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
WebAssembly/binaryen#9038 · 5 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
WebAssembly/binaryen#9006 · 2 comments ·
All issues in WebAssembly/binaryen
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
objectionary/eo#8869 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
EricSpencer00/Resilient#4824 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
objectionary/jeo-maven-plugin#1758 ·
-
generics
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
mlir
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
llvm/llvm-project#224908 · 1 comment ·