diff options
author | Thomas Lively <tlively@google.com> | 2023-01-09 16:23:57 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-09 14:23:57 -0800 |
commit | 67abc2a1b9adcdf080387a29e0c92b6f5a31057a (patch) | |
tree | d8e8304e9ecdd700b56b949bb5132b26e09362f4 /src/js | |
parent | e3d9b82d9f8910063373e2952582de545659d448 (diff) | |
download | binaryen-67abc2a1b9adcdf080387a29e0c92b6f5a31057a.tar.gz binaryen-67abc2a1b9adcdf080387a29e0c92b6f5a31057a.tar.bz2 binaryen-67abc2a1b9adcdf080387a29e0c92b6f5a31057a.zip |
Replace `RefIs` with `RefIsNull` (#5401)
* Replace `RefIs` with `RefIsNull`
The other `ref.is*` instructions are deprecated and expressible in terms of
`ref.test`. Update binary and text parsing to parse those instructions as
`RefTest` expressions. Also update the printing and emitting of `RefTest`
expressions to emit the legacy instructions for now to minimize test changes and
make this a mostly non-functional change. Since `ref.is_null` is the only
`RefIs` instruction left, remove the `RefIsOp` field and rename the expression
class to `RefIsNull`.
The few test changes are due to the fact that `ref.is*` instructions are now
subject to `ref.test` validation, and in particular it is no longer valid to
perform a `ref.is_func` on a value outside of the `func` type hierarchy.
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/binaryen.js-post.js | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index d4395359e..2a08c5e5a 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -92,7 +92,7 @@ function initializeConstants() { 'MemoryCopy', 'MemoryFill', 'RefNull', - 'RefIs', + 'RefIsNull', 'RefFunc', 'RefEq', 'TableGet', @@ -549,10 +549,6 @@ function initializeConstants() { 'DemoteZeroVecF64x2ToVecF32x4', 'PromoteLowVecF32x4ToVecF64x2', 'SwizzleVecI8x16', - 'RefIsNull', - 'RefIsFunc', - 'RefIsData', - 'RefIsI31', 'RefAsNonNull', 'RefAsFunc', 'RefAsData', @@ -2344,16 +2340,7 @@ function wrapModule(module, self = {}) { return Module['_BinaryenRefNull'](module, type); }, 'is_null'(value) { - return Module['_BinaryenRefIs'](module, Module['RefIsNull'], value); - }, - 'is_func'(value) { - return Module['_BinaryenRefIs'](module, Module['RefIsFunc'], value); - }, - 'is_data'(value) { - return Module['_BinaryenRefIs'](module, Module['RefIsData'], value); - }, - 'is_i31'(value) { - return Module['_BinaryenRefIs'](module, Module['RefIsI31'], value); + return Module['_BinaryenRefIsNull'](module, value); }, 'as_non_null'(value) { return Module['_BinaryenRefAs'](module, Module['RefAsNonNull'], value); @@ -3203,12 +3190,11 @@ Module['getExpressionInfo'] = function(expr) { 'id': id, 'type': type }; - case Module['RefIsId']: + case Module['RefIsNullId']: return { 'id': id, 'type': type, - 'op': Module['_BinaryenRefIsGetOp'](expr), - 'value': Module['_BinaryenRefIsGetValue'](expr) + 'value': Module['_BinaryenRefIsNullGetValue'](expr) }; case Module['RefAsId']: return { @@ -4622,18 +4608,12 @@ Module['MemoryFill'] = makeExpressionWrapper({ } }); -Module['RefIs'] = makeExpressionWrapper({ - 'getOp'(expr) { - return Module['_BinaryenRefIsGetOp'](expr); - }, - 'setOp'(expr, op) { - Module['_BinaryenRefIsSetOp'](expr, op); - }, +Module['RefIsNull'] = makeExpressionWrapper({ 'getValue'(expr) { - return Module['_BinaryenRefIsGetValue'](expr); + return Module['_BinaryenRefIsNullGetValue'](expr); }, 'setValue'(expr, valueExpr) { - Module['_BinaryenRefIsSetValue'](expr, valueExpr); + Module['_BinaryenRefIsNullSetValue'](expr, valueExpr); } }); |