Don't call start/initialize in child thread's instantiation (#1967)

The start/initialize functions of wasi module are to do some initialization work
during instantiation, which should be only called one time in the instantiation
of main instance. For example, they may initialize the data in linear memory,
if the data is changed later by the main instance, and re-initialized again by
the child instance, unexpected behaviors may occur.

And clear a shadow warning in classic interpreter.
This commit is contained in:
Wenyong Huang
2023-02-17 15:11:05 +08:00
committed by GitHub
parent 50650e4634
commit ef3a683392
3 changed files with 59 additions and 27 deletions

View File

@ -1367,7 +1367,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
HANDLE_OP(EXT_OP_BR_TABLE_CACHE)
{
BrTableCache *node =
BrTableCache *node_cache =
bh_list_first_elem(module->module->br_table_cache_list);
BrTableCache *node_next;
@ -1376,13 +1376,13 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
#endif
lidx = POP_I32();
while (node) {
node_next = bh_list_elem_next(node);
if (node->br_table_op_addr == frame_ip - 1) {
depth = node->br_depths[lidx];
while (node_cache) {
node_next = bh_list_elem_next(node_cache);
if (node_cache->br_table_op_addr == frame_ip - 1) {
depth = node_cache->br_depths[lidx];
goto label_pop_csp_n;
}
node = node_next;
node_cache = node_next;
}
bh_assert(0);
HANDLE_OP_END();