From 0821cd10da9ca81371688e132ed17164f23ea889 Mon Sep 17 00:00:00 2001 From: dcode Date: Wed, 31 Aug 2022 19:53:56 +0200 Subject: Add remaining GC and string instructions to C API (#4998) Adds C-API bindings for the following expression classes: RefTest RefCast BrOn with operations BrOnNull, BrOnNonNull, BrOnCast, BrOnCastFail, BrOnFunc, BrOnNonFunc, BrOnData, BrOnNonData, BrOnI31, BrOnNonI31 StructNew with operations StringNewUTF8, StringNewWTF8, StringNewReplace, StringNewWTF16, StringNewUTF8Array, StringNewWTF8Array, StringNewReplaceArray, StringNewWTF16Array StructGet StructSet ArrayNew ArrayInit ArrayGet ArraySet ArrayLen ArrayCopy StringNew StringConst StringMeasure with operations StringMeasureUTF8, StringMeasureWTF8, StringMeasureWTF16, StringMeasureIsUSV, StringMeasureWTF16View StringEncode with operations StringEncodeUTF8, StringEncodeWTF8, StringEncodeWTF16, StringEncodeUTF8Array, StringEncodeWTF8Array, StringEncodeWTF16Array StringConcat StringEq StringAs with operations StringAsWTF8, StringAsWTF16, StringAsIter StringWTF8Advance StringWTF16Get StringIterNext StringIterMove with operations StringIterMoveAdvance, StringIterMoveRewind StringSliceWTF with operations StringSliceWTF8, StringSliceWTF16 StringSliceIter --- src/js/binaryen.js-post.js | 67 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) (limited to 'src/js/binaryen.js-post.js') diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index c684553a5..f9e4d0d44 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -118,7 +118,22 @@ function initializeConstants() { 'ArrayInit', 'ArrayGet', 'ArraySet', - 'ArrayLen' + 'ArrayLen', + 'ArrayCopy', + 'RefAs', + 'StringNew', + 'StringConst', + 'StringMeasure', + 'StringEncode', + 'StringConcat', + 'StringEq', + 'StringAs', + 'StringWTF8Advance', + 'StringWTF16Get', + 'StringIterNext', + 'StringIterMove', + 'StringSliceWTF', + 'StringSliceIter' ].forEach(name => { Module['ExpressionIds'][name] = Module[name + 'Id'] = Module['_Binaryen' + name + 'Id'](); }); @@ -542,6 +557,44 @@ function initializeConstants() { 'RefAsFunc', 'RefAsData', 'RefAsI31', + 'RefAsExternInternalize', + 'RefAsExternExternalize', + 'BrOnNull', + 'BrOnNonNull', + 'BrOnCast', + 'BrOnCastFail', + 'BrOnFunc', + 'BrOnNonFunc', + 'BrOnData', + 'BrOnNonData', + 'BrOnI31', + 'BrOnNonI31', + 'StringNewUTF8', + 'StringNewWTF8', + 'StringNewReplace', + 'StringNewWTF16', + 'StringNewUTF8Array', + 'StringNewWTF8Array', + 'StringNewReplaceArray', + 'StringNewWTF16Array', + 'StringMeasureUTF8', + 'StringMeasureWTF8', + 'StringMeasureWTF16', + 'StringMeasureIsUSV', + 'StringMeasureWTF16View', + 'StringEncodeUTF8', + 'StringEncodeWTF8', + 'StringEncodeWTF16', + 'StringEncodeUTF8Array', + 'StringEncodeWTF8Array', + 'StringEncodeWTF16Array', + 'StringAsWTF8', + 'StringAsWTF16', + 'StringAsIter', + 'StringIterMoveAdvance', + 'StringIterMoveRewind', + 'StringSliceWTF8', + 'StringSliceWTF16' ].forEach(name => { Module['Operations'][name] = Module[name] = Module['_Binaryen' + name](); }); @@ -2382,6 +2435,18 @@ function wrapModule(module, self = {}) { } }; + // TODO: extern.internalize + // TODO: extern.externalize + // TODO: ref.test + // TODO: ref.cast + // TODO: br_on_* + // TODO: struct.* + // TODO: array.* + // TODO: string.* + // TODO: stringview_wtf8.* + // TODO: stringview_wtf16.* + // TODO: stringview_iter.* + // 'Module' operations self['addFunction'] = function(name, params, results, varTypes, body) { return preserveStack(() => -- cgit v1.2.3