Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/iwasm/aot/aot_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,7 @@ aot_module_malloc(AOTModuleInstance *module_inst, uint32 size,
aot_set_exception(module_inst, "app heap corrupted");
}
else {
aot_set_exception(module_inst, "out of memory");
LOG_WARNING("warning: allocate %u bytes memory failed", size);
}
return 0;
}
Expand Down
3 changes: 2 additions & 1 deletion core/iwasm/common/wasm_shared_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ acquire_wait_info(void *address, bool create)
AtomicWaitInfo *wait_info = NULL;
bh_list_status ret;

wait_info = (AtomicWaitInfo *)bh_hash_map_find(wait_map, address);
if (address)
wait_info = (AtomicWaitInfo *)bh_hash_map_find(wait_map, address);

if (!create)
return wait_info;
Expand Down
14 changes: 13 additions & 1 deletion core/iwasm/interpreter/wasm_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -3040,6 +3040,18 @@ load_from_sections(WASMModule *module, WASMSection *sections,
break;
}
}
if (!aux_stack_top_global) {
/* Auxiliary stack global isn't found, it must be unused
in the wasm app, as if it is used, the global must be
defined. Here we set it to __heap_base global and set
its size to 0. */
aux_stack_top_global = aux_heap_base_global;
aux_stack_top = aux_heap_base;
module->aux_stack_top_global_index =
module->aux_heap_base_global_index;
module->aux_stack_bottom = aux_stack_top;
module->aux_stack_size = 0;
}
break;
}
}
Expand Down Expand Up @@ -3084,7 +3096,7 @@ load_from_sections(WASMModule *module, WASMSection *sections,
export->name, export->index);

/* resolve retain function.
If not find, reset malloc function index */
If not found, reset malloc function index */
export_tmp = module->exports;
for (j = 0; j < module->export_count; j++, export_tmp++) {
if ((export_tmp->kind == EXPORT_KIND_FUNC)
Expand Down
14 changes: 13 additions & 1 deletion core/iwasm/interpreter/wasm_mini_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1959,6 +1959,18 @@ load_from_sections(WASMModule *module, WASMSection *sections,
break;
}
}
if (!aux_stack_top_global) {
/* Auxiliary stack global isn't found, it must be unused
in the wasm app, as if it is used, the global must be
defined. Here we set it to __heap_base global and set
its size to 0. */
aux_stack_top_global = aux_heap_base_global;
aux_stack_top = aux_heap_base;
module->aux_stack_top_global_index =
module->aux_heap_base_global_index;
module->aux_stack_bottom = aux_stack_top;
module->aux_stack_size = 0;
}
break;
}
}
Expand Down Expand Up @@ -2002,7 +2014,7 @@ load_from_sections(WASMModule *module, WASMSection *sections,
export->name, export->index);

/* resolve retain function.
If not find, reset malloc function index */
If not found, reset malloc function index */
export_tmp = module->exports;
for (j = 0; j < module->export_count; j++, export_tmp++) {
if ((export_tmp->kind == EXPORT_KIND_FUNC)
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/interpreter/wasm_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -1830,7 +1830,7 @@ wasm_module_malloc(WASMModuleInstance *module_inst, uint32 size,
wasm_set_exception(module_inst, "app heap corrupted");
}
else {
wasm_set_exception(module_inst, "out of memory");
LOG_WARNING("warning: allocate %u bytes memory failed", size);
}
return 0;
}
Expand Down