summaryrefslogtreecommitdiff
path: root/src/js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2019-02-06 12:58:43 -0800
committerGitHub <noreply@github.com>2019-02-06 12:58:43 -0800
commitcc0ccef87716fd8223fc16793c9ec3bc3249da13 (patch)
treebfcc7177c58de939e1346fe8db514b76f01e5d46 /src/js
parent4a0d0d92190d836388844dfbda62d96e4dfcb82d (diff)
downloadbinaryen-cc0ccef87716fd8223fc16793c9ec3bc3249da13.tar.gz
binaryen-cc0ccef87716fd8223fc16793c9ec3bc3249da13.tar.bz2
binaryen-cc0ccef87716fd8223fc16793c9ec3bc3249da13.zip
fix binaryen.js bindings handling of literals (#1896)
The hardcoded 16 size was no longer valid. This was broken for a while, but happened to not overwrite important memory. Testing with the wasm backend did hit breakage.
Diffstat (limited to 'src/js')
-rw-r--r--src/js/binaryen.js-post.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js
index b2dba075b..1bbf7f48e 100644
--- a/src/js/binaryen.js-post.js
+++ b/src/js/binaryen.js-post.js
@@ -486,8 +486,8 @@ function wrapModule(module, self) {
// need to make their own Literals, as the C API handles them by value,
// which means we would leak them. Instead, this is the only API that
// accepts Literals, so fuse it with Literal creation
- var temp = _malloc(16); // a single literal in memory. the LLVM C ABI
- // makes us pass pointers to this.
+ var temp = _malloc(Module['_BinaryenSizeofLiteral']()); // a single literal in memory. the LLVM C ABI
+ // makes us pass pointers to this.
self['i32'] = {
'load': function(offset, align, ptr) {