From 37443aef8c22f100dc59e81aff6af5a252f3217d Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Fri, 5 Apr 2019 19:48:54 -0700 Subject: Passive segments (#1976) Adds support for the bulk memory proposal's passive segments. Uses a new (data passive ...) s-expression syntax to mark sections as passive. --- src/js/binaryen.js-post.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/js/binaryen.js-post.js') diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index 1796080fc..b9f6b426c 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -1831,8 +1831,8 @@ function wrapModule(module, self) { ); }); }; - self['setMemory'] = function(initial, maximum, exportName, segments, shared) { - // segments are assumed to be { offset: expression ref, data: array of 8-bit data } + self['setMemory'] = function(initial, maximum, exportName, segments, flags, shared) { + // segments are assumed to be { passive: bool, offset: expression ref, data: array of 8-bit data } if (!segments) segments = []; return preserveStack(function() { return Module['_BinaryenSetMemory']( @@ -1842,6 +1842,11 @@ function wrapModule(module, self) { return allocate(segment.data, 'i8', ALLOC_STACK); }) ), + i8sToStack( + segments.map(function(segment) { + return segment.passive; + }) + ), i32sToStack( segments.map(function(segment) { return segment.offset; -- cgit v1.2.3