diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2019-04-05 19:48:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-05 19:48:54 -0700 |
commit | 37443aef8c22f100dc59e81aff6af5a252f3217d (patch) | |
tree | ae68bcc8b6bbc4f2b7fdd1f50349b9980e59f10f /test/binaryen.js | |
parent | 5b24f039ba1f55520a61f6dd6bb8ca46556c592b (diff) | |
download | binaryen-37443aef8c22f100dc59e81aff6af5a252f3217d.tar.gz binaryen-37443aef8c22f100dc59e81aff6af5a252f3217d.tar.bz2 binaryen-37443aef8c22f100dc59e81aff6af5a252f3217d.zip |
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.
Diffstat (limited to 'test/binaryen.js')
-rw-r--r-- | test/binaryen.js/kitchen-sink.js | 16 | ||||
-rw-r--r-- | test/binaryen.js/kitchen-sink.js.txt | 12 |
2 files changed, 20 insertions, 8 deletions
diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js index 860fdf37d..1efccfd97 100644 --- a/test/binaryen.js/kitchen-sink.js +++ b/test/binaryen.js/kitchen-sink.js @@ -421,10 +421,18 @@ function test_core() { // Memory. One per module - module.setMemory(1, 256, "mem", [{ - offset: module.i32.const(10), - data: "hello, world".split('').map(function(x) { return x.charCodeAt(0) }) - }]); + module.setMemory(1, 256, "mem", [ + { + passive: false, + offset: module.i32.const(10), + data: "hello, world".split('').map(function(x) { return x.charCodeAt(0) }) + }, + { + passive: true, + offset: null, + data: "I am passive".split('').map(function(x) { return x.charCodeAt(0) }) + } + ]); // Start function. One per module diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index e5eb3cf65..0955fa515 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -59,6 +59,7 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} (import "module" "base" (func $an-imported (param i32 f64) (result f32))) (memory $0 1 256) (data (i32.const 10) "hello, world") + (data passive "I am passive") (table $0 1 funcref) (elem (i32.const 0) "$kitchen()sinker") (export "kitchen_sinker" (func "$kitchen()sinker")) @@ -3351,10 +3352,12 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} expressions[656] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); { const char segment0[] = { 104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100 }; - const char* segments[] = { segment0 }; - BinaryenExpressionRef segmentOffsets[] = { expressions[656] }; - BinaryenIndex segmentSizes[] = { 12 }; - BinaryenSetMemory(the_module, 1, 256, "mem", segments, segmentOffsets, segmentSizes, 1, 0); + const char segment1[] = { 73, 32, 97, 109, 32, 112, 97, 115, 115, 105, 118, 101 }; + const char* segments[] = { segment0, segment1 }; + int8_t segmentPassive[] = { 0, 1 }; + BinaryenExpressionRef segmentOffsets[] = { expressions[656], expressions[0] }; + BinaryenIndex segmentSizes[] = { 12, 12 }; + BinaryenSetMemory(the_module, 1, 256, "mem", segments, segmentPassive, segmentOffsets, segmentSizes, 2, 0); } { BinaryenType paramTypes[] = { 0 }; @@ -3381,6 +3384,7 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} (import "module" "base" (func $an-imported (param i32 f64) (result f32))) (memory $0 1 256) (data (i32.const 10) "hello, world") + (data passive "I am passive") (table $0 1 funcref) (elem (i32.const 0) "$kitchen()sinker") (export "kitchen_sinker" (func "$kitchen()sinker")) |