Add parameter module inst for native wrapper functions (#117)

And add asm code of em64/arm/mips version to call native wrapper functions;
Fix some issues of calling wrapper functions;
This commit is contained in:
wenyongh
2019-09-10 10:23:46 +08:00
committed by GitHub
parent 2294f52e3a
commit 26149021ff
58 changed files with 1287 additions and 494 deletions

View File

@ -176,7 +176,8 @@ void am_publish_event(request_t * event)
if (c->subscriber_id == ID_HOST) {
send_request_to_host(event);
} else {
module_request_handler(event, (void *)c->subscriber_id);
module_request_handler
(event, (void *)(uintptr_t)c->subscriber_id);
}
c = c->next;
}

View File

@ -224,8 +224,8 @@ static void app_instance_queue_callback(void *queue_msg)
app_manager_printf("Cannot find function _on_timer_callback\n");
break;
}
unsigned int timer_id = (unsigned int) bh_message_payload(
queue_msg);
unsigned int timer_id = (unsigned int)(uintptr_t)
bh_message_payload(queue_msg);
argv[0] = timer_id;
if (!wasm_runtime_call_wasm(inst, NULL, func_onTimer, 1, argv)) {
app_manager_printf("Got exception running wasm code: %s\n",
@ -642,7 +642,8 @@ static bool wasm_app_module_uninstall(request_t *msg)
static bool wasm_app_module_handle_host_url(void *queue_msg)
{
//todo: implement in future
app_manager_printf("App handles host url address %d\n", (int) queue_msg);
app_manager_printf("App handles host url address %d\n",
(int)(uintptr_t)queue_msg);
return false;
}

View File

@ -33,7 +33,7 @@ static app_res_register_t * g_resources = NULL;
void module_request_handler(request_t *request, void *user_data)
{
unsigned int mod_id = (unsigned int) user_data;
unsigned int mod_id = (unsigned int)(uintptr_t)user_data;
bh_message_t msg;
module_data *m_data;
request_t *req;
@ -99,7 +99,7 @@ void targeted_app_request_handler(request_t *request, void *unused)
goto end;
}
module_request_handler(request, (void *)m_data->id);
module_request_handler(request, (void *)(uintptr_t)m_data->id);
end: request->url = url;
}
@ -138,7 +138,7 @@ void * am_dispatch_request(request_t *request)
while (r) {
if (check_url_start(request->url, strlen(request->url), r->url) > 0) {
r->request_handler(request, (void *)r->register_id);
r->request_handler(request, (void *)(uintptr_t)r->register_id);
return r;
}
r = r->next;