diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-11-01 21:32:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-01 21:32:38 -0700 |
commit | 22699ebad0972fa7604dd8ffd26f9f6607e82fb0 (patch) | |
tree | cf49990c3ed2ed044c006172e965f9b3ded5402d /test | |
parent | 0ff4359de75b4dd2a786dfa50cb17b3ec01a701a (diff) | |
parent | 26cf3235f9f73a8f187fa75f274bc517a65c3fe9 (diff) | |
download | binaryen-22699ebad0972fa7604dd8ffd26f9f6607e82fb0.tar.gz binaryen-22699ebad0972fa7604dd8ffd26f9f6607e82fb0.tar.bz2 binaryen-22699ebad0972fa7604dd8ffd26f9f6607e82fb0.zip |
Merge pull request #819 from WebAssembly/optimize-memory
Pack memory segments
Diffstat (limited to 'test')
-rw-r--r-- | test/emcc_O2_hello_world.fromasm | 2 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm | 2 | ||||
-rw-r--r-- | test/empty.fromasm | 2 | ||||
-rw-r--r-- | test/passes/memory-packing.txt | 20 | ||||
-rw-r--r-- | test/passes/memory-packing.wast | 20 |
5 files changed, 43 insertions, 3 deletions
diff --git a/test/emcc_O2_hello_world.fromasm b/test/emcc_O2_hello_world.fromasm index 9646d4d62..70ff7a09e 100644 --- a/test/emcc_O2_hello_world.fromasm +++ b/test/emcc_O2_hello_world.fromasm @@ -33,7 +33,7 @@ (import "env" "memoryBase" (global $memoryBase i32)) (import "env" "tableBase" (global $tableBase i32)) (elem (i32.const 0) $b0 $___stdio_close $b1 $b1 $___stdout_write $___stdio_seek $b1 $___stdio_write $b1 $b1 $b2 $b2 $b2 $b2 $_cleanup_418 $b2 $b2 $b2) - (data (get_global $memoryBase) "emcc_O2_hello_world.asm.js") + (data (i32.const 1024) "emcc_O2_hello_world.asm.js") (global $STACKTOP (mut i32) (get_global $STACKTOP$asm2wasm$import)) (global $STACK_MAX (mut i32) (get_global $STACK_MAX$asm2wasm$import)) (global $tempDoublePtr (mut i32) (get_global $tempDoublePtr$asm2wasm$import)) diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm index 01a30d8eb..043ad0d96 100644 --- a/test/emcc_hello_world.fromasm +++ b/test/emcc_hello_world.fromasm @@ -42,7 +42,7 @@ (import "env" "memoryBase" (global $memoryBase i32)) (import "env" "tableBase" (global $tableBase i32)) (elem (i32.const 0) $b0 $___stdio_close $b1 $b1 $___stdout_write $___stdio_seek $___stdio_write $b1 $b1 $b1 $b2 $b2 $b2 $b2 $b2 $_cleanup $b2 $b2) - (data (get_global $memoryBase) "emcc_hello_world.asm.js") + (data (i32.const 1024) "emcc_hello_world.asm.js") (global $STACKTOP (mut i32) (get_global $STACKTOP$asm2wasm$import)) (global $STACK_MAX (mut i32) (get_global $STACK_MAX$asm2wasm$import)) (global $tempDoublePtr (mut i32) (get_global $tempDoublePtr$asm2wasm$import)) diff --git a/test/empty.fromasm b/test/empty.fromasm index a8d289e29..a88b44007 100644 --- a/test/empty.fromasm +++ b/test/empty.fromasm @@ -3,5 +3,5 @@ (import "env" "table" (table 0 0 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) (import "env" "tableBase" (global $tableBase i32)) - (data (get_global $memoryBase) "empty.asm.js") + (data (i32.const 1024) "empty.asm.js") ) diff --git a/test/passes/memory-packing.txt b/test/passes/memory-packing.txt new file mode 100644 index 000000000..1f068180c --- /dev/null +++ b/test/passes/memory-packing.txt @@ -0,0 +1,20 @@ +(module + (import "env" "memory" (memory $0 2048 2048)) + (import "env" "memoryBase" (global $memoryBase i32)) + (data (get_global $memoryBase) "waka this cannot be optimized\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00we don\'t know where it will go") + (data (i32.const 1024) "waka this CAN be optimized") + (data (i32.const 1107) "we DO know where it will go") + (data (i32.const 2057) "zeros before") + (data (i32.const 3000) "zeros after") + (data (i32.const 4000) "zeros\00in\00the\00middle") + (data (i32.const 4035) "nice skip here") + (data (i32.const 4066) "another\00but no") +) +(module + (import "env" "memory" (memory $0 2048 2048)) + (import "env" "memoryBase" (global $memoryBase i32)) +) +(module + (import "env" "memory" (memory $0 2048 2048)) + (import "env" "memoryBase" (global $memoryBase i32)) +) diff --git a/test/passes/memory-packing.wast b/test/passes/memory-packing.wast new file mode 100644 index 000000000..eb343188e --- /dev/null +++ b/test/passes/memory-packing.wast @@ -0,0 +1,20 @@ +(module + (import "env" "memory" (memory $0 2048 2048)) + (import "env" "memoryBase" (global $memoryBase i32)) + (data (get_global $memoryBase) "waka this cannot be optimized\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00we don't know where it will go") + (data (i32.const 1024) "waka this CAN be optimized\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00we DO know where it will go") + (data (i32.const 2000) "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00zeros before") + (data (i32.const 3000) "zeros after\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (data (i32.const 4000) "zeros\00in\00the\00middle\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00nice skip here\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00another\00but no") +) +(module + (import "env" "memory" (memory $0 2048 2048)) + (import "env" "memoryBase" (global $memoryBase i32)) + ;; nothing +) +(module + (import "env" "memory" (memory $0 2048 2048)) + (import "env" "memoryBase" (global $memoryBase i32)) + (data (i32.const 4066) "") ;; empty +) + |