diff options
author | Max Graey <maxgraey@gmail.com> | 2020-08-28 16:23:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-28 15:23:32 +0200 |
commit | fecfa92d71633f8bb28bb97a60adc9b54998456f (patch) | |
tree | 30418c26d7a3aa9aaedb25acc7ce4eca5be25be6 /src | |
parent | 547e2be14d1f8f9b21905baee87b1946045b0fe7 (diff) | |
download | binaryen-fecfa92d71633f8bb28bb97a60adc9b54998456f.tar.gz binaryen-fecfa92d71633f8bb28bb97a60adc9b54998456f.tar.bz2 binaryen-fecfa92d71633f8bb28bb97a60adc9b54998456f.zip |
Add Binaryen(Get|Set)AllowHeavyweight to binaryen-c.h (#3082)
These declarations were previously missing causing the respective APIs to be not exposed. Also makes sure that a Boolean is returned by the JS API and adds a test to verify that it is working now.
Diffstat (limited to 'src')
-rw-r--r-- | src/binaryen-c.cpp | 4 | ||||
-rw-r--r-- | src/binaryen-c.h | 8 | ||||
-rw-r--r-- | src/js/binaryen.js-post.js | 2 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp index 6776b785c..db9258d59 100644 --- a/src/binaryen-c.cpp +++ b/src/binaryen-c.cpp @@ -3528,11 +3528,11 @@ void BinaryenSetOneCallerInlineMaxSize(BinaryenIndex size) { globalPassOptions.inlining.oneCallerInlineMaxSize = size; } -bool BinaryenGetAllowHeavyweight(void) { +int BinaryenGetAllowHeavyweight(void) { return globalPassOptions.inlining.allowHeavyweight; } -void BinaryenSetAllowHeavyweight(bool enabled) { +void BinaryenSetAllowHeavyweight(int enabled) { globalPassOptions.inlining.allowHeavyweight = enabled; } diff --git a/src/binaryen-c.h b/src/binaryen-c.h index d064ceb5c..6239befd2 100644 --- a/src/binaryen-c.h +++ b/src/binaryen-c.h @@ -2124,6 +2124,14 @@ BINARYEN_API BinaryenIndex BinaryenGetOneCallerInlineMaxSize(void); // Applies to all modules, globally. BINARYEN_API void BinaryenSetOneCallerInlineMaxSize(BinaryenIndex size); +// Gets whether heavyweight functions are allowed to be inlined. +// Applies to all modules, globally. +BINARYEN_API int BinaryenGetAllowHeavyweight(void); + +// Sets whether heavyweight functions are allowed to be inlined. +// Applies to all modules, globally. +BINARYEN_API void BinaryenSetAllowHeavyweight(int enabled); + // Runs the specified passes on the module. Uses the currently set global // optimize and shrink level. BINARYEN_API void BinaryenModuleRunPasses(BinaryenModuleRef module, diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index f8a0b8590..057252f78 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -3032,7 +3032,7 @@ Module['setOneCallerInlineMaxSize'] = function(size) { // Gets the value which allow inline functions that are not "lightweight". Module['getAllowHeavyweight'] = function() { - return Module['_BinaryenGetAllowHeavyweight'](); + return Boolean(Module['_BinaryenGetAllowHeavyweight']()); }; // Sets the value which allow inline functions that are not "lightweight". |