Fix some coding style issues, fix doc typo and refine some codes (#392)

This commit is contained in:
Wenyong Huang
2020-09-20 08:20:45 +08:00
committed by GitHub
parent 7c8ccc7c26
commit e501a6963b
20 changed files with 155 additions and 227 deletions

View File

@ -175,7 +175,7 @@ typedef struct WASMGlobalImport {
WASMValue global_data_linked;
#if WASM_ENABLE_MULTI_MODULE != 0
/* imported function pointer after linked */
// TODO: remove if not necessary
/* TODO: remove if not needed */
WASMModule *import_module;
WASMGlobal *import_global_linked;
#endif

View File

@ -3269,7 +3269,6 @@ wasm_interp_call_wasm(WASMModuleInstance *module_inst,
WASMFunctionInstance *function,
uint32 argc, uint32 argv[])
{
// TODO: since module_inst = exec_env->module_inst, shall we remove the 1st arg?
WASMRuntimeFrame *prev_frame = wasm_exec_env_get_cur_frame(exec_env);
WASMInterpFrame *frame, *outs_area;

View File

@ -1117,7 +1117,7 @@ wasm_interp_dump_op_count()
#if WASM_ENABLE_LABELS_AS_VALUES != 0
//#define HANDLE_OP(opcode) HANDLE_##opcode:printf(#opcode"\n");h_##opcode
/* #define HANDLE_OP(opcode) HANDLE_##opcode:printf(#opcode"\n");h_##opcode */
#if WASM_ENABLE_OPCODE_COUNTER != 0
#define HANDLE_OP(opcode) HANDLE_##opcode:opcode_table[opcode].count++;h_##opcode
#else

View File

@ -3961,7 +3961,7 @@ fail:
LOG_OP("\nemit_op [%02x]\t", opcode); \
} while (0)
// drop local.get / const / block / loop / end
/* drop local.get / const / block / loop / end */
#define skip_label() do { \
wasm_loader_emit_backspace(loader_ctx, sizeof(int16)); \
LOG_OP("\ndelete last op\n"); \
@ -4334,7 +4334,7 @@ wasm_loader_push_frame_offset(WASMLoaderContext *ctx, uint8 type,
if (type == VALUE_TYPE_VOID)
return true;
// only check memory overflow in first traverse
/* only check memory overflow in first traverse */
if (ctx->p_code_compiled == NULL) {
if (!check_offset_push(ctx, error_buf, error_buf_size))
return false;
@ -5695,7 +5695,7 @@ handle_op_block_and_loop:
+ func->func_type->param_count + idx);
POP_TYPE(ret_type);
#if WASM_ENABLE_FAST_INTERP != 0
// emit the offset after return opcode
/* emit the offset after return opcode */
POP_OFFSET_TYPE(ret_type);
#endif
}
@ -5714,7 +5714,7 @@ handle_op_block_and_loop:
read_leb_uint32(p, p_end, func_idx);
#if WASM_ENABLE_FAST_INTERP != 0
// we need to emit func_idx before arguments
/* we need to emit func_idx before arguments */
emit_uint32(loader_ctx, func_idx);
#endif
@ -5769,7 +5769,7 @@ handle_op_block_and_loop:
read_leb_uint32(p, p_end, type_idx);
#if WASM_ENABLE_FAST_INTERP != 0
// we need to emit func_idx before arguments
/* we need to emit func_idx before arguments */
emit_uint32(loader_ctx, type_idx);
#endif

View File

@ -2890,7 +2890,7 @@ wasm_loader_pop_frame_csp(WASMLoaderContext *ctx,
LOG_OP("\nemit_op [%02x]\t", opcode); \
} while (0)
// drop local.get / const / block / loop / end
/* drop local.get / const / block / loop / end */
#define skip_label() do { \
wasm_loader_emit_backspace(loader_ctx, sizeof(int16)); \
LOG_OP("\ndelete last op\n"); \
@ -3264,7 +3264,7 @@ wasm_loader_push_frame_offset(WASMLoaderContext *ctx, uint8 type,
if (type == VALUE_TYPE_VOID)
return true;
// only check memory overflow in first traverse
/* only check memory overflow in first traverse */
if (ctx->p_code_compiled == NULL) {
if (!check_offset_push(ctx, error_buf, error_buf_size))
return false;
@ -4525,7 +4525,7 @@ handle_op_block_and_loop:
+ func->func_type->param_count + idx);
POP_TYPE(ret_type);
#if WASM_ENABLE_FAST_INTERP != 0
// emit the offset after return opcode
/* emit the offset after return opcode */
POP_OFFSET_TYPE(ret_type);
#endif
}
@ -4544,7 +4544,7 @@ handle_op_block_and_loop:
read_leb_uint32(p, p_end, func_idx);
#if WASM_ENABLE_FAST_INTERP != 0
// we need to emit func_idx before arguments
/* we need to emit func_idx before arguments */
emit_uint32(loader_ctx, func_idx);
#endif
@ -4592,7 +4592,7 @@ handle_op_block_and_loop:
read_leb_uint32(p, p_end, type_idx);
#if WASM_ENABLE_FAST_INTERP != 0
// we need to emit func_idx before arguments
/* we need to emit func_idx before arguments */
emit_uint32(loader_ctx, type_idx);
#endif

View File

@ -330,15 +330,15 @@ memories_instantiate(const WASMModule *module,
#if WASM_ENABLE_MULTI_MODULE != 0
WASMMemoryInstance *memory_inst_linked = NULL;
if (import->u.memory.import_module != NULL) {
WASMModuleInstance *module_inst_linked;
LOG_DEBUG("(%s, %s) is a memory of a sub-module",
import->u.memory.module_name,
import->u.memory.field_name);
// TODO: how about native memory ?
WASMModuleInstance *module_inst_linked =
get_sub_module_inst(
module_inst,
import->u.memory.import_module);
module_inst_linked =
get_sub_module_inst(module_inst,
import->u.memory.import_module);
bh_assert(module_inst_linked);
memory_inst_linked =