summaryrefslogtreecommitdiff
path: root/src/js/binaryen.js-post.js
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 /src/js/binaryen.js-post.js
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 'src/js/binaryen.js-post.js')
-rw-r--r--src/js/binaryen.js-post.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js
index 87a6bacda..4703abc54 100644
--- a/src/js/binaryen.js-post.js
+++ b/src/js/binaryen.js-post.js
@@ -37,6 +37,8 @@ function initializeConstants() {
['externref', 'Externref'],
['exnref', 'Exnref'],
['anyref', 'Anyref'],
+ ['eqref', 'Eqref'],
+ ['i31ref', 'I31ref'],
['unreachable', 'Unreachable'],
['auto', 'Auto']
].forEach(entry => {
@@ -2070,6 +2072,18 @@ function wrapModule(module, self = {}) {
}
};
+ self['eqref'] = {
+ 'pop'() {
+ return Module['_BinaryenPop'](module, Module['eqref']);
+ }
+ };
+
+ self['i31ref'] = {
+ 'pop'() {
+ return Module['_BinaryenPop'](module, Module['i31ref']);
+ }
+ };
+
self['ref'] = {
'null'(type) {
return Module['_BinaryenRefNull'](module, type);