summaryrefslogtreecommitdiff
path: root/test/spec/shared-polymorphism.wast
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-07-16 16:30:09 -0400
committerGitHub <noreply@github.com>2024-07-16 13:30:09 -0700
commit9de9d05de2f6780ac6d1394528b7e38223edf22b (patch)
tree99ad87392400c5d905f8c7a66072e5f3b9e9cd90 /test/spec/shared-polymorphism.wast
parentee43476328df55757614d3a7db4419426fd3d3e9 (diff)
downloadbinaryen-9de9d05de2f6780ac6d1394528b7e38223edf22b.tar.gz
binaryen-9de9d05de2f6780ac6d1394528b7e38223edf22b.tar.bz2
binaryen-9de9d05de2f6780ac6d1394528b7e38223edf22b.zip
[threads] Allow i31refs of mixed shareability to compare equal (#6752)
Normally, values of different types can never compare equal to each other, but since i31refs are not actually allocations, `ref.eq` has no way to differentiate a shared i31ref and an unshared i31ref with the same value, so it will report them as equal. Update the implementation of value equality to reflect this correctly.
Diffstat (limited to 'test/spec/shared-polymorphism.wast')
-rw-r--r--test/spec/shared-polymorphism.wast11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/spec/shared-polymorphism.wast b/test/spec/shared-polymorphism.wast
index be8b5e467..3ceead362 100644
--- a/test/spec/shared-polymorphism.wast
+++ b/test/spec/shared-polymorphism.wast
@@ -23,3 +23,14 @@
(extern.convert_any (local.get 0))
)
)
+
+(module
+ (func (export "eq") (param i32 i32) (result i32)
+ (ref.eq (ref.i31 (local.get 0)) (ref.i31_shared (local.get 1)))
+ )
+)
+
+(assert_return (invoke "eq" (i32.const 0) (i32.const 0)) (i32.const 1))
+(assert_return (invoke "eq" (i32.const 0) (i32.const 1)) (i32.const 0))
+(assert_return (invoke "eq" (i32.const 1) (i32.const 0)) (i32.const 0))
+(assert_return (invoke "eq" (i32.const 1) (i32.const 1)) (i32.const 1))