summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ctor-eval/imported-global-2.wast31
-rw-r--r--test/ctor-eval/imported-global-2.wast.ctors1
-rw-r--r--test/ctor-eval/imported-global-2.wast.out26
-rw-r--r--test/ctor-eval/imported-global.wast1
-rw-r--r--test/ctor-eval/indirect-call3.wast3
-rw-r--r--test/ctor-eval/indirect-call3.wast.out1
6 files changed, 59 insertions, 4 deletions
diff --git a/test/ctor-eval/imported-global-2.wast b/test/ctor-eval/imported-global-2.wast
new file mode 100644
index 000000000..e10dc7080
--- /dev/null
+++ b/test/ctor-eval/imported-global-2.wast
@@ -0,0 +1,31 @@
+(module
+ (memory 256 256)
+
+ ;; imports must not be used
+ (import "env" "imported" (global $imported i32))
+
+ (func "test1" (result i32)
+ (local $temp i32)
+
+ ;; this errors, and we never get to evalling the store after it
+ (local.set $temp
+ (global.get $imported)
+ )
+
+ (i32.store8
+ (i32.const 13)
+ (i32.const 115)
+ )
+
+ (local.get $temp)
+ )
+
+ (func "keepalive" (result i32)
+ (drop
+ (i32.load
+ (i32.const 13)
+ )
+ )
+ (global.get $imported)
+ )
+)
diff --git a/test/ctor-eval/imported-global-2.wast.ctors b/test/ctor-eval/imported-global-2.wast.ctors
new file mode 100644
index 000000000..a5bce3fd2
--- /dev/null
+++ b/test/ctor-eval/imported-global-2.wast.ctors
@@ -0,0 +1 @@
+test1
diff --git a/test/ctor-eval/imported-global-2.wast.out b/test/ctor-eval/imported-global-2.wast.out
new file mode 100644
index 000000000..ff71672a9
--- /dev/null
+++ b/test/ctor-eval/imported-global-2.wast.out
@@ -0,0 +1,26 @@
+(module
+ (type $none_=>_i32 (func (result i32)))
+ (import "env" "imported" (global $imported i32))
+ (memory $0 256 256)
+ (export "test1" (func $0))
+ (export "keepalive" (func $1))
+ (func $0 (result i32)
+ (local $temp i32)
+ (local.set $temp
+ (global.get $imported)
+ )
+ (i32.store8
+ (i32.const 13)
+ (i32.const 115)
+ )
+ (local.get $temp)
+ )
+ (func $1 (result i32)
+ (drop
+ (i32.load
+ (i32.const 13)
+ )
+ )
+ (global.get $imported)
+ )
+)
diff --git a/test/ctor-eval/imported-global.wast b/test/ctor-eval/imported-global.wast
index 92fda3fa0..20e56d2d1 100644
--- a/test/ctor-eval/imported-global.wast
+++ b/test/ctor-eval/imported-global.wast
@@ -6,7 +6,6 @@
(export "test1" $test1)
(global $mine (mut i32) (global.get $tempDoublePtr)) ;; BAD, if used
(func $test1
- (drop (global.get $mine))
(i32.store8 (i32.const 13) (i32.const 115)) ;; we never get here.
)
)
diff --git a/test/ctor-eval/indirect-call3.wast b/test/ctor-eval/indirect-call3.wast
index 974ae7216..9c88e0f78 100644
--- a/test/ctor-eval/indirect-call3.wast
+++ b/test/ctor-eval/indirect-call3.wast
@@ -2,10 +2,9 @@
(type $v (func))
(memory 256 256)
(data (i32.const 10) "waka waka waka waka waka")
- (import "env" "tableBase" (global $tableBase i32))
(import "env" "_abort" (func $_abort))
(table 2 2 funcref)
- (elem (global.get $tableBase) $_abort $call-indirect)
+ (elem (i32.const 0) $_abort $call-indirect)
(export "test1" $test1)
(func $test1
(call_indirect (type $v) (i32.const 1)) ;; safe to call
diff --git a/test/ctor-eval/indirect-call3.wast.out b/test/ctor-eval/indirect-call3.wast.out
index 10914bca7..1c98857a6 100644
--- a/test/ctor-eval/indirect-call3.wast.out
+++ b/test/ctor-eval/indirect-call3.wast.out
@@ -1,6 +1,5 @@
(module
(type $v (func))
- (import "env" "tableBase" (global $tableBase i32))
(import "env" "_abort" (func $_abort))
(memory $0 256 256)
(data (i32.const 10) "waka waka xaka waka waka\00\00\00\00\00\00C")