summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-07-26 19:35:06 -0700
committerGitHub <noreply@github.com>2022-07-26 19:35:06 -0700
commit85b05ebd648e7cc282777a2f445fe9c5b111eeb9 (patch)
tree22f2bfdab678414069eaeae9f923f983d7040ccb
parent24552779ebfbfc8f296d169c1462308aea27591c (diff)
downloadbinaryen-85b05ebd648e7cc282777a2f445fe9c5b111eeb9.tar.gz
binaryen-85b05ebd648e7cc282777a2f445fe9c5b111eeb9.tar.bz2
binaryen-85b05ebd648e7cc282777a2f445fe9c5b111eeb9.zip
[Strings] Add interpreter stubs for string instructions (#4835)
The stubs let precompute skip over them without erroring. With this PR we can run the optimizer on strings code. We still can't run --fuzz-exec though, so we can't run the fuzzer. Also simplify the error strings in the earlier part of the file. All other code just has "unimp" so we might as well do the same and not mention full names there.
-rw-r--r--src/wasm-interpreter.h75
-rw-r--r--test/lit/strings.wast5
2 files changed, 44 insertions, 36 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h
index 399910e7a..107f38f09 100644
--- a/src/wasm-interpreter.h
+++ b/src/wasm-interpreter.h
@@ -1958,44 +1958,22 @@ public:
}
return value;
}
- Flow visitStringNew(StringNew* curr) {
- WASM_UNREACHABLE("unimplemented string.new");
- }
- Flow visitStringConst(StringConst* curr) {
- WASM_UNREACHABLE("unimplemented string.const");
- }
- Flow visitStringMeasure(StringMeasure* curr) {
- WASM_UNREACHABLE("unimplemented string.measure");
- }
- Flow visitStringEncode(StringEncode* curr) {
- WASM_UNREACHABLE("unimplemented string.encode");
- }
- Flow visitStringConcat(StringConcat* curr) {
- WASM_UNREACHABLE("unimplemented string.concat");
- }
- Flow visitStringEq(StringEq* curr) {
- WASM_UNREACHABLE("unimplemented string.eq");
- }
- Flow visitStringAs(StringAs* curr) {
- WASM_UNREACHABLE("unimplemented string.as");
- }
+ Flow visitStringNew(StringNew* curr) { WASM_UNREACHABLE("unimp"); }
+ Flow visitStringConst(StringConst* curr) { WASM_UNREACHABLE("unimp"); }
+ Flow visitStringMeasure(StringMeasure* curr) { WASM_UNREACHABLE("unimp"); }
+ Flow visitStringEncode(StringEncode* curr) { WASM_UNREACHABLE("unimp"); }
+ Flow visitStringConcat(StringConcat* curr) { WASM_UNREACHABLE("unimp"); }
+ Flow visitStringEq(StringEq* curr) { WASM_UNREACHABLE("unimp"); }
+ Flow visitStringAs(StringAs* curr) { WASM_UNREACHABLE("unimp"); }
Flow visitStringWTF8Advance(StringWTF8Advance* curr) {
- WASM_UNREACHABLE("unimplemented stringview_adjust*");
- }
- Flow visitStringWTF16Get(StringWTF16Get* curr) {
- WASM_UNREACHABLE("unimplemented stringview_adjust*");
- }
- Flow visitStringIterNext(StringIterNext* curr) {
- WASM_UNREACHABLE("unimplemented stringview_adjust*");
- }
- Flow visitStringIterMove(StringIterMove* curr) {
- WASM_UNREACHABLE("unimplemented stringview_adjust*");
- }
- Flow visitStringSliceWTF(StringSliceWTF* curr) {
- WASM_UNREACHABLE("unimplemented stringview_adjust*");
+ WASM_UNREACHABLE("unimp");
}
+ Flow visitStringWTF16Get(StringWTF16Get* curr) { WASM_UNREACHABLE("unimp"); }
+ Flow visitStringIterNext(StringIterNext* curr) { WASM_UNREACHABLE("unimp"); }
+ Flow visitStringIterMove(StringIterMove* curr) { WASM_UNREACHABLE("unimp"); }
+ Flow visitStringSliceWTF(StringSliceWTF* curr) { WASM_UNREACHABLE("unimp"); }
Flow visitStringSliceIter(StringSliceIter* curr) {
- WASM_UNREACHABLE("unimplemented stringview_adjust*");
+ WASM_UNREACHABLE("unimp");
}
virtual void trap(const char* why) { WASM_UNREACHABLE("unimp"); }
@@ -2300,6 +2278,33 @@ public:
NOTE_ENTER("Rethrow");
return Flow(NONCONSTANT_FLOW);
}
+ Flow visitStringNew(StringNew* curr) { return Flow(NONCONSTANT_FLOW); }
+ Flow visitStringConst(StringConst* curr) { return Flow(NONCONSTANT_FLOW); }
+ Flow visitStringMeasure(StringMeasure* curr) {
+ return Flow(NONCONSTANT_FLOW);
+ }
+ Flow visitStringEncode(StringEncode* curr) { return Flow(NONCONSTANT_FLOW); }
+ Flow visitStringConcat(StringConcat* curr) { return Flow(NONCONSTANT_FLOW); }
+ Flow visitStringEq(StringEq* curr) { return Flow(NONCONSTANT_FLOW); }
+ Flow visitStringAs(StringAs* curr) { return Flow(NONCONSTANT_FLOW); }
+ Flow visitStringWTF8Advance(StringWTF8Advance* curr) {
+ return Flow(NONCONSTANT_FLOW);
+ }
+ Flow visitStringWTF16Get(StringWTF16Get* curr) {
+ return Flow(NONCONSTANT_FLOW);
+ }
+ Flow visitStringIterNext(StringIterNext* curr) {
+ return Flow(NONCONSTANT_FLOW);
+ }
+ Flow visitStringIterMove(StringIterMove* curr) {
+ return Flow(NONCONSTANT_FLOW);
+ }
+ Flow visitStringSliceWTF(StringSliceWTF* curr) {
+ return Flow(NONCONSTANT_FLOW);
+ }
+ Flow visitStringSliceIter(StringSliceIter* curr) {
+ return Flow(NONCONSTANT_FLOW);
+ }
void trap(const char* why) override { throw NonconstantException(); }
diff --git a/test/lit/strings.wast b/test/lit/strings.wast
index e201b2bd7..859d49bee 100644
--- a/test/lit/strings.wast
+++ b/test/lit/strings.wast
@@ -1,8 +1,11 @@
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
;; Check that string types are emitted properly in the binary format.
+;;
+;; runs --precompute in order to verify no problems occur in the optimizer's
+;; invocation of the interpreter.
-;; RUN: foreach %s %t wasm-opt --enable-strings --enable-reference-types --enable-gc --roundtrip -S -o - | filecheck %s
+;; RUN: foreach %s %t wasm-opt --enable-strings --enable-reference-types --enable-gc --roundtrip --precompute -S -o - | filecheck %s
(module
;; CHECK: (type $stringref_=>_none (func (param stringref)))