diff options
author | Daniel Wirtz <dcode@dcode.io> | 2018-05-09 00:18:05 +0200 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2018-05-08 15:18:05 -0700 |
commit | 65ea79b18c1fc2492b993cdde221b974d605a883 (patch) | |
tree | e393af9bc6fab06abd0fc530cb80dba9a697177a /src/binaryen-c.cpp | |
parent | a5d33e7faaa965565f9ca1d0c23c3077389f2389 (diff) | |
download | binaryen-65ea79b18c1fc2492b993cdde221b974d605a883.tar.gz binaryen-65ea79b18c1fc2492b993cdde221b974d605a883.tar.bz2 binaryen-65ea79b18c1fc2492b993cdde221b974d605a883.zip |
Add a way to remove function types to Binaryen-C/.js (#1536)
Diffstat (limited to 'src/binaryen-c.cpp')
-rw-r--r-- | src/binaryen-c.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp index 53daef977..4dd306bd3 100644 --- a/src/binaryen-c.cpp +++ b/src/binaryen-c.cpp @@ -226,6 +226,23 @@ BinaryenFunctionTypeRef BinaryenAddFunctionType(BinaryenModuleRef module, const return ret; } +void BinaryenRemoveFunctionType(BinaryenModuleRef module, const char* name) { + if (tracing) { + std::cout << " BinaryenRemoveFunctionType(the_module, "; + traceNameOrNULL(name); + std::cout << ");\n"; + } + + auto* wasm = (Module*)module; + assert(name != NULL); + + // Lock. This can be called from multiple threads at once, and is a + // point where they all access and modify the module. + { + std::lock_guard<std::mutex> lock(BinaryenFunctionTypeMutex); + wasm->removeFunctionType(name); + } +} BinaryenLiteral BinaryenLiteralInt32(int32_t x) { return toBinaryenLiteral(Literal(x)); } BinaryenLiteral BinaryenLiteralInt64(int64_t x) { return toBinaryenLiteral(Literal(x)); } |