summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2022-07-21 08:40:46 -0700
committerGitHub <noreply@github.com>2022-07-21 08:40:46 -0700
commit880e8352ee1fff828d15da5a7fe3a7932f577ef8 (patch)
tree74c1bbe5d1c8d962c57764dca29e28c6fa08412d /src
parentda5035f893ce9e046f99cf3ede92b576024aa9da (diff)
downloadbinaryen-880e8352ee1fff828d15da5a7fe3a7932f577ef8.tar.gz
binaryen-880e8352ee1fff828d15da5a7fe3a7932f577ef8.tar.bz2
binaryen-880e8352ee1fff828d15da5a7fe3a7932f577ef8.zip
Remove usage of emscripten's deprecated allocate runtime function (#4795)
Diffstat (limited to 'src')
-rw-r--r--src/js/binaryen.js-post.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js
index f2e5c464e..0be7f6ebd 100644
--- a/src/js/binaryen.js-post.js
+++ b/src/js/binaryen.js-post.js
@@ -9,7 +9,7 @@ function preserveStack(func) {
}
function strToStack(str) {
- return str ? allocate(intArrayFromString(str), ALLOC_STACK) : 0;
+ return str ? allocateUTF8OnStack(str) : 0;
}
function i32sToStack(i32s) {
@@ -2484,7 +2484,8 @@ function wrapModule(module, self = {}) {
const segmentOffset = new Array(segmentsLen);
for (let i = 0; i < segmentsLen; i++) {
const { data, offset, passive } = segments[i];
- segmentData[i] = allocate(data, ALLOC_STACK);
+ segmentData[i] = stackAlloc(data.length);
+ HEAP8.set(data, segmentData[i]);
segmentDataLen[i] = data.length;
segmentPassive[i] = passive;
segmentOffset[i] = offset;
@@ -3323,7 +3324,8 @@ Module['emitText'] = function(expr) {
Object.defineProperty(Module, 'readBinary', { writable: true });
Module['readBinary'] = function(data) {
- const buffer = allocate(data, ALLOC_NORMAL);
+ const buffer = _malloc(data.length);
+ HEAP8.set(data, buffer);
const ptr = Module['_BinaryenModuleRead'](buffer, data.length);
_free(buffer);
return wrapModule(ptr);