Просмотр исходного кода

Fix typo 'destory' and compile issue (#119)

* Optimize samples build process

* Samples: build 64 bit version by default

* Fix typo 'destory'

* Fix compile issue
Weining 6 лет назад
Родитель
Сommit
a770706cb6

+ 2 - 2
core/app-mgr/app-manager/module_utils.c

@@ -184,7 +184,7 @@ bool app_manager_is_interrupting_module(uint32 module_type)
     return app_manager_get_module_data(module_type)->wd_timer.is_interrupting;
 }
 
-extern void destory_module_timer_ctx(unsigned int module_id);
+extern void destroy_module_timer_ctx(unsigned int module_id);
 
 void release_module(module_data *m_data)
 {
@@ -199,7 +199,7 @@ void release_module(module_data *m_data)
 
     m_data->timer_ctx = NULL;
 
-    destory_module_timer_ctx(m_data->id);
+    destroy_module_timer_ctx(m_data->id);
 
     bh_free(m_data);
 }

+ 1 - 1
core/iwasm/lib/native-interface/native_interface.h

@@ -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

+ 1 - 1
core/iwasm/lib/native-interface/timer_api.h

@@ -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);

+ 0 - 102
core/iwasm/lib/native-interface/wasm_export.h

@@ -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 */

+ 1 - 1
core/iwasm/lib/native/base/base_lib_export.c

@@ -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),

+ 1 - 1
core/iwasm/lib/native/base/runtime_lib.h

@@ -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_ */

+ 3 - 3
core/iwasm/lib/native/base/timer_wrapper.c

@@ -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

+ 1 - 1
core/iwasm/runtime/include/wasm_export.h

@@ -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

+ 1 - 1
core/iwasm/runtime/include/wasm_hashmap.h

@@ -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

+ 1 - 1
core/iwasm/runtime/vmcore-wasm/wasm_runtime.c

@@ -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);

+ 1 - 1
core/shared-lib/mem-alloc/ems/ems_gc.h

@@ -164,7 +164,7 @@ extern gc_handle_t gc_init_with_pool(char *buf, gc_size_t buf_size);
 /**
  * Destroy heap which is initilized from a buffer
  *
- * @param handle handle to heap needed destory
+ * @param handle handle to heap needed destroy
  *
  * @return GC_SUCCESS if success
  *         GC_ERROR for bad parameters or failed system resource freeing.

+ 3 - 3
core/shared-lib/platform/include/bh_thread.h

@@ -173,9 +173,9 @@ int vm_recursive_mutex_init_instr(korp_mutex *mutex, const char*func_name);
 #endif
 
 /**
- * This function destorys a mutex
+ * This function destroys a mutex
  *
- * @param mutex  pointer to mutex need destory
+ * @param mutex  pointer to mutex need destroy
  *
  * @return BH_SUCCESS if success
  */
@@ -308,7 +308,7 @@ int vm_cond_init_instr(korp_cond *cond, const char*func_name);
 #endif
 
 /**
- * This function destorys condition variable
+ * This function destroys condition variable
  *
  * @param cond  pointer to condition variable
  *

+ 2 - 2
core/shared-lib/utils/runtime_timer.c

@@ -338,7 +338,7 @@ bool sys_timer_cancel(timer_ctx_t ctx, uint32 timer_id)
     return from_active;
 }
 
-bool sys_timer_destory(timer_ctx_t ctx, uint32 timer_id)
+bool sys_timer_destroy(timer_ctx_t ctx, uint32 timer_id)
 {
     bool from_active;
     app_timer_t * t = remove_timer(ctx, timer_id, &from_active);
@@ -347,7 +347,7 @@ bool sys_timer_destory(timer_ctx_t ctx, uint32 timer_id)
 
     release_timer(ctx, t);
 
-    PRINT("sys_timer_destory called\n");
+    PRINT("sys_timer_destroy called\n");
     return true;
 }
 

+ 1 - 1
core/shared-lib/utils/runtime_timer.h

@@ -39,7 +39,7 @@ unsigned int timer_ctx_get_owner(timer_ctx_t ctx);
 
 uint32 sys_create_timer(timer_ctx_t ctx, int interval, bool is_period,
         bool auto_start);
-bool sys_timer_destory(timer_ctx_t ctx, uint32 timer_id);
+bool sys_timer_destroy(timer_ctx_t ctx, uint32 timer_id);
 bool sys_timer_cancel(timer_ctx_t ctx, uint32 timer_id);
 bool sys_timer_restart(timer_ctx_t ctx, uint32 timer_id, int interval);
 void cleanup_app_timers(timer_ctx_t ctx);

+ 1 - 1
doc/embed_wamr.md

@@ -31,7 +31,7 @@ A typical WAMR API usage is shown below (some return value checks are ignored):
   /* the return value is stored in argv[0] */
   printf("fib function return: %d\n", argv[0]);
 
-  wasm_runtime_destory_exec_env(env);
+  wasm_runtime_destroy_exec_env(env);
   wasm_runtime_deinstantiate(inst);
   wasm_runtime_unload(module);
   wasm_runtime_destroy();