summaryrefslogtreecommitdiff
path: root/src/parser/contexts.h
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/parser/contexts.h
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/parser/contexts.h')
-rw-r--r--src/parser/contexts.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/parser/contexts.h b/src/parser/contexts.h
index f58275d71..96a70663d 100644
--- a/src/parser/contexts.h
+++ b/src/parser/contexts.h
@@ -695,7 +695,10 @@ struct NullInstrParserCtx {
Result<> makeCallRef(Index, const std::vector<Annotation>&, HeapTypeT, bool) {
return Ok{};
}
- Result<> makeRefI31(Index, const std::vector<Annotation>&) { return Ok{}; }
+ Result<>
+ makeRefI31(Index, const std::vector<Annotation>&, Shareability share) {
+ return Ok{};
+ }
Result<> makeI31Get(Index, const std::vector<Annotation>&, bool) {
return Ok{};
}
@@ -2363,8 +2366,10 @@ struct ParseDefsCtx : TypeParserCtx<ParseDefsCtx> {
return withLoc(pos, irBuilder.makeCallRef(type, isReturn));
}
- Result<> makeRefI31(Index pos, const std::vector<Annotation>& annotations) {
- return withLoc(pos, irBuilder.makeRefI31());
+ Result<> makeRefI31(Index pos,
+ const std::vector<Annotation>& annotations,
+ Shareability share) {
+ return withLoc(pos, irBuilder.makeRefI31(share));
}
Result<> makeI31Get(Index pos,