summaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2020-09-19 08:48:06 +0200
committerGitHub <noreply@github.com>2020-09-19 08:48:06 +0200
commite35cdb97adf6eb2ade2be7734d1c6c397d440dc1 (patch)
tree7a740e6fc54d286a05ca3e746ae1e7f3c4b783a8 /test/unit
parente308db569ab2582d3b0ea9accdbaa3b27abdb044 (diff)
downloadbinaryen-e35cdb97adf6eb2ade2be7734d1c6c397d440dc1.tar.gz
binaryen-e35cdb97adf6eb2ade2be7734d1c6c397d440dc1.tar.bz2
binaryen-e35cdb97adf6eb2ade2be7734d1c6c397d440dc1.zip
GC: Integrate eqref and i31ref types (#3141)
Adds the `eqref` and `i31ref` types to their respective code locations. Implements what can be implemented trivially and otherwise traps with a TODO for now. Integration of `eqref` is mostly complete due to it being nullable, just like `anyref`, but `i31ref` needs to remain disabled in the fuzzer because we are lacking the functionality to create trivial `i31ref` values, i.e. `(i31.new (i32.const 0))`, which is left for follow-ups to implement.
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/input/gc_target_feature.wasmbin56 -> 61 bytes
-rw-r--r--test/unit/test_features.py22
2 files changed, 21 insertions, 1 deletions
diff --git a/test/unit/input/gc_target_feature.wasm b/test/unit/input/gc_target_feature.wasm
index cd094ca3a..ccabbc16e 100644
--- a/test/unit/input/gc_target_feature.wasm
+++ b/test/unit/input/gc_target_feature.wasm
Binary files differ
diff --git a/test/unit/test_features.py b/test/unit/test_features.py
index 4a82f8cc2..a44d58bbd 100644
--- a/test/unit/test_features.py
+++ b/test/unit/test_features.py
@@ -276,6 +276,24 @@ class FeatureValidationTest(utils.BinaryenTestCase):
'''
self.check_gc(module, 'all used types should be allowed')
+ def test_eqref_global(self):
+ module = '''
+ (module
+ (global $foo eqref (ref.null eq))
+ )
+ '''
+ self.check_gc(module, 'all used types should be allowed')
+
+ def test_eqref_local(self):
+ module = '''
+ (module
+ (func $foo
+ (local $0 eqref)
+ )
+ )
+ '''
+ self.check_gc(module, 'all used types should be allowed')
+
class TargetFeaturesSectionTest(utils.BinaryenTestCase):
def test_atomics(self):
@@ -337,7 +355,9 @@ class TargetFeaturesSectionTest(utils.BinaryenTestCase):
filename = 'gc_target_feature.wasm'
self.roundtrip(filename)
self.check_features(filename, ['reference-types', 'gc'])
- self.assertIn('anyref', self.disassemble(filename))
+ disassembly = self.disassemble(filename)
+ self.assertIn('anyref', disassembly)
+ self.assertIn('eqref', disassembly)
def test_incompatible_features(self):
path = self.input_path('signext_target_feature.wasm')