summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/gen-s-parser.py1
-rw-r--r--src/gen-s-parser.inc29
-rw-r--r--test/lit/i31-new.wast18
-rw-r--r--test/lit/passes/simplify-globals-single_use.wast22
-rw-r--r--test/lit/passes/stack-ir-non-nullable.wast56
-rw-r--r--test/lit/passes/type-generalizing.wast10
6 files changed, 53 insertions, 83 deletions
diff --git a/scripts/gen-s-parser.py b/scripts/gen-s-parser.py
index 711096a5b..e1bfe3f3d 100755
--- a/scripts/gen-s-parser.py
+++ b/scripts/gen-s-parser.py
@@ -572,7 +572,6 @@ instructions = [
("resume", "makeResume()"),
("suspend", "makeSuspend()"),
# GC
- ("i31.new", "makeRefI31(Unshared)"), # deprecated
("ref.i31", "makeRefI31(Unshared)"),
("ref.i31_shared", "makeRefI31(Shared)"),
("i31.get_s", "makeI31Get(true)"),
diff --git a/src/gen-s-parser.inc b/src/gen-s-parser.inc
index bbed0f8be..98f5b7831 100644
--- a/src/gen-s-parser.inc
+++ b/src/gen-s-parser.inc
@@ -1811,27 +1811,16 @@ switch (buf[0]) {
case '3': {
switch (buf[2]) {
case '1': {
- switch (buf[4]) {
- case 'g': {
- switch (buf[8]) {
- case 's':
- if (op == "i31.get_s"sv) {
- CHECK_ERR(makeI31Get(ctx, pos, annotations, true));
- return Ok{};
- }
- goto parse_error;
- case 'u':
- if (op == "i31.get_u"sv) {
- CHECK_ERR(makeI31Get(ctx, pos, annotations, false));
- return Ok{};
- }
- goto parse_error;
- default: goto parse_error;
+ switch (buf[8]) {
+ case 's':
+ if (op == "i31.get_s"sv) {
+ CHECK_ERR(makeI31Get(ctx, pos, annotations, true));
+ return Ok{};
}
- }
- case 'n':
- if (op == "i31.new"sv) {
- CHECK_ERR(makeRefI31(ctx, pos, annotations, Unshared));
+ goto parse_error;
+ case 'u':
+ if (op == "i31.get_u"sv) {
+ CHECK_ERR(makeI31Get(ctx, pos, annotations, false));
return Ok{};
}
goto parse_error;
diff --git a/test/lit/i31-new.wast b/test/lit/i31-new.wast
deleted file mode 100644
index 9d47b3ec9..000000000
--- a/test/lit/i31-new.wast
+++ /dev/null
@@ -1,18 +0,0 @@
-;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
-
-;; Check that we still parse the legacy i31.new instruction.
-
-;; RUN: wasm-opt %s -all -S -o - | filecheck %s
-
-(module
- ;; CHECK: (func $test (type $0) (result i31ref)
- ;; CHECK-NEXT: (ref.i31
- ;; CHECK-NEXT: (i32.const 0)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- (func $test (result i31ref)
- (i31.new
- (i32.const 0)
- )
- )
-)
diff --git a/test/lit/passes/simplify-globals-single_use.wast b/test/lit/passes/simplify-globals-single_use.wast
index daba2588d..768ac6f86 100644
--- a/test/lit/passes/simplify-globals-single_use.wast
+++ b/test/lit/passes/simplify-globals-single_use.wast
@@ -17,7 +17,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: ))
(global $single-use anyref (struct.new $A
- (i31.new
+ (ref.i31
(i32.const 42)
)
))
@@ -59,7 +59,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: ))
(global $single-use anyref (struct.new $A
- (i31.new
+ (ref.i31
(i32.const 42)
)
))
@@ -85,7 +85,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: ))
(global $single-use anyref (struct.new $A
- (i31.new
+ (ref.i31
(i32.const 42)
)
))
@@ -131,7 +131,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: ))
(global $single-use anyref (struct.new $A
- (i31.new
+ (ref.i31
(i32.const 42)
)
))
@@ -160,7 +160,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: ))
(global $single-use anyref (struct.new $A
- (i31.new
+ (ref.i31
(i32.const 42)
)
))
@@ -188,7 +188,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: ))
(global $single-use1 anyref (struct.new $A
- (i31.new
+ (ref.i31
(i32.const 42)
)
))
@@ -199,7 +199,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: ))
(global $single-use2 anyref (struct.new $A
- (i31.new
+ (ref.i31
(i32.const 1337)
)
))
@@ -217,7 +217,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: ))
(global $single-use3 anyref (struct.new $A
- (i31.new
+ (ref.i31
(i32.const 99999)
)
))
@@ -250,7 +250,7 @@
;; CHECK-NEXT: (ref.null none)
;; CHECK-NEXT: ))
(global $single-use1 anyref (struct.new $A
- (i31.new
+ (ref.i31
(i32.const 42)
)
(ref.null any)
@@ -264,7 +264,7 @@
;; CHECK-NEXT: ))
(global $single-use2 anyref (struct.new $A
(ref.null any)
- (i31.new
+ (ref.i31
(i32.const 1337)
)
))
@@ -297,7 +297,7 @@
;; CHECK: (global $single-use1 anyref (ref.i31
;; CHECK-NEXT: (i32.const 42)
;; CHECK-NEXT: ))
- (global $single-use1 anyref (i31.new
+ (global $single-use1 anyref (ref.i31
(i32.const 42)
))
diff --git a/test/lit/passes/stack-ir-non-nullable.wast b/test/lit/passes/stack-ir-non-nullable.wast
index c3309d65a..508fe574f 100644
--- a/test/lit/passes/stack-ir-non-nullable.wast
+++ b/test/lit/passes/stack-ir-non-nullable.wast
@@ -37,20 +37,20 @@
(if
(ref.eq
(local.get $temp)
- (i31.new
+ (ref.i31
(i32.const 0)
)
)
(then
(local.set $temp
- (i31.new
+ (ref.i31
(i32.const 1)
)
)
)
(else
(local.set $temp
- (i31.new
+ (ref.i31
(i32.const 2)
)
)
@@ -86,20 +86,20 @@
(if
(ref.eq
(local.get $temp)
- (i31.new
+ (ref.i31
(i32.const 0)
)
)
(then
(local.set $temp
- (i31.new
+ (ref.i31
(i32.const 1)
)
)
)
(else
(local.set $temp
- (i31.new
+ (ref.i31
(i32.const 2)
)
)
@@ -135,20 +135,20 @@
(if
(ref.eq
(local.get $temp)
- (i31.new
+ (ref.i31
(i32.const 0)
)
)
(then
(local.set $temp
- (i31.new
+ (ref.i31
(i32.const 1)
)
)
)
(else
(local.set $temp
- (i31.new
+ (ref.i31
(i32.const 2)
)
)
@@ -191,20 +191,20 @@
(if
(ref.eq
(local.get $temp)
- (i31.new
+ (ref.i31
(i32.const 0)
)
)
(then
(local.set $temp
- (i31.new
+ (ref.i31
(i32.const 1)
)
)
)
(else
(local.set $temp
- (i31.new
+ (ref.i31
(i32.const 2)
)
)
@@ -245,20 +245,20 @@
(if
(ref.eq
(local.get $temp)
- (i31.new
+ (ref.i31
(i32.const 0)
)
)
(then
(local.set $temp
- (i31.new
+ (ref.i31
(i32.const 1)
)
)
)
(else
(local.set $temp
- (i31.new
+ (ref.i31
(i32.const 2)
)
)
@@ -296,20 +296,20 @@
(if
(ref.eq
(local.get $temp)
- (i31.new
+ (ref.i31
(i32.const 0)
)
)
(then
(local.set $temp
- (i31.new
+ (ref.i31
(i32.const 1)
)
)
)
(else
(local.set $temp
- (i31.new
+ (ref.i31
(i32.const 2)
)
)
@@ -345,20 +345,20 @@
(if
(ref.eq
(local.get $temp)
- (i31.new
+ (ref.i31
(i32.const 0)
)
)
(then
(local.set $temp
- (i31.new
+ (ref.i31
(i32.const 1)
)
)
)
(else
(local.set $temp
- (i31.new
+ (ref.i31
(i32.const 2)
)
)
@@ -410,7 +410,7 @@
(tuple.extract 2 1
(local.get $temp)
)
- (i31.new
+ (ref.i31
(i32.const 1)
)
)
@@ -418,7 +418,7 @@
(local.set $temp
(tuple.make 2
(i32.const 2)
- (i31.new
+ (ref.i31
(i32.const 3)
)
)
@@ -428,7 +428,7 @@
(local.set $temp
(tuple.make 2
(i32.const 4)
- (i31.new
+ (ref.i31
(i32.const 5)
)
)
@@ -482,7 +482,7 @@
(tuple.extract 2 1
(local.get $temp)
)
- (i31.new
+ (ref.i31
(i32.const 1)
)
)
@@ -490,7 +490,7 @@
(local.set $temp
(tuple.make 2
(i32.const 2)
- (i31.new
+ (ref.i31
(i32.const 3)
)
)
@@ -500,7 +500,7 @@
(local.set $temp
(tuple.make 2
(i32.const 4)
- (i31.new
+ (ref.i31
(i32.const 5)
)
)
@@ -1015,7 +1015,7 @@
(if
(ref.eq
(local.get $temp)
- (i31.new
+ (ref.i31
(i32.const 0)
)
)
diff --git a/test/lit/passes/type-generalizing.wast b/test/lit/passes/type-generalizing.wast
index 344509794..e9c92ff86 100644
--- a/test/lit/passes/type-generalizing.wast
+++ b/test/lit/passes/type-generalizing.wast
@@ -270,7 +270,7 @@
(local $var i31ref)
;; Require that (ref i31) <: typeof($var).
(local.set $var
- (i31.new
+ (ref.i31
(i32.const 0)
)
)
@@ -405,7 +405,7 @@
(drop
(local.tee $dest
(local.tee $var
- (i31.new
+ (ref.i31
(i32.const 0)
)
)
@@ -439,7 +439,7 @@
(local $nonnullable (ref i31))
;; Initialize the non-nullable local for validation purposes.
(local.set $nonnullable
- (i31.new
+ (ref.i31
(i32.const 0)
)
)
@@ -819,7 +819,7 @@
(func $extern-convert-any-nullable (result externref)
(local $var (ref i31))
(local.set $var
- (i31.new
+ (ref.i31
(i32.const 0)
)
)
@@ -843,7 +843,7 @@
(func $extern-convert-any-non-nullable (result (ref extern))
(local $var (ref i31))
(local.set $var
- (i31.new
+ (ref.i31
(i32.const 0)
)
)