Fix auxiliary stack size not 16-byte aligned issue (#524)

This commit is contained in:
Wenyong Huang
2021-02-09 20:11:32 -06:00
committed by GitHub
parent 52f422dba0
commit 3849ece496
2 changed files with 5 additions and 1 deletions

View File

@ -151,9 +151,11 @@ wasm_cluster_create(WASMExecEnv *exec_env)
}
cluster->stack_size = aux_stack_size / (cluster_max_thread_num + 1);
if (cluster->stack_size == 0) {
if (cluster->stack_size < WASM_THREAD_AUX_STACK_SIZE_MIN) {
goto fail;
}
/* Make stack size 16-byte aligned */
cluster->stack_size = cluster->stack_size & (~15);
/* Set initial aux stack top to the instance and
aux stack boundary to the main exec_env */