Re-org memory allocation interfaces, add --stack-size and --heap-size option (#193)

This commit is contained in:
wenyongh
2020-03-10 19:54:44 +08:00
committed by GitHub
parent 381859d530
commit 0fdd49ea31
110 changed files with 1264 additions and 2125 deletions

View File

@ -4,7 +4,6 @@
*/
#include "wasm_exec_env.h"
#include "bh_memory.h"
#include "wasm_runtime_common.h"
WASMExecEnv *
@ -16,14 +15,14 @@ wasm_exec_env_create(struct WASMModuleInstanceCommon *module_inst,
WASMExecEnv *exec_env;
if (total_size >= UINT32_MAX
|| !(exec_env = wasm_malloc((uint32)total_size)))
|| !(exec_env = wasm_runtime_malloc((uint32)total_size)))
return NULL;
memset(exec_env, 0, (uint32)total_size);
#if WASM_ENABLE_AOT != 0
if (!(exec_env->argv_buf = wasm_malloc(sizeof(uint32) * 64))) {
wasm_free(exec_env);
if (!(exec_env->argv_buf = wasm_runtime_malloc(sizeof(uint32) * 64))) {
wasm_runtime_free(exec_env);
return NULL;
}
#endif
@ -40,9 +39,9 @@ void
wasm_exec_env_destroy(WASMExecEnv *exec_env)
{
#if WASM_ENABLE_AOT != 0
wasm_free(exec_env->argv_buf);
wasm_runtime_free(exec_env->argv_buf);
#endif
wasm_free(exec_env);
wasm_runtime_free(exec_env);
}
WASMModuleInstanceCommon *