Fix typo 'destory' and compile issue (#119)
* Optimize samples build process * Samples: build 64 bit version by default * Fix typo 'destory' * Fix compile issue
This commit is contained in:
@ -87,7 +87,7 @@ timer_id_t
|
||||
wasm_create_timer(wasm_module_inst_t module_inst,
|
||||
int interval, bool is_period, bool auto_start);
|
||||
void
|
||||
wasm_timer_destory(wasm_module_inst_t module_inst, timer_id_t timer_id);
|
||||
wasm_timer_destroy(wasm_module_inst_t module_inst, timer_id_t timer_id);
|
||||
void
|
||||
wasm_timer_cancel(wasm_module_inst_t module_inst, timer_id_t timer_id);
|
||||
void
|
||||
|
||||
@ -29,7 +29,7 @@ timer_id_t
|
||||
wasm_create_timer(int interval, bool is_period, bool auto_start);
|
||||
|
||||
void
|
||||
wasm_timer_destory(timer_id_t timer_id);
|
||||
wasm_timer_destroy(timer_id_t timer_id);
|
||||
|
||||
void
|
||||
wasm_timer_cancel(timer_id_t timer_id);
|
||||
|
||||
@ -1,102 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _WASM_EXPORT_H
|
||||
#define _WASM_EXPORT_H
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* API exported to WASM application
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get current WASM module instance of the current native thread
|
||||
*
|
||||
* @return current WASM module instance of the current native thread, 0
|
||||
* if not found
|
||||
* Note: the return type is uint64_t but not pointer type, because that
|
||||
* the we only supports WASM-32, in which the pointer type is
|
||||
* compiled to WASM i32 type, but the pointer type in native can be
|
||||
* 32-bit and 64-bit. And if the native pointer is 64-bit, data loss
|
||||
* occurs after converting it to WASM i32 type.
|
||||
*/
|
||||
uint64_t
|
||||
wasm_runtime_get_current_module_inst();
|
||||
|
||||
/**
|
||||
* Validate the app address, check whether it belongs to WASM module
|
||||
* instance's address space, or in its heap space or memory space.
|
||||
*
|
||||
* @param module_inst the WASM module instance
|
||||
* @param app_offset the app address to validate, which is a relative address
|
||||
* @param size the size bytes of the app address
|
||||
*
|
||||
* @return true if success, false otherwise.
|
||||
*/
|
||||
bool
|
||||
wasm_runtime_validate_app_addr(uint64_t module_inst,
|
||||
int32_t app_offset, uint32_t size);
|
||||
|
||||
/**
|
||||
* Validate the native address, check whether it belongs to WASM module
|
||||
* instance's address space, or in its heap space or memory space.
|
||||
*
|
||||
* @param module_inst the WASM module instance
|
||||
* @param native_ptr the native address to validate, which is an absolute
|
||||
* address
|
||||
* @param size the size bytes of the app address
|
||||
*
|
||||
* @return true if success, false otherwise.
|
||||
*/
|
||||
bool
|
||||
wasm_runtime_validate_native_addr(uint64_t module_inst,
|
||||
uint64_t native_ptr, uint32_t size);
|
||||
|
||||
/**
|
||||
* Convert app address(relative address) to native address(absolute address)
|
||||
*
|
||||
* @param module_inst the WASM module instance
|
||||
* @param app_offset the app adress
|
||||
*
|
||||
* @return the native address converted
|
||||
*/
|
||||
uint64_t
|
||||
wasm_runtime_addr_app_to_native(uint64_t module_inst,
|
||||
int32_t app_offset);
|
||||
|
||||
/**
|
||||
* Convert native address(absolute address) to app address(relative address)
|
||||
*
|
||||
* @param module_inst the WASM module instance
|
||||
* @param native_ptr the native address
|
||||
*
|
||||
* @return the app address converted
|
||||
*/
|
||||
int32_t
|
||||
wasm_runtime_addr_native_to_app(uint64_t module_inst,
|
||||
uint64_t native_ptr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end of _WASM_EXPORT_H */
|
||||
@ -133,7 +133,7 @@ static NativeSymbol extended_native_symbol_defs[] = {
|
||||
EXPORT_WASM_API(wasm_post_request),
|
||||
EXPORT_WASM_API(wasm_sub_event),
|
||||
EXPORT_WASM_API(wasm_create_timer),
|
||||
EXPORT_WASM_API(wasm_timer_destory),
|
||||
EXPORT_WASM_API(wasm_timer_destroy),
|
||||
EXPORT_WASM_API(wasm_timer_cancel),
|
||||
EXPORT_WASM_API(wasm_timer_restart),
|
||||
EXPORT_WASM_API(wasm_get_sys_tick_ms),
|
||||
|
||||
@ -23,6 +23,6 @@
|
||||
void init_wasm_timer();
|
||||
timer_ctx_t get_wasm_timer_ctx();
|
||||
timer_ctx_t create_wasm_timer_ctx(unsigned int module_id, int prealloc_num);
|
||||
void destory_module_timer_ctx(unsigned int module_id);
|
||||
void destroy_module_timer_ctx(unsigned int module_id);
|
||||
|
||||
#endif /* LIB_BASE_RUNTIME_LIB_H_ */
|
||||
|
||||
@ -123,7 +123,7 @@ timer_ctx_t create_wasm_timer_ctx(unsigned int module_id, int prealloc_num)
|
||||
return ctx;
|
||||
}
|
||||
|
||||
void destory_module_timer_ctx(unsigned int module_id)
|
||||
void destroy_module_timer_ctx(unsigned int module_id)
|
||||
{
|
||||
vm_mutex_lock(&g_timer_ctx_list_mutex);
|
||||
timer_ctx_node_t* elem = (timer_ctx_node_t*)
|
||||
@ -158,9 +158,9 @@ wasm_create_timer(wasm_module_inst_t module_inst,
|
||||
}
|
||||
|
||||
void
|
||||
wasm_timer_destory(wasm_module_inst_t module_inst, timer_id_t timer_id)
|
||||
wasm_timer_destroy(wasm_module_inst_t module_inst, timer_id_t timer_id)
|
||||
{
|
||||
sys_timer_destory(get_wasm_timer_ctx(), timer_id);
|
||||
sys_timer_destroy(get_wasm_timer_ctx(), timer_id);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@ -209,7 +209,7 @@ wasm_runtime_create_exec_env(uint32_t stack_size);
|
||||
* @param env the execution environment to destroy
|
||||
*/
|
||||
void
|
||||
wasm_runtime_destory_exec_env(wasm_exec_env_t env);
|
||||
wasm_runtime_destroy_exec_env(wasm_exec_env_t env);
|
||||
|
||||
/**
|
||||
* Call the given WASM function of a WASM module instance with
|
||||
|
||||
@ -99,7 +99,7 @@ wasm_hash_map_find(HashMap *map, void *key);
|
||||
* @p_old_value if not NULL, copies the old value to it
|
||||
*
|
||||
* @return true if success, false otherwise
|
||||
* Note: the old value won't be destroyed by value destory function,
|
||||
* Note: the old value won't be destroyed by value destroy function,
|
||||
* it will be copied to p_old_value for user to process.
|
||||
*/
|
||||
bool
|
||||
|
||||
@ -1116,7 +1116,7 @@ wasm_runtime_create_exec_env(uint32 stack_size)
|
||||
}
|
||||
|
||||
void
|
||||
wasm_runtime_destory_exec_env(WASMExecEnv *env)
|
||||
wasm_runtime_destroy_exec_env(WASMExecEnv *env)
|
||||
{
|
||||
if (env) {
|
||||
wasm_free(env->stack);
|
||||
|
||||
Reference in New Issue
Block a user