diff options
author | Thomas Lively <tlively@google.com> | 2023-04-04 11:33:15 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-04 11:33:15 -0700 |
commit | a802fbe07c270f510c87dfa93577bd4731c075f3 (patch) | |
tree | 4c67b39ced46258593f6904bba4a5ac20292886c /test/lit/wasm-split | |
parent | 05e1183954e49f8b3a1669cc7973af590afe9fc3 (diff) | |
download | binaryen-a802fbe07c270f510c87dfa93577bd4731c075f3.tar.gz binaryen-a802fbe07c270f510c87dfa93577bd4731c075f3.tar.bz2 binaryen-a802fbe07c270f510c87dfa93577bd4731c075f3.zip |
Use Names instead of indices to identify segments (#5618)
All top-level Module elements are identified and referred to by Name, but for
historical reasons element and data segments were referred to by index instead.
Fix this inconsistency by using Names to refer to segments from expressions that
use them. Also parse and print segment names like we do for other elements.
The C API is partially converted to use names instead of indices, but there are
still many functions that refer to data segments by index. Finishing the
conversion can be done in the future once it becomes necessary.
Diffstat (limited to 'test/lit/wasm-split')
-rw-r--r-- | test/lit/wasm-split/basic.wast | 14 | ||||
-rw-r--r-- | test/lit/wasm-split/jspi-secondary-export.wast | 4 | ||||
-rw-r--r-- | test/lit/wasm-split/jspi.wast | 4 |
3 files changed, 11 insertions, 11 deletions
diff --git a/test/lit/wasm-split/basic.wast b/test/lit/wasm-split/basic.wast index f06958bc3..7dcb7933b 100644 --- a/test/lit/wasm-split/basic.wast +++ b/test/lit/wasm-split/basic.wast @@ -66,14 +66,14 @@ ;; KEEP-NONE-PRIMARY-NEXT: (type $i32_=>_i32 (func (param i32) (result i32))) ;; KEEP-NONE-PRIMARY-NEXT: (import "placeholder" "0" (func $placeholder_0 (param i32) (result i32))) ;; KEEP-NONE-PRIMARY-NEXT: (table $table 1 1 funcref) -;; KEEP-NONE-PRIMARY-NEXT: (elem (i32.const 0) $placeholder_0) +;; KEEP-NONE-PRIMARY-NEXT: (elem $0 (i32.const 0) $placeholder_0) ;; KEEP-NONE-PRIMARY-NEXT: (export "%table" (table $table)) ;; KEEP-NONE-PRIMARY-NEXT: ) ;; KEEP-NONE-SECONDARY: (module ;; KEEP-NONE-SECONDARY-NEXT: (type $i32_=>_i32 (func (param i32) (result i32))) ;; KEEP-NONE-SECONDARY-NEXT: (import "primary" "%table" (table $table 1 1 funcref)) -;; KEEP-NONE-SECONDARY-NEXT: (elem (i32.const 0) $foo) +;; KEEP-NONE-SECONDARY-NEXT: (elem $0 (i32.const 0) $foo) ;; KEEP-NONE-SECONDARY-NEXT: (func $bar (param $0 i32) (result i32) ;; KEEP-NONE-SECONDARY-NEXT: (call $foo ;; KEEP-NONE-SECONDARY-NEXT: (i32.const 1) @@ -93,7 +93,7 @@ ;; KEEP-FOO-PRIMARY-NEXT: (type $i32_=>_i32 (func (param i32) (result i32))) ;; KEEP-FOO-PRIMARY-NEXT: (import "placeholder" "1" (func $placeholder_1 (param i32) (result i32))) ;; KEEP-FOO-PRIMARY-NEXT: (table $table 2 2 funcref) -;; KEEP-FOO-PRIMARY-NEXT: (elem (i32.const 0) $foo $placeholder_1) +;; KEEP-FOO-PRIMARY-NEXT: (elem $0 (i32.const 0) $foo $placeholder_1) ;; KEEP-FOO-PRIMARY-NEXT: (export "%foo" (func $foo)) ;; KEEP-FOO-PRIMARY-NEXT: (export "%table" (table $table)) ;; KEEP-FOO-PRIMARY-NEXT: (func $foo (param $0 i32) (result i32) @@ -108,7 +108,7 @@ ;; KEEP-FOO-SECONDARY-NEXT: (type $i32_=>_i32 (func (param i32) (result i32))) ;; KEEP-FOO-SECONDARY-NEXT: (import "primary" "%table" (table $table 2 2 funcref)) ;; KEEP-FOO-SECONDARY-NEXT: (import "primary" "%foo" (func $foo (param i32) (result i32))) -;; KEEP-FOO-SECONDARY-NEXT: (elem (i32.const 1) $bar) +;; KEEP-FOO-SECONDARY-NEXT: (elem $0 (i32.const 1) $bar) ;; KEEP-FOO-SECONDARY-NEXT: (func $bar (param $0 i32) (result i32) ;; KEEP-FOO-SECONDARY-NEXT: (call $foo ;; KEEP-FOO-SECONDARY-NEXT: (i32.const 1) @@ -123,7 +123,7 @@ ;; KEEP-BAR-PRIMARY-NEXT: (type $i32_=>_i32 (func (param i32) (result i32))) ;; KEEP-BAR-PRIMARY-NEXT: (import "placeholder" "0" (func $placeholder_0 (param i32) (result i32))) ;; KEEP-BAR-PRIMARY-NEXT: (table $table 1 1 funcref) -;; KEEP-BAR-PRIMARY-NEXT: (elem (i32.const 0) $placeholder_0) +;; KEEP-BAR-PRIMARY-NEXT: (elem $0 (i32.const 0) $placeholder_0) ;; KEEP-BAR-PRIMARY-NEXT: (export "%bar" (func $bar)) ;; KEEP-BAR-PRIMARY-NEXT: (export "%table" (table $table)) ;; KEEP-BAR-PRIMARY-NEXT: (func $bar (param $0 i32) (result i32) @@ -138,7 +138,7 @@ ;; KEEP-BAR-SECONDARY-NEXT: (type $i32_=>_i32 (func (param i32) (result i32))) ;; KEEP-BAR-SECONDARY-NEXT: (import "primary" "%table" (table $table 1 1 funcref)) ;; KEEP-BAR-SECONDARY-NEXT: (import "primary" "%bar" (func $bar (param i32) (result i32))) -;; KEEP-BAR-SECONDARY-NEXT: (elem (i32.const 0) $foo) +;; KEEP-BAR-SECONDARY-NEXT: (elem $0 (i32.const 0) $foo) ;; KEEP-BAR-SECONDARY-NEXT: (func $foo (param $0 i32) (result i32) ;; KEEP-BAR-SECONDARY-NEXT: (call $bar ;; KEEP-BAR-SECONDARY-NEXT: (i32.const 0) @@ -153,7 +153,7 @@ ;; KEEP-BOTH-PRIMARY: (module ;; KEEP-BOTH-PRIMARY-NEXT: (type $i32_=>_i32 (func (param i32) (result i32))) ;; KEEP-BOTH-PRIMARY-NEXT: (table $table 1 1 funcref) -;; KEEP-BOTH-PRIMARY-NEXT: (elem (i32.const 0) $foo) +;; KEEP-BOTH-PRIMARY-NEXT: (elem $0 (i32.const 0) $foo) ;; KEEP-BOTH-PRIMARY-NEXT: (export "%table" (table $table)) ;; KEEP-BOTH-PRIMARY-NEXT: (func $foo (param $0 i32) (result i32) ;; KEEP-BOTH-PRIMARY-NEXT: (call $bar diff --git a/test/lit/wasm-split/jspi-secondary-export.wast b/test/lit/wasm-split/jspi-secondary-export.wast index 6d6e54e15..bcfeb1ecb 100644 --- a/test/lit/wasm-split/jspi-secondary-export.wast +++ b/test/lit/wasm-split/jspi-secondary-export.wast @@ -26,7 +26,7 @@ ;; PRIMARY: (table $0 1 funcref) - ;; PRIMARY: (elem (i32.const 0) $placeholder_0) + ;; PRIMARY: (elem $0 (i32.const 0) $placeholder_0) ;; PRIMARY: (export "foo" (func $export$foo)) (export "foo" (func $foo)) @@ -38,7 +38,7 @@ ;; SECONDARY: (import "primary" "load_secondary_module_status" (global $gimport$1 (mut i32))) - ;; SECONDARY: (elem (i32.const 0) $foo) + ;; SECONDARY: (elem $0 (i32.const 0) $foo) ;; SECONDARY: (func $foo (param $0 i32) (result i32) ;; SECONDARY-NEXT: (i32.const 0) diff --git a/test/lit/wasm-split/jspi.wast b/test/lit/wasm-split/jspi.wast index c202b9cb1..e323660a8 100644 --- a/test/lit/wasm-split/jspi.wast +++ b/test/lit/wasm-split/jspi.wast @@ -26,7 +26,7 @@ ;; PRIMARY: (table $0 1 funcref) - ;; PRIMARY: (elem (i32.const 0) $placeholder_0) + ;; PRIMARY: (elem $0 (i32.const 0) $placeholder_0) ;; PRIMARY: (export "foo" (func $export$foo)) (export "foo" (func $foo)) @@ -63,7 +63,7 @@ ;; SECONDARY: (import "primary" "%foo" (func $foo (param i32) (result i32))) - ;; SECONDARY: (elem (i32.const 0) $bar) + ;; SECONDARY: (elem $0 (i32.const 0) $bar) ;; SECONDARY: (func $bar (param $0 i32) (result i32) ;; SECONDARY-NEXT: (call $foo |