Refine opcode br_table for classic interpreter (#1112)
Refine opcode br_table for classic interpreter as there may be a lot of
leb128 decoding when the br count is big:
1. Use the bytecode itself to store the decoded leb br depths if each
decoded depth can be stored with one byte
2. Create br_table cache to store the decode leb br depths if the decoded
depth cannot be stored with one byte
After the optimization, the class interpreter can access the br depths array
with index, no need to decode the leb128 again.
And fix function record_fast_op() return value unchecked issue in source
debugging feature.
This commit is contained in:
@ -263,12 +263,13 @@ typedef enum WASMOpcode {
|
||||
WASM_OP_REF_IS_NULL = 0xd1, /* ref.is_null */
|
||||
WASM_OP_REF_FUNC = 0xd2, /* ref.func */
|
||||
|
||||
EXT_OP_BLOCK = 0xd3, /* block with blocktype */
|
||||
EXT_OP_LOOP = 0xd4, /* loop with blocktype */
|
||||
EXT_OP_IF = 0xd5, /* if with blocktype */
|
||||
EXT_OP_BLOCK = 0xd3, /* block with blocktype */
|
||||
EXT_OP_LOOP = 0xd4, /* loop with blocktype */
|
||||
EXT_OP_IF = 0xd5, /* if with blocktype */
|
||||
EXT_OP_BR_TABLE_CACHE = 0xd6, /* br_table from cache */
|
||||
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
DEBUG_OP_BREAK = 0xd6, /* debug break point */
|
||||
DEBUG_OP_BREAK = 0xd7, /* debug break point */
|
||||
#endif
|
||||
|
||||
/* Post-MVP extend op prefix */
|
||||
@ -675,7 +676,7 @@ typedef enum WASMAtomicEXTOpcode {
|
||||
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
#define DEF_DEBUG_BREAK_HANDLE(_name) \
|
||||
_name[DEBUG_OP_BREAK] = HANDLE_OPCODE(DEBUG_OP_BREAK); /* 0xd6 */
|
||||
_name[DEBUG_OP_BREAK] = HANDLE_OPCODE(DEBUG_OP_BREAK); /* 0xd7 */
|
||||
#else
|
||||
#define DEF_DEBUG_BREAK_HANDLE(_name)
|
||||
#endif
|
||||
@ -901,6 +902,7 @@ typedef enum WASMAtomicEXTOpcode {
|
||||
HANDLE_OPCODE(EXT_OP_BLOCK), /* 0xd3 */ \
|
||||
HANDLE_OPCODE(EXT_OP_LOOP), /* 0xd4 */ \
|
||||
HANDLE_OPCODE(EXT_OP_IF), /* 0xd5 */ \
|
||||
HANDLE_OPCODE(EXT_OP_BR_TABLE_CACHE), /* 0xd6 */ \
|
||||
}; \
|
||||
do { \
|
||||
_name[WASM_OP_MISC_PREFIX] = \
|
||||
|
||||
Reference in New Issue
Block a user