summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-02-15 18:21:26 -0800
committerGitHub <noreply@github.com>2023-02-15 18:21:26 -0800
commit670b73681c56a42930f65c7a293a062e168c39fc (patch)
tree47bda97e22a789338e25a817d44531ddfe405d8e /src/tools
parentc4d15efc62fb6e6b55dd128e62896c93ca52c98a (diff)
downloadbinaryen-670b73681c56a42930f65c7a293a062e168c39fc.tar.gz
binaryen-670b73681c56a42930f65c7a293a062e168c39fc.tar.bz2
binaryen-670b73681c56a42930f65c7a293a062e168c39fc.zip
[Strings] Initial string execution support (#5491)
Store string data as GC data. Inefficient (one Const per char), but ok for now. Implement string.new_wtf16 and string.const, enough for basic testing. Create strings in makeConstantExpression, which enables ctor-eval support. Print strings in fuzz-exec which makes testing easier.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/execution-results.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tools/execution-results.h b/src/tools/execution-results.h
index 925c9b6d8..d12c84d1e 100644
--- a/src/tools/execution-results.h
+++ b/src/tools/execution-results.h
@@ -116,12 +116,15 @@ struct ExecutionResults {
if (values->size() > 0) {
std::cout << "[fuzz-exec] note result: " << exp->name << " => ";
auto resultType = func->getResults();
- if (resultType.isRef()) {
+ if (resultType.isRef() && !resultType.isString()) {
// Don't print reference values, as funcref(N) contains an index
// for example, which is not guaranteed to remain identical after
// optimizations.
std::cout << resultType << '\n';
} else {
+ // Non-references can be printed in full. So can strings, since we
+ // always know how to print them and there is just one string
+ // type.
std::cout << *values << '\n';
}
}