Comments (9)
Improving the validator this way would let us re-enable the unreached-invalid.wast spec test. @kripken, were you interested in taking a look at this?
from binaryen.
I can look into it, sure.
from binaryen.
A problem that happens here is that ChildTyper seems to assume valid IR already. For example:
Lines 781 to 784 in 1079a9e
getHeapType()
will assert if the type is unreachable, and getSignature()
will assert if it is a non-signature reference type.
I'm not sure offhand what kind of API change would make the most sense here, but doing that as a first step is necessary I think.
from binaryen.
Since ChildTyper
only checks types based on information that would be included in the binary, my expectation is that other properties, including whether we can even produce such information, would be checked by the validator before it calls into ChildTyper
. Basically wherever we have a type annotation in the binary format, the validator will have to check that the type is valid before checking the child types more generally.
from binaryen.
It seems hard to split things out that way, I'm afraid. CallRef
would need to see that the reference child is unreachable and therefore ignore it in ChildTyper. That is, it is valid for that child to be unreachable, so we can't just put a check before calling ChildTyper here. ChildTyper itself would need to do the check or at least I can't see a better way.
from binaryen.
I would expect that when validating a CallRef
, the validator would only call into ChildTyper
if the ref is a typed function reference. Why is it hard to split out that way?
from binaryen.
I guess nothing after it needs to be validated if the ref is not a signature, but I'm not sure that's the case elsewhere - in general we may have one child be unreachable and need to ignore it, but not another.
Also, that would mean that the decision to call the ChildTyper must be done in visitCallRef
or such, that is, it is specific to each expression class. That means we can't do it in a more generic location which would have been a lot simpler/shorter.
from binaryen.
Ah, as an example for the first paragraph in the last comment, see StringEncode:
Lines 987 to 995 in 1079a9e
If the array is unreachable we still need to reach the last line that validates the i32 type of another child.
from binaryen.
Also, that would mean that the decision to call the ChildTyper must be done in
visitCallRef
or such, that is, it is specific to each expression class. That means we can't do it in a more generic location which would have been a lot simpler/shorter.
Yes, it would be an annoyingly large PR. An alternative might be to have ChildTyper
detect when there's not enough information to type some children and fall back to some more general constraint only for those particular children. So in the example above, we could leave array
unconstrained by still ensure that str
and start
have the correct types.
from binaryen.
Related Issues (20)
- Add support for Wasm components in wasm-opt HOT 13
- Assertion failed in wasm-as when casting to externref HOT 1
- Missing error when `struct.new` has too many arguments in assembler HOT 2
- binaryen fails to compile in Arch clean chroot HOT 3
- Module::getMemory: 0 does not exist HOT 1
- Scratch local always used for br_if with value? HOT 2
- support to add custom sections at the beginning of module
- GUFA miscompilation with shared i31 cast HOT 1
- GCC maybe-uninitialized failure HOT 3
- Assertion failed: isRef() (/src/src/wasm/wasm-type.cpp: getHeapType: 930) HOT 4
- Start publishing signature files for binaryen artifacts HOT 7
- Parser error on CallRef of shared nofunc HOT 2
- Are there plans for Rust bindings? HOT 6
- wasm-emscripten-finalize doesn't preserve sourcesContent
- Wat parser assertion on invalid subtype
- Support cross-module calls properly in the interpreter HOT 1
- Are there any limits on nested blocks/loops in binaryen ? HOT 2
- miss-optimization for continuous add HOT 2
- [Segmentation fault] Out-of-bounds read in wasm::WATParser::makeArrayInitElem HOT 3
- GC feature and anyref/nullref? (fuzzer error) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from binaryen.