summaryrefslogtreecommitdiff
path: root/src/passes/Print.cpp
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-07-12 16:48:06 -0400
committerGitHub <noreply@github.com>2024-07-12 13:48:06 -0700
commiteda6530a187add28f06d9ab84d78b21b5001a6df (patch)
treeb731f8dc5a32a1b8e969f47f82f497909a236c71 /src/passes/Print.cpp
parent0e0e08db6280dec4f4fcce2dff3ba07445c45b8a (diff)
downloadbinaryen-eda6530a187add28f06d9ab84d78b21b5001a6df.tar.gz
binaryen-eda6530a187add28f06d9ab84d78b21b5001a6df.tar.bz2
binaryen-eda6530a187add28f06d9ab84d78b21b5001a6df.zip
[threads] ref.i31_shared (#6735)
Implement `ref.i31_shared` the new instruction for creating references to shared i31s. Implement binary and text parsing and emitting as well as interpretation. Copy the upstream spec test for i31 and modify it so that all the heap types are shared. Comment out some parts that we do not yet support.
Diffstat (limited to 'src/passes/Print.cpp')
-rw-r--r--src/passes/Print.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index 2e9800775..ede49ab38 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -2076,7 +2076,11 @@ struct PrintExpressionContents
o << std::max(curr->tuple->type.size(), size_t(2)) << " ";
o << curr->index;
}
- void visitRefI31(RefI31* curr) { printMedium(o, "ref.i31"); }
+ void visitRefI31(RefI31* curr) {
+ bool shared =
+ curr->type != Type::unreachable && curr->type.getHeapType().isShared();
+ printMedium(o, shared ? "ref.i31_shared" : "ref.i31");
+ }
void visitI31Get(I31Get* curr) {
printMedium(o, curr->signed_ ? "i31.get_s" : "i31.get_u");
}