diff options
author | Alon Zakai <azakai@google.com> | 2024-11-07 09:04:36 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-07 09:04:36 -0800 |
commit | e409660a5b4dff9891ddb7d4786cc510a5761d3e (patch) | |
tree | 7a6c907f6aaca91f72c0a4e0642c57ad3dd1cd29 /src/tools | |
parent | 0af8f1f2d7ff304837ee0698265c84985420fcae (diff) | |
download | binaryen-e409660a5b4dff9891ddb7d4786cc510a5761d3e.tar.gz binaryen-e409660a5b4dff9891ddb7d4786cc510a5761d3e.tar.bz2 binaryen-e409660a5b4dff9891ddb7d4786cc510a5761d3e.zip |
[wasm64] Make interpreter table methods operate on Address, not Index (#7062)
This allows 64-bit bounds checking to work properly.
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/execution-results.h | 4 | ||||
-rw-r--r-- | src/tools/wasm-ctor-eval.cpp | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/tools/execution-results.h b/src/tools/execution-results.h index eb302b4b2..78cc5af1f 100644 --- a/src/tools/execution-results.h +++ b/src/tools/execution-results.h @@ -84,7 +84,7 @@ public: if (!exportedTable) { throwEmptyException(); } - Index index = arguments[0].geti32(); + auto index = arguments[0].getUnsigned(); if (index >= tables[exportedTable].size()) { throwEmptyException(); } @@ -93,7 +93,7 @@ public: if (!exportedTable) { throwEmptyException(); } - Index index = arguments[0].geti32(); + auto index = arguments[0].getUnsigned(); if (index >= tables[exportedTable].size()) { throwEmptyException(); } diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp index 499c1bf6c..52c83b053 100644 --- a/src/tools/wasm-ctor-eval.cpp +++ b/src/tools/wasm-ctor-eval.cpp @@ -290,7 +290,7 @@ struct CtorEvalExternalInterface : EvallingModuleRunner::ExternalInterface { // We assume the table is not modified FIXME Literals callTable(Name tableName, - Index index, + Address index, HeapType sig, Literals& arguments, Type result, @@ -363,12 +363,13 @@ struct CtorEvalExternalInterface : EvallingModuleRunner::ExternalInterface { return wasm->getTableOrNull(tableName)->initial; } - Literal tableLoad(Name tableName, Index index) override { + Literal tableLoad(Name tableName, Address index) override { throw FailToEvalException("table.get: TODO"); } // called during initialization - void tableStore(Name tableName, Index index, const Literal& value) override { + void + tableStore(Name tableName, Address index, const Literal& value) override { // We allow stores to the table during initialization, but not after, as we // assume the table does not change at runtime. // TODO: Allow table changes by updating the table later like we do with the |