Implement multi-module feature and bulk-memory feature (#271)

Refine wasm loader and aot loader
Fix potential issue of os_mmap/os_munmap
Update document
This commit is contained in:
wenyongh
2020-06-02 14:53:06 +08:00
committed by GitHub
parent e81f72d41f
commit 752826a667
57 changed files with 4902 additions and 818 deletions

View File

@ -246,7 +246,7 @@ bool app_manager_host_init(host_interface *interface)
return true;
}
int app_manager_host_send_msg(int msg_type, const unsigned char *buf, int size)
int app_manager_host_send_msg(int msg_type, const char *buf, int size)
{
/* send an IMRT LINK message contains the buf as payload */
if (host_commu.send != NULL) {
@ -276,10 +276,10 @@ int app_manager_host_send_msg(int msg_type, const unsigned char *buf, int size)
n = host_commu.send(NULL, buf, size);
os_mutex_unlock(&host_lock);
printf("sent %d bytes to host\n", n);
app_manager_printf("sent %d bytes to host\n", n);
return n;
} else {
printf("no send api provided\n");
app_manager_printf("no send api provided\n");
}
return 0;
}

View File

@ -445,7 +445,7 @@ wasm_app_routine(void *arg)
0, NULL)) {
const char *exception = wasm_runtime_get_exception(inst);
bh_assert(exception);
printf("Got exception running wasi start function: %s\n",
app_manager_printf("Got exception running wasi start function: %s\n",
exception);
wasm_runtime_clear_exception(inst);
goto fail1;
@ -467,7 +467,7 @@ wasm_app_routine(void *arg)
0, NULL)) {
const char *exception = wasm_runtime_get_exception(inst);
bh_assert(exception);
printf("Got exception running WASM code: %s\n",
app_manager_printf("Got exception running WASM code: %s\n",
exception);
wasm_runtime_clear_exception(inst);
/* call on_destroy() in case some resources are opened in on_init()
@ -644,7 +644,7 @@ wasm_app_module_install(request_t * msg)
if (!module) {
SEND_ERR_RESPONSE(msg->mid,
"Install WASM app failed: load WASM file failed.");
printf("error: %s\n", err);
app_manager_printf("error: %s\n", err);
destroy_all_aot_sections(aot_file->sections);
return false;
}
@ -674,7 +674,7 @@ wasm_app_module_install(request_t * msg)
if (!inst) {
SEND_ERR_RESPONSE(msg->mid,
"Install WASM app failed: instantiate wasm runtime failed.");
printf("error: %s\n", err);
app_manager_printf("error: %s\n", err);
wasm_runtime_unload(module);
destroy_all_aot_sections(aot_file->sections);
return false;
@ -713,7 +713,7 @@ wasm_app_module_install(request_t * msg)
if (!module) {
SEND_ERR_RESPONSE(msg->mid,
"Install WASM app failed: load WASM file failed.");
printf("error: %s\n", err);
app_manager_printf("error: %s\n", err);
destroy_all_wasm_sections(bytecode_file->sections);
return false;
}
@ -744,7 +744,7 @@ wasm_app_module_install(request_t * msg)
if (!inst) {
SEND_ERR_RESPONSE(msg->mid,
"Install WASM app failed: instantiate wasm runtime failed.");
printf("error: %s\n", err);
app_manager_printf("error: %s\n", err);
wasm_runtime_unload(module);
destroy_all_wasm_sections(bytecode_file->sections);
return false;

View File

@ -285,7 +285,7 @@ bool
bh_applet_check_permission(const char *perm);
int
app_manager_host_send_msg(int msg_type, const unsigned char *buf, int size);
app_manager_host_send_msg(int msg_type, const char *buf, int size);
#ifdef __cplusplus
} /* end of extern "C" */