summaryrefslogtreecommitdiff
path: root/test/metadce
diff options
context:
space:
mode:
authorAbbas Mashayekh <martianboy2005@gmail.com>2021-04-21 03:41:32 +0430
committerGitHub <noreply@github.com>2021-04-20 16:11:32 -0700
commit304658d67102d3ddd5aa8ea59bcc94402d8338b8 (patch)
tree7404815766468730b1338967e61afcdb5701f69c /test/metadce
parent1afe9d4374f6920981be132e1538f63b8f053c02 (diff)
downloadbinaryen-304658d67102d3ddd5aa8ea59bcc94402d8338b8.tar.gz
binaryen-304658d67102d3ddd5aa8ea59bcc94402d8338b8.tar.bz2
binaryen-304658d67102d3ddd5aa8ea59bcc94402d8338b8.zip
Fix element segment ordering in Print (#3818)
We used to print active element segments right after corresponding tables, and passive segments came after those. We didn't print internal segment names, and empty segments weren't being printed at all. This meant that there was no way for instructions to refer to those table segments after round tripping. This will fix those issues by printing segments in the order they were defined, including segment names when necessary and not omitting empty segments anymore.
Diffstat (limited to 'test/metadce')
-rw-r--r--test/metadce/corners.wast.dced2
-rw-r--r--test/metadce/outside.wast.dced2
2 files changed, 2 insertions, 2 deletions
diff --git a/test/metadce/corners.wast.dced b/test/metadce/corners.wast.dced
index dd21e7af9..c91acc69e 100644
--- a/test/metadce/corners.wast.dced
+++ b/test/metadce/corners.wast.dced
@@ -1,11 +1,11 @@
(module
(type $none_=>_none (func))
(import "env" "table" (table $timport$0 10 10 funcref))
- (elem (i32.const 0) $imported_table_func)
(import "env" "STACKTOP" (global $STACKTOP$asm2wasm$import i32))
(import "env" "imported_twice" (func $imported_twice_a))
(import "env" "an-imported-table-func" (func $imported_table_func))
(global $STACKTOP (mut i32) (global.get $STACKTOP$asm2wasm$import))
+ (elem (i32.const 0) $imported_table_func)
(export "stackAlloc" (func $stackAlloc))
(func $stackAlloc
(drop
diff --git a/test/metadce/outside.wast.dced b/test/metadce/outside.wast.dced
index 1f1c37f1f..a1c74c8d9 100644
--- a/test/metadce/outside.wast.dced
+++ b/test/metadce/outside.wast.dced
@@ -4,11 +4,11 @@
(data (i32.const 1024) "abcd")
(data (global.get $from_segment) "abcd")
(import "env" "table" (table $timport$0 10 10 funcref))
- (elem (global.get $from_segment_2) $table_func)
(import "env" "js_func" (func $a_js_func))
(global $__THREW__ (mut i32) (i32.const 0))
(global $from_segment (mut i32) (i32.const 0))
(global $from_segment_2 (mut i32) (i32.const 0))
+ (elem (global.get $from_segment_2) $table_func)
(export "wasm_func" (func $a_wasm_func))
(func $table_func
(nop)