Enable WASI feature, enhance security and add SGX sample (#142)
Change emcc to clang Refine interpreter to improve perforamnce
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
#include "app_manager_export.h"
|
||||
#include "coap_ext.h"
|
||||
#include "wasm_export.h"
|
||||
#include "bh_assert.h"
|
||||
|
||||
extern void module_request_handler(request_t *request, void *user_data);
|
||||
|
||||
@ -47,6 +48,7 @@ wasm_register_resource(wasm_module_inst_t module_inst, int32 url_offset)
|
||||
if (url != NULL) {
|
||||
unsigned int mod_id = app_manager_get_module_id(Module_WASM_App,
|
||||
module_inst);
|
||||
bh_assert(mod_id != ID_NONE);
|
||||
am_register_resource(url, module_request_handler, mod_id);
|
||||
}
|
||||
}
|
||||
@ -73,6 +75,7 @@ wasm_post_request(wasm_module_inst_t module_inst,
|
||||
// set sender to help dispatch the response to the sender ap
|
||||
unsigned int mod_id = app_manager_get_module_id(Module_WASM_App,
|
||||
module_inst);
|
||||
bh_assert(mod_id != ID_NONE);
|
||||
req->sender = mod_id;
|
||||
|
||||
if (req->action == COAP_EVENT) {
|
||||
@ -98,6 +101,7 @@ wasm_sub_event(wasm_module_inst_t module_inst, int32 url_offset)
|
||||
unsigned int mod_id = app_manager_get_module_id(Module_WASM_App,
|
||||
module_inst);
|
||||
|
||||
bh_assert(mod_id != ID_NONE);
|
||||
am_register_event(url, mod_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,27 +143,34 @@ timer_id_t
|
||||
wasm_create_timer(wasm_module_inst_t module_inst,
|
||||
int interval, bool is_period, bool auto_start)
|
||||
{
|
||||
return sys_create_timer(get_wasm_timer_ctx(module_inst), interval, is_period,
|
||||
auto_start);
|
||||
timer_ctx_t timer_ctx = get_wasm_timer_ctx(module_inst);
|
||||
bh_assert(timer_ctx);
|
||||
return sys_create_timer(timer_ctx, interval, is_period, auto_start);
|
||||
}
|
||||
|
||||
void
|
||||
wasm_timer_destroy(wasm_module_inst_t module_inst, timer_id_t timer_id)
|
||||
{
|
||||
sys_timer_destroy(get_wasm_timer_ctx(module_inst), timer_id);
|
||||
timer_ctx_t timer_ctx = get_wasm_timer_ctx(module_inst);
|
||||
bh_assert(timer_ctx);
|
||||
sys_timer_destroy(timer_ctx, timer_id);
|
||||
}
|
||||
|
||||
void
|
||||
wasm_timer_cancel(wasm_module_inst_t module_inst, timer_id_t timer_id)
|
||||
{
|
||||
sys_timer_cancel(get_wasm_timer_ctx(module_inst), timer_id);
|
||||
timer_ctx_t timer_ctx = get_wasm_timer_ctx(module_inst);
|
||||
bh_assert(timer_ctx);
|
||||
sys_timer_cancel(timer_ctx, timer_id);
|
||||
}
|
||||
|
||||
void
|
||||
wasm_timer_restart(wasm_module_inst_t module_inst,
|
||||
timer_id_t timer_id, int interval)
|
||||
{
|
||||
sys_timer_restart(get_wasm_timer_ctx(module_inst), timer_id, interval);
|
||||
timer_ctx_t timer_ctx = get_wasm_timer_ctx(module_inst);
|
||||
bh_assert(timer_ctx);
|
||||
sys_timer_restart(timer_ctx, timer_id, interval);
|
||||
}
|
||||
|
||||
extern uint32 get_sys_tick_ms();
|
||||
|
||||
Reference in New Issue
Block a user