summaryrefslogtreecommitdiff
path: root/test/example/module-splitting.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/example/module-splitting.cpp')
-rw-r--r--test/example/module-splitting.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/example/module-splitting.cpp b/test/example/module-splitting.cpp
index ab42ff5fd..5391fe584 100644
--- a/test/example/module-splitting.cpp
+++ b/test/example/module-splitting.cpp
@@ -126,6 +126,16 @@ int main() {
)
))");
+ // Non-deferred function in table multiple times
+ do_test({"foo"}, R"(
+ (module
+ (table $table 2 funcref)
+ (elem (i32.const 0) $foo $foo)
+ (func $foo (param i32) (result i32)
+ (local.get 0)
+ )
+ ))");
+
// Non-deferred function in table at non-const offset
do_test({"foo"}, R"(
(module
@@ -137,6 +147,17 @@ int main() {
)
))");
+ // Non-deferred function in table at non-const offset multiple times
+ do_test({"foo"}, R"(
+ (module
+ (import "env" "base" (global $base i32))
+ (table $table 2 funcref)
+ (elem (global.get $base) $foo $foo)
+ (func $foo (param i32) (result i32)
+ (local.get 0)
+ )
+ ))");
+
// Non-deferred imported function
do_test({"foo"}, R"(
(module
@@ -189,6 +210,16 @@ int main() {
)
))");
+ // Deferred function in table multiple times
+ do_test({}, R"(
+ (module
+ (table $table 2 funcref)
+ (elem (i32.const 0) $foo $foo)
+ (func $foo (param i32) (result i32)
+ (local.get 0)
+ )
+ ))");
+
// Deferred exported function in table at a weird offset
do_test({}, R"(
(module
@@ -212,6 +243,18 @@ int main() {
)
))");
+ // Deferred exported function in table at a non-const offset multiple times
+ do_test({}, R"(
+ (module
+ (import "env" "base" (global $base i32))
+ (table $table 1000 funcref)
+ (elem (global.get $base) $foo $foo)
+ (export "foo" (func $foo))
+ (func $foo (param i32) (result i32)
+ (local.get 0)
+ )
+ ))");
+
// Deferred exported function in table at an offset from a non-const base
do_test({"null"}, R"(
(module