summaryrefslogtreecommitdiff
path: root/src/js/binaryen.js-post.js
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2020-09-21 09:45:58 +0200
committerGitHub <noreply@github.com>2020-09-21 09:45:58 +0200
commit51350a8d2e7a361cf658951798351fc242420328 (patch)
tree8bc71e9126b719c4d1785d0f5bbb6248a601176f /src/js/binaryen.js-post.js
parente35cdb97adf6eb2ade2be7734d1c6c397d440dc1 (diff)
downloadbinaryen-51350a8d2e7a361cf658951798351fc242420328.tar.gz
binaryen-51350a8d2e7a361cf658951798351fc242420328.tar.bz2
binaryen-51350a8d2e7a361cf658951798351fc242420328.zip
GC: Add ref.eq instruction (#3145)
With `eqref` now integrated, the `ref.eq` instruction can be implemented. The only valid LHS and RHS value is `(ref.null eq)` for now, but implementation and fuzzer integration is otherwise complete.
Diffstat (limited to 'src/js/binaryen.js-post.js')
-rw-r--r--src/js/binaryen.js-post.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js
index 4703abc54..e24b50984 100644
--- a/src/js/binaryen.js-post.js
+++ b/src/js/binaryen.js-post.js
@@ -89,6 +89,7 @@ function initializeConstants() {
'RefNull',
'RefIsNull',
'RefFunc',
+ 'RefEq',
'Try',
'Throw',
'Rethrow',
@@ -2093,6 +2094,9 @@ function wrapModule(module, self = {}) {
},
'func'(func) {
return preserveStack(() => Module['_BinaryenRefFunc'](module, strToStack(func)));
+ },
+ 'eq'(left, right) {
+ return Module['_BinaryenRefEq'](module, left, right);
}
};
@@ -2803,6 +2807,13 @@ Module['getExpressionInfo'] = function(expr) {
'type': type,
'func': UTF8ToString(Module['_BinaryenRefFuncGetFunc'](expr)),
};
+ case Module['RefEqId']:
+ return {
+ 'id': id,
+ 'type': type,
+ 'left': Module['_BinaryenRefEqGetLeft'](expr),
+ 'right': Module['_BinaryenRefEqGetRight'](expr)
+ };
case Module['TryId']:
return {
'id': id,
@@ -4100,6 +4111,21 @@ Module['RefFunc'] = makeExpressionWrapper({
}
});
+Module['RefEq'] = makeExpressionWrapper({
+ 'getLeft'(expr) {
+ return Module['_BinaryenRefEqGetLeft'](expr);
+ },
+ 'setLeft'(expr, leftExpr) {
+ return Module['_BinaryenRefEqSetLeft'](expr, leftExpr);
+ },
+ 'getRight'(expr) {
+ return Module['_BinaryenRefEqGetRight'](expr);
+ },
+ 'setRight'(expr, rightExpr) {
+ return Module['_BinaryenRefEqSetRight'](expr, rightExpr);
+ }
+});
+
Module['Try'] = makeExpressionWrapper({
'getBody'(expr) {
return Module['_BinaryenTryGetBody'](expr);