diff options
author | Alon Zakai <azakai@google.com> | 2024-08-16 12:53:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-16 12:53:52 -0700 |
commit | 958ff4115e542ef1d0ae712f4961e342386efe54 (patch) | |
tree | 7805d641d9a73b32650a053931c4bd8c3814d804 /src/parser/parsers.h | |
parent | 7209629bec3961fcc12b150ba6df546d3997b6c2 (diff) | |
download | binaryen-958ff4115e542ef1d0ae712f4961e342386efe54.tar.gz binaryen-958ff4115e542ef1d0ae712f4961e342386efe54.tar.bz2 binaryen-958ff4115e542ef1d0ae712f4961e342386efe54.zip |
Implement table.init (#6827)
Also use TableInit in the interpreter to initialize module's table
state, which will now handle traps properly, fixing #6431
Diffstat (limited to 'src/parser/parsers.h')
-rw-r--r-- | src/parser/parsers.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/parser/parsers.h b/src/parser/parsers.h index 23286bb28..85a1febb5 100644 --- a/src/parser/parsers.h +++ b/src/parser/parsers.h @@ -206,6 +206,8 @@ Result<> makeTableFill(Ctx&, Index, const std::vector<Annotation>&); template<typename Ctx> Result<> makeTableCopy(Ctx&, Index, const std::vector<Annotation>&); template<typename Ctx> +Result<> makeTableInit(Ctx&, Index, const std::vector<Annotation>&); +template<typename Ctx> Result<> makeThrow(Ctx&, Index, const std::vector<Annotation>&); template<typename Ctx> Result<> makeRethrow(Ctx&, Index, const std::vector<Annotation>&); @@ -2069,6 +2071,16 @@ makeTableCopy(Ctx& ctx, Index pos, const std::vector<Annotation>& annotations) { template<typename Ctx> Result<> +makeTableInit(Ctx& ctx, Index pos, const std::vector<Annotation>& annotations) { + auto table = maybeTableidx(ctx); + CHECK_ERR(table); + auto elem = elemidx(ctx); + CHECK_ERR(elem); + return ctx.makeTableInit(pos, annotations, table.getPtr(), *elem); +} + +template<typename Ctx> +Result<> makeThrow(Ctx& ctx, Index pos, const std::vector<Annotation>& annotations) { auto tag = tagidx(ctx); CHECK_ERR(tag); |