summaryrefslogtreecommitdiff
path: root/test/example/c-api-kitchen-sink.c
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2017-06-07 20:28:08 +0200
committerAlon Zakai <alonzakai@gmail.com>2017-06-07 11:28:08 -0700
commit2c220f5cebd915447e786f0b365b0bac1e2f719f (patch)
tree103ed218e637ff868e7ee067d51c25bdeb1a6f9a /test/example/c-api-kitchen-sink.c
parent3f0db5a7aafaaa4de713ff3ba3c3bbeb59fe566e (diff)
downloadbinaryen-2c220f5cebd915447e786f0b365b0bac1e2f719f.tar.gz
binaryen-2c220f5cebd915447e786f0b365b0bac1e2f719f.tar.bz2
binaryen-2c220f5cebd915447e786f0b365b0bac1e2f719f.zip
Update binaryen-c/binaryen.js, fixes #1028, fixes #1029 (#1030)
This PR adds global variable support (addGlobal, getGlobal, setGlobal), host operations (currentMemory, growMemory), a few utility functions (removeImport, removeExport, getFunctionTypeBySignature with the latter being scheduled for removal once a better alternative is in place) and it introduces an additional argument to specify the result type in BinaryenBlock (effectively breaking the C-API but retaining previous behaviour by introducing the BinaryenUndefined() type for this purpose). Additionally, it enables compilation with exception support in build-js.sh as exceptions are thrown and caught when optimizing endless loops, intentionally resulting in an unreachable opcode. Affected test cases have been updated accordingly.
Diffstat (limited to 'test/example/c-api-kitchen-sink.c')
-rw-r--r--test/example/c-api-kitchen-sink.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c
index b2218993c..726dc9ce8 100644
--- a/test/example/c-api-kitchen-sink.c
+++ b/test/example/c-api-kitchen-sink.c
@@ -182,7 +182,7 @@ void test_core() {
makeBinary(module, BinaryenGtFloat64(), 4),
makeBinary(module, BinaryenGeFloat32(), 3),
// All the rest
- BinaryenBlock(module, NULL, NULL, 0), // block with no name
+ BinaryenBlock(module, NULL, NULL, 0, -1), // block with no name and no type
BinaryenIf(module, temp1, temp2, temp3),
BinaryenIf(module, temp4, temp5, NULL),
BinaryenLoop(module, "in", makeInt32(module, 0)),
@@ -224,11 +224,11 @@ void test_core() {
BinaryenExpressionPrint(valueList[3]); // test printing a standalone expression
// Make the main body of the function. and one block with a return value, one without
- BinaryenExpressionRef value = BinaryenBlock(module, "the-value", valueList, sizeof(valueList) / sizeof(BinaryenExpressionRef));
+ BinaryenExpressionRef value = BinaryenBlock(module, "the-value", valueList, sizeof(valueList) / sizeof(BinaryenExpressionRef), -1);
BinaryenExpressionRef droppedValue = BinaryenDrop(module, value);
- BinaryenExpressionRef nothing = BinaryenBlock(module, "the-nothing", &droppedValue, 1);
+ BinaryenExpressionRef nothing = BinaryenBlock(module, "the-nothing", &droppedValue, 1, -1);
BinaryenExpressionRef bodyList[] = { nothing, makeInt32(module, 42) };
- BinaryenExpressionRef body = BinaryenBlock(module, "the-body", bodyList, 2);
+ BinaryenExpressionRef body = BinaryenBlock(module, "the-body", bodyList, 2, -1);
// Create the function
BinaryenType localTypes[] = { BinaryenInt32() };
@@ -460,7 +460,7 @@ void test_relooper() {
{ // return in a block
RelooperRef relooper = RelooperCreate();
BinaryenExpressionRef listList[] = { makeCallCheck(module, 42), BinaryenReturn(module, makeInt32(module, 1337)) };
- BinaryenExpressionRef list = BinaryenBlock(module, "the-list", listList, 2);
+ BinaryenExpressionRef list = BinaryenBlock(module, "the-list", listList, 2, -1);
RelooperBlockRef block = RelooperAddBlock(relooper, list);
BinaryenExpressionRef body = RelooperRenderAndDispose(relooper, block, 0, module);
BinaryenFunctionRef sinker = BinaryenAddFunction(module, "return", i, localTypes, 1, body);