summaryrefslogtreecommitdiff
path: root/test/binaryen.js/low-memory-unused.js.txt
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2020-02-08 00:52:15 +0100
committerGitHub <noreply@github.com>2020-02-07 15:52:15 -0800
commit2b77f6ae60cfaf3f3cbdcc4121e82a619b9372c3 (patch)
tree0992863a82cc06d6cb591e4b2a32867b927f472d /test/binaryen.js/low-memory-unused.js.txt
parent2119f3fcc32c58d581d7c86b7612e3bc89da24e0 (diff)
downloadbinaryen-2b77f6ae60cfaf3f3cbdcc4121e82a619b9372c3.tar.gz
binaryen-2b77f6ae60cfaf3f3cbdcc4121e82a619b9372c3.tar.bz2
binaryen-2b77f6ae60cfaf3f3cbdcc4121e82a619b9372c3.zip
Add C-/JS-APIs for lowMemoryUnused and pass arguments (#2639)
Allows a user to enable/disable the `lowMemoryUnused` option and to get/set/clear arbitrary pass arguments when using the C- or JS-APIs. * binaryen.**getLowMemoryUnused**(): `boolean` * binaryen.**setLowMemoryUnused**(on: `boolean`): `void` * binaryen.**getPassArgument**(key: `string`): `string | null` * binaryen.**setPassArgument**(key: `string`, value: `string | null`): `void` * binaryen.**clearPassArguments**(): `void`
Diffstat (limited to 'test/binaryen.js/low-memory-unused.js.txt')
-rw-r--r--test/binaryen.js/low-memory-unused.js.txt75
1 files changed, 75 insertions, 0 deletions
diff --git a/test/binaryen.js/low-memory-unused.js.txt b/test/binaryen.js/low-memory-unused.js.txt
new file mode 100644
index 000000000..13850128c
--- /dev/null
+++ b/test/binaryen.js/low-memory-unused.js.txt
@@ -0,0 +1,75 @@
+=== input wast ===
+(module
+ (memory $0 1)
+ (export "test" (func $test))
+ (func $test (param $0 i32) (result i32)
+ (i32.load
+ (i32.add
+ (local.get $0)
+ (i32.const 128)
+ )
+ )
+ )
+)
+
+=== unoptimized ===
+(module
+ (type $i32_=>_i32 (func (param i32) (result i32)))
+ (memory $0 1)
+ (export "test" (func $test))
+ (func $test (; 0 ;) (param $0 i32) (result i32)
+ (i32.load
+ (i32.add
+ (local.get $0)
+ (i32.const 128)
+ )
+ )
+ )
+)
+
+=== optimized, lowMemoryUnused=false ===
+(module
+ (type $i32_=>_i32 (func (param i32) (result i32)))
+ (memory $0 1)
+ (export "test" (func $test))
+ (func $test (; 0 ;) (; has Stack IR ;) (param $0 i32) (result i32)
+ (i32.load
+ (i32.add
+ (local.get $0)
+ (i32.const 128)
+ )
+ )
+ )
+)
+
+// beginning a Binaryen API trace
+#include <math.h>
+#include <map>
+#include "binaryen-c.h"
+int main() {
+ std::map<size_t, BinaryenExpressionRef> expressions;
+ std::map<size_t, BinaryenFunctionRef> functions;
+ std::map<size_t, BinaryenGlobalRef> globals;
+ std::map<size_t, BinaryenEventRef> events;
+ std::map<size_t, BinaryenExportRef> exports;
+ std::map<size_t, RelooperBlockRef> relooperBlocks;
+ BinaryenModuleRef the_module = NULL;
+ RelooperRef the_relooper = NULL;
+ BinaryenSetLowMemoryUnused(1);
+ BinaryenGetLowMemoryUnused();
+ return 0;
+}
+// ending a Binaryen API trace
+
+=== optimized, lowMemoryUnused=true ===
+(module
+ (type $i32_=>_i32 (func (param i32) (result i32)))
+ (memory $0 1)
+ (export "test" (func $test))
+ (func $test (; 0 ;) (; has Stack IR ;) (param $0 i32) (result i32)
+ (i32.load offset=128
+ (local.get $0)
+ )
+ )
+)
+