Fix interpreter not update memory size after call native func (#563)

The native function might call wasm function exported, in which the memory.grow opcode might be executed, and interpreter should update memory size after that, or load/store opcodes may run failed with "out of bounds memory access" exception thrown.

Update tensorflow sample patch, allow tensorflow wasm app to grow memory so as to run more models. And fix some compile issues of littlevgl zephyr sample for latest zephyr source code.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2021-03-10 15:07:16 +08:00
committed by GitHub
parent a1568825e8
commit e9e75a6b09
9 changed files with 123 additions and 85 deletions

View File

@ -1868,7 +1868,7 @@ label_pop_csp_n:
else {
/* success, return previous page count */
PUSH_I32(prev_page_count);
/* update the memory instance ptr */
/* update memory instance ptr and memory size */
memory = module->default_memory;
linear_mem_size = num_bytes_per_page * memory->cur_page_count;
}
@ -3209,7 +3209,10 @@ label_pop_csp_n:
cur_func = frame->function;
UPDATE_ALL_FROM_FRAME();
/* update memory instance ptr and memory size */
memory = module->default_memory;
if (memory)
linear_mem_size = num_bytes_per_page * memory->cur_page_count;
if (wasm_get_exception(module))
goto got_exception;
}

View File

@ -1784,7 +1784,7 @@ recover_br_info:
else {
/* success, return previous page count */
frame_lp[addr_ret] = prev_page_count;
/* update the memory instance ptr */
/* update memory instance ptr and memory size */
memory = module->default_memory;
linear_mem_size = num_bytes_per_page * memory->cur_page_count;
}
@ -3257,7 +3257,10 @@ recover_br_info:
cur_func = frame->function;
UPDATE_ALL_FROM_FRAME();
/* update memory instance ptr and memory size */
memory = module->default_memory;
if (memory)
linear_mem_size = num_bytes_per_page * memory->cur_page_count;
if (wasm_get_exception(module))
goto got_exception;
}