diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-08-16 09:40:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-16 09:40:59 -0700 |
commit | e5e3bf39f25ed3a2fb45a9ca1f55d6828d81a3eb (patch) | |
tree | 834f67d6ebaf295af0e1d6789bc7f52d120dff33 /test/example | |
parent | e268d939b86d8639d014b8036e7664d66b6a32e9 (diff) | |
parent | 7851e3a7a3bea679f422116862c5801f1938806d (diff) | |
download | binaryen-e5e3bf39f25ed3a2fb45a9ca1f55d6828d81a3eb.tar.gz binaryen-e5e3bf39f25ed3a2fb45a9ca1f55d6828d81a3eb.tar.bz2 binaryen-e5e3bf39f25ed3a2fb45a9ca1f55d6828d81a3eb.zip |
Merge pull request #668 from WebAssembly/tables_n_memories
Tables and memories
Diffstat (limited to 'test/example')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 2 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 23 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt.txt | 8 |
3 files changed, 17 insertions, 16 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 496ac4efd..0aaf5ab95 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -246,7 +246,7 @@ void test_core() { // Memory. One per module const char *segments[] = { "hello, world" }; - BinaryenIndex segmentOffsets[] = { 10 }; + BinaryenExpressionRef segmentOffsets[] = { BinaryenConst(module, BinaryenLiteralInt32(10)) }; BinaryenIndex segmentSizes[] = { 12 }; BinaryenSetMemory(module, 1, 256, "mem", segments, segmentOffsets, segmentSizes, 1); diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 64f5fc3b4..42a5bfee1 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -7,9 +7,8 @@ BinaryenFloat64: 4 (f32.const -33.61199951171875) ) (module - (memory 1 256 - (segment 10 "hello, world") - ) + (memory 1 256) + (data (i32.const 10) "hello, world") (export "mem" memory) (start $starter) (type $iiIfF (func (param i32 i64 f32 f64) (result i32))) @@ -18,7 +17,8 @@ BinaryenFloat64: 4 (type $3 (func)) (import $an-imported "module" "base" (param i32 f64) (result f32)) (export "kitchen_sinker" "$kitchen()sinker") - (table "$kitchen()sinker") + (table 1 1 anyfunc) + (elem (i32.const 0) "$kitchen()sinker") (func "$kitchen()sinker" (type $iiIfF) (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32) (local $4 i32) (block $the-body @@ -1375,10 +1375,11 @@ int main() { BinaryenFunctionRef funcs[] = { functions[0] }; BinaryenSetFunctionTable(the_module, funcs, 1); } + expressions[245] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); { const char segment0[] = { 104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100 }; const char* segments[] = { segment0 }; - BinaryenIndex segmentOffsets[] = { 10 }; + BinaryenExpressionRef segmentOffsets[] = { expressions[245] }; BinaryenIndex segmentSizes[] = { 12 }; BinaryenSetMemory(the_module, 1, 256, "mem", segments, segmentOffsets, segmentSizes, 1); } @@ -1386,10 +1387,10 @@ int main() { BinaryenIndex paramTypes[] = { 0 }; functionTypes[2] = BinaryenAddFunctionType(the_module, "v", 0, paramTypes, 0); } - expressions[245] = BinaryenNop(the_module); + expressions[246] = BinaryenNop(the_module); { BinaryenType varTypes[] = { 0 }; - functions[1] = BinaryenAddFunction(the_module, "starter", functionTypes[2], varTypes, 0, expressions[245]); + functions[1] = BinaryenAddFunction(the_module, "starter", functionTypes[2], varTypes, 0, expressions[246]); } BinaryenSetStart(the_module, functions[1]); { @@ -1399,9 +1400,8 @@ int main() { BinaryenModuleValidate(the_module); BinaryenModulePrint(the_module); (module - (memory 1 256 - (segment 10 "hello, world") - ) + (memory 1 256) + (data (i32.const 10) "hello, world") (export "mem" memory) (start $starter) (type $iiIfF (func (param i32 i64 f32 f64) (result i32))) @@ -1410,7 +1410,8 @@ int main() { (type $3 (func)) (import $an-imported "module" "base" (param i32 f64) (result f32)) (export "kitchen_sinker" "$kitchen()sinker") - (table "$kitchen()sinker") + (table 1 1 anyfunc) + (elem (i32.const 0) "$kitchen()sinker") (func "$kitchen()sinker" (type $iiIfF) (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32) (local $4 i32) (block $the-body diff --git a/test/example/c-api-kitchen-sink.txt.txt b/test/example/c-api-kitchen-sink.txt.txt index 96cbaaa00..7e32ba431 100644 --- a/test/example/c-api-kitchen-sink.txt.txt +++ b/test/example/c-api-kitchen-sink.txt.txt @@ -2,9 +2,8 @@ (f32.const -33.61199951171875) ) (module - (memory 1 256 - (segment 10 "hello, world") - ) + (memory 1 256) + (data (i32.const 10) "hello, world") (export "mem" memory) (start $starter) (type $iiIfF (func (param i32 i64 f32 f64) (result i32))) @@ -13,7 +12,8 @@ (type $3 (func)) (import $an-imported "module" "base" (param i32 f64) (result f32)) (export "kitchen_sinker" "$kitchen()sinker") - (table "$kitchen()sinker") + (table 1 1 anyfunc) + (elem (i32.const 0) "$kitchen()sinker") (func "$kitchen()sinker" (type $iiIfF) (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32) (local $4 i32) (block $the-body |