diff options
author | Alon Zakai <azakai@google.com> | 2022-08-23 12:39:33 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-23 12:39:33 -0700 |
commit | 0ee15961e43e0282b014e4328458e065b6976ba7 (patch) | |
tree | 5b9f62084e2af1bbfcfc1d27f76a1e826a03a3b0 /src/js/binaryen.js-post.js | |
parent | 4b635ecc3ef9ab56afab8061faba69c07eb38740 (diff) | |
download | binaryen-0ee15961e43e0282b014e4328458e065b6976ba7.tar.gz binaryen-0ee15961e43e0282b014e4328458e065b6976ba7.tar.bz2 binaryen-0ee15961e43e0282b014e4328458e065b6976ba7.zip |
Fix multi-memory + C API for MemoryGrow and MemorySize (#4953)
Those instructions need to know if the memory is 64-bit or not. We looked that
up on the module globally, which is convenient, but in the C API this was actually
a breaking change, it turns out. To keep things working, provide that information
when creating a MemoryGrow or MemorySize, as another parameter in the C
API. In the C++ API (wasm-builder), support both modes, and default to the
automatic lookup.
We already require a bunch of other explicit info when creating expressions, like
making a Call requires the return type (we don't look it up globally), and even a
LocalGet requires the local type (we don't look it up on the function), so this is
consistent with those.
Fixes #4946
Diffstat (limited to 'src/js/binaryen.js-post.js')
-rw-r--r-- | src/js/binaryen.js-post.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index 53930e16c..c684553a5 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -687,11 +687,12 @@ function wrapModule(module, self = {}) { } self['memory'] = { - 'size'(name) { - return Module['_BinaryenMemorySize'](module, strToStack(name)); + // memory64 defaults to undefined/false. + 'size'(name, memory64) { + return Module['_BinaryenMemorySize'](module, strToStack(name), memory64); }, - 'grow'(value, name) { - return Module['_BinaryenMemoryGrow'](module, value, strToStack(name)); + 'grow'(value, name, memory64) { + return Module['_BinaryenMemoryGrow'](module, value, strToStack(name), memory64); }, 'init'(segment, dest, offset, size, name) { return Module['_BinaryenMemoryInit'](module, segment, dest, offset, size, strToStack(name)); |