Bug 219146 - WebAssembly: parser should support two-byte opcodes
Summary: WebAssembly: parser should support two-byte opcodes
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebAssembly (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-11-18 23:13 PST by Sergey Rubanov
Modified: 2021-02-16 16:32 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Rubanov 2020-11-18 23:13:02 PST
Parser only supports exttable opcodes now (from reference types proposal) which are

table.grow  0xFC 0F 
table.size  0xFC 10
table.fill  0xFC 11

Non-trapping float-to-int conversations opcodes and bulk memory operations opcodes also start with 0xFC

i32.trunc_sat_f32_s	0xfc 0x00
i32.trunc_sat_f32_u	0xfc 0x01
i32.trunc_sat_f64_s	0xfc 0x02
i32.trunc_sat_f64_u	0xfc 0x03
i64.trunc_sat_f32_s	0xfc 0x04
i64.trunc_sat_f32_u	0xfc 0x05
i64.trunc_sat_f64_s	0xfc 0x06
i64.trunc_sat_f64_u	0xfc 0x07

memory.init	        0xfc 0x08
data.drop	        0xfc 0x09
memory.copy	        0xfc 0x0a
memory.fill	        0xfc 0x0b
table.init	        0xfc 0x0c
elem.drop	        0xfc 0x0d
table.copy	        0xfc 0x0e 

Adding any of these new 0xFC opcodes to Source/JavaScriptCore/wasm/wasm.json throws an error. Handling all two-byte opcodes correctly requires changes in generateWasmOpsHeader.py
Comment 1 Radar WebKit Bug Importer 2020-11-26 03:25:50 PST
<rdar://problem/71747813>
Comment 2 Sergey Rubanov 2020-12-17 15:01:43 PST
Bulk memory operations are implemented (as exttable operations). Non-trapping float-to-int conversations still need to have category "conversation" like all other conversation operations or their own category.
Comment 3 Yusuke Suzuki 2020-12-17 15:44:41 PST
Yeah, I think, for Non-trapping float-to-int conversations opcodes, we can implement it as an extopcodes as bulk memory operation opcodes are implemented.
This one can clean up implementation later.