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:
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user