Update sample workload's scripts to align with latest emcc (#609)

And enable auxiliary stack overflow/underflow check in JIT mode
This commit is contained in:
Wenyong Huang
2021-04-13 13:42:08 +08:00
committed by GitHub
parent ee97618bdb
commit 8b96f4fb71
8 changed files with 44 additions and 23 deletions

View File

@ -2458,6 +2458,7 @@ aot_convert_wasm_module(WASMModule *wasm_module,
#if WASM_ENABLE_SIMD != 0
option.enable_simd = true;
#endif
option.enable_aux_stack_check = true;
#if (WASM_ENABLE_PERF_PROFILING != 0) || (WASM_ENABLE_DUMP_CALL_STACK != 0)
option.enable_aux_stack_frame = true;
#endif

View File

@ -508,6 +508,18 @@ emscripten_notify_memory_growth_wrapper(wasm_exec_env_t exec_env, int i)
(void)i;
}
static void
emscripten_thread_sleep_wrapper(wasm_exec_env_t exec_env, double timeout_ms)
{
uint64 ms = (uint64)timeout_ms;
uint64 sec = ms / 1000, us = (ms % 1000) * 1000;
if (sec > 0)
sleep(sec);
if (us > 0)
usleep(us);
}
#endif /* end of BH_PLATFORM_LINUX_SGX */
#define REG_NATIVE_FUNC(func_name, signature) \
@ -543,6 +555,7 @@ static NativeSymbol native_symbols_libc_emcc[] = {
REG_NATIVE_FUNC(__sys_getcwd, "(*~)i"),
REG_NATIVE_FUNC(__sys_uname, "(*)i"),
REG_NATIVE_FUNC(emscripten_notify_memory_growth, "(i)"),
REG_NATIVE_FUNC(emscripten_thread_sleep, "(F)"),
#endif /* end of BH_PLATFORM_LINUX_SGX */
};