Fix issues found by GC and Fast JIT, refine some codes (#1055)
Fix handle OP_TABLE_COPY issue Fix loader handle OP_BLOCK/IF/LOOP issue if type_index is larger than 256 Fix loader handle OP_GET_GLOBAL, allow to change to GET_GLOBAL_64 for aot compiler similiar to handling OP_SET_GLOBAL Refine loader handle OP_GET/SET/TEE_LOCAL, disable changing opcode when source debugging is enabled, so as no need to record the change of opcode Refine wasm_interp_interp_frame_size to reduce the wasm operand stack usage Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
@ -6414,6 +6414,7 @@ re_scan:
|
||||
uint8 value_type;
|
||||
BlockType block_type;
|
||||
|
||||
p_org = p - 1;
|
||||
value_type = read_uint8(p);
|
||||
if (is_byte_a_type(value_type)) {
|
||||
/* If the first byte is one of these special values:
|
||||
@ -6441,9 +6442,9 @@ re_scan:
|
||||
* the block quickly.
|
||||
*/
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
record_fast_op(module, p - 2, *(p - 2));
|
||||
record_fast_op(module, p_org, *p_org);
|
||||
#endif
|
||||
*(p - 2) = EXT_OP_BLOCK + (opcode - WASM_OP_BLOCK);
|
||||
*p_org = EXT_OP_BLOCK + (opcode - WASM_OP_BLOCK);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -7309,33 +7310,22 @@ re_scan:
|
||||
operand_offset = local_offset;
|
||||
PUSH_OFFSET_TYPE(local_type);
|
||||
#else
|
||||
#if (WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 0)
|
||||
#if (WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 0) \
|
||||
&& (WASM_ENABLE_DEBUG_INTERP == 0)
|
||||
if (local_offset < 0x80) {
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
record_fast_op(module, p_org, *p_org);
|
||||
#endif
|
||||
*p_org++ = EXT_OP_GET_LOCAL_FAST;
|
||||
if (is_32bit_type(local_type)) {
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
record_fast_op(module, p_org, *p_org);
|
||||
#endif
|
||||
*p_org++ = (uint8)local_offset;
|
||||
}
|
||||
else {
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
record_fast_op(module, p_org, *p_org);
|
||||
#endif
|
||||
*p_org++ = (uint8)(local_offset | 0x80);
|
||||
}
|
||||
while (p_org < p) {
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
record_fast_op(module, p_org, *p_org);
|
||||
#endif
|
||||
*p_org++ = WASM_OP_NOP;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif /* end of WASM_ENABLE_FAST_INTERP != 0 */
|
||||
break;
|
||||
}
|
||||
|
||||
@ -7384,33 +7374,22 @@ re_scan:
|
||||
POP_OFFSET_TYPE(local_type);
|
||||
}
|
||||
#else
|
||||
#if (WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 0)
|
||||
#if (WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 0) \
|
||||
&& (WASM_ENABLE_DEBUG_INTERP == 0)
|
||||
if (local_offset < 0x80) {
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
record_fast_op(module, p_org, *p_org);
|
||||
#endif
|
||||
*p_org++ = EXT_OP_SET_LOCAL_FAST;
|
||||
if (is_32bit_type(local_type)) {
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
record_fast_op(module, p_org, *p_org);
|
||||
#endif
|
||||
*p_org++ = (uint8)local_offset;
|
||||
}
|
||||
else {
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
record_fast_op(module, p_org, *p_org);
|
||||
#endif
|
||||
*p_org++ = (uint8)(local_offset | 0x80);
|
||||
}
|
||||
while (p_org < p) {
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
record_fast_op(module, p_org, *p_org);
|
||||
#endif
|
||||
*p_org++ = WASM_OP_NOP;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif /* end of WASM_ENABLE_FAST_INTERP != 0 */
|
||||
break;
|
||||
}
|
||||
|
||||
@ -7455,33 +7434,22 @@ re_scan:
|
||||
*(loader_ctx->frame_offset
|
||||
- wasm_value_type_cell_num(local_type)));
|
||||
#else
|
||||
#if (WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 0)
|
||||
#if (WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 0) \
|
||||
&& (WASM_ENABLE_DEBUG_INTERP == 0)
|
||||
if (local_offset < 0x80) {
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
record_fast_op(module, p_org, *p_org);
|
||||
#endif
|
||||
*p_org++ = EXT_OP_TEE_LOCAL_FAST;
|
||||
if (is_32bit_type(local_type)) {
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
record_fast_op(module, p_org, *p_org);
|
||||
#endif
|
||||
*p_org++ = (uint8)local_offset;
|
||||
}
|
||||
else {
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
record_fast_op(module, p_org, *p_org);
|
||||
#endif
|
||||
*p_org++ = (uint8)(local_offset | 0x80);
|
||||
}
|
||||
while (p_org < p) {
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
record_fast_op(module, p_org, *p_org);
|
||||
#endif
|
||||
*p_org++ = WASM_OP_NOP;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif /* end of WASM_ENABLE_FAST_INTERP != 0 */
|
||||
break;
|
||||
}
|
||||
|
||||
@ -7505,7 +7473,6 @@ re_scan:
|
||||
PUSH_TYPE(global_type);
|
||||
|
||||
#if WASM_ENABLE_FAST_INTERP == 0
|
||||
#if (WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 0)
|
||||
if (global_type == VALUE_TYPE_I64
|
||||
|| global_type == VALUE_TYPE_F64) {
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
@ -7513,7 +7480,6 @@ re_scan:
|
||||
#endif
|
||||
*p_org = WASM_OP_GET_GLOBAL_64;
|
||||
}
|
||||
#endif
|
||||
#else /* else of WASM_ENABLE_FAST_INTERP */
|
||||
if (global_type == VALUE_TYPE_I64
|
||||
|| global_type == VALUE_TYPE_F64) {
|
||||
|
||||
Reference in New Issue
Block a user