diff options
author | Jérôme Vouillon <jerome.vouillon@gmail.com> | 2023-05-12 23:43:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-12 14:43:09 -0700 |
commit | 71a151240241fd50c42d88fe0ba9800c03527387 (patch) | |
tree | de98957b6f5341c3b14147c0cf6e1753d38940fe /src/wasm-binary.h | |
parent | d7b14a67ca4e9b111d5733239af88328cb779030 (diff) | |
download | binaryen-71a151240241fd50c42d88fe0ba9800c03527387.tar.gz binaryen-71a151240241fd50c42d88fe0ba9800c03527387.tar.bz2 binaryen-71a151240241fd50c42d88fe0ba9800c03527387.zip |
[Strings] Adopt new instruction binary encoding (#5714)
See WebAssembly/stringref#46.
This format is already adopted by V8: https://chromium-review.googlesource.com/c/v8/v8/+/3892695.
The text format is left unchanged (see #5607 for a discussion on the subject).
I have also added support for string.encode_lossy_utf8 and
string.encode_lossy_utf8 array (by allowing the replace policy for
Binaryen's string.encode_wtf8 instruction).
Diffstat (limited to 'src/wasm-binary.h')
-rw-r--r-- | src/wasm-binary.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 395044c4d..d1b7b4923 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -1141,16 +1141,21 @@ enum ASTNodes { ArrayFill = 0x0f, ArrayInitData = 0x54, ArrayInitElem = 0x55, - StringNewWTF8 = 0x80, + StringNewUTF8 = 0x80, StringNewWTF16 = 0x81, StringConst = 0x82, + StringMeasureUTF8 = 0x83, StringMeasureWTF8 = 0x84, StringMeasureWTF16 = 0x85, - StringEncodeWTF8 = 0x86, + StringEncodeUTF8 = 0x86, StringEncodeWTF16 = 0x87, StringConcat = 0x88, StringEq = 0x89, StringIsUSV = 0x8a, + StringNewLossyUTF8 = 0x8b, + StringNewWTF8 = 0x8c, + StringEncodeLossyUTF8 = 0x8d, + StringEncodeWTF8 = 0x8e, StringNewUTF8Try = 0x8f, StringAsWTF8 = 0x90, StringViewWTF8Advance = 0x91, @@ -1167,10 +1172,14 @@ enum ASTNodes { StringCompare = 0xa8, StringFromCodePoint = 0xa9, StringHash = 0xaa, - StringNewWTF8Array = 0xb0, + StringNewUTF8Array = 0xb0, StringNewWTF16Array = 0xb1, - StringEncodeWTF8Array = 0xb2, + StringEncodeUTF8Array = 0xb2, StringEncodeWTF16Array = 0xb3, + StringNewLossyUTF8Array = 0xb4, + StringNewWTF8Array = 0xb5, + StringEncodeLossyUTF8Array = 0xb6, + StringEncodeWTF8Array = 0xb7, StringNewUTF8ArrayTry = 0xb8, }; @@ -1182,12 +1191,6 @@ enum MemoryAccess { enum MemoryFlags { HasMaximum = 1 << 0, IsShared = 1 << 1, Is64 = 1 << 2 }; -enum StringPolicy { - UTF8 = 0x00, - WTF8 = 0x01, - Replace = 0x02, -}; - enum FeaturePrefix { FeatureUsed = '+', FeatureRequired = '=', |