Fix some spelling issues (#3385)

Fix some of the spelling issues found by CSpell.
This commit is contained in:
Benbuck Nason 2024-05-05 16:56:48 -07:00 committed by GitHub
parent c0e33f08b0
commit ca61184ced
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 102 additions and 99 deletions

View File

@ -43,7 +43,7 @@ jobs:
run: /usr/bin/env python3 -m pip install -r requirements.txt --break-system-packages run: /usr/bin/env python3 -m pip install -r requirements.txt --break-system-packages
working-directory: build-scripts working-directory: build-scripts
- name: retrive the last commit ID - name: retrieve the last commit ID
id: get_last_commit id: get_last_commit
run: echo "last_commit=$(GH_TOKEN=${{ secrets.GITHUB_TOKEN }} /usr/bin/env python3 ./build_llvm.py --llvm-ver)" >> $GITHUB_OUTPUT run: echo "last_commit=$(GH_TOKEN=${{ secrets.GITHUB_TOKEN }} /usr/bin/env python3 ./build_llvm.py --llvm-ver)" >> $GITHUB_OUTPUT
working-directory: build-scripts working-directory: build-scripts

View File

@ -57,7 +57,7 @@ def pre_flight_check(root: pathlib) -> bool:
def check_aspell(root): def check_aspell(root):
return True return True
def check_clang_foramt(root: pathlib) -> bool: def check_clang_format(root: pathlib) -> bool:
if not locate_command(CLANG_FORMAT_CMD): if not locate_command(CLANG_FORMAT_CMD):
return False return False
@ -74,7 +74,7 @@ def pre_flight_check(root: pathlib) -> bool:
def check_git_clang_format() -> bool: def check_git_clang_format() -> bool:
return locate_command(GIT_CLANG_FORMAT_CMD) return locate_command(GIT_CLANG_FORMAT_CMD)
return check_aspell(root) and check_clang_foramt(root) and check_git_clang_format() return check_aspell(root) and check_clang_format(root) and check_git_clang_format()
def run_clang_format(file_path: pathlib, root: pathlib) -> bool: def run_clang_format(file_path: pathlib, root: pathlib) -> bool:

View File

@ -304,7 +304,7 @@
#define WASM_DISABLE_STACK_HW_BOUND_CHECK 0 #define WASM_DISABLE_STACK_HW_BOUND_CHECK 0
#endif #endif
/* Disable SIMD unless it is manualy enabled somewhere */ /* Disable SIMD unless it is manually enabled somewhere */
#ifndef WASM_ENABLE_SIMD #ifndef WASM_ENABLE_SIMD
#define WASM_ENABLE_SIMD 0 #define WASM_ENABLE_SIMD 0
#endif #endif
@ -445,7 +445,7 @@
#endif #endif
/* Reserved bytes to the native thread stack boundary, throw native /* Reserved bytes to the native thread stack boundary, throw native
* stack overflow exception if the guard boudary is reached * stack overflow exception if the guard boundary is reached
* *
* WASM_STACK_GUARD_SIZE needs to be large enough for: * WASM_STACK_GUARD_SIZE needs to be large enough for:
* *
@ -461,7 +461,7 @@
* - aot runtime functions * - aot runtime functions
* eg. aot_enlarge_memory. * eg. aot_enlarge_memory.
* *
* - w/o hw bound check, the intepreter loop * - w/o hw bound check, the interpreter loop
* *
* the stack consumption heavily depends on compiler settings, * the stack consumption heavily depends on compiler settings,
* especially for huge functions like the classic interpreter's * especially for huge functions like the classic interpreter's
@ -514,7 +514,7 @@
/* /*
* Use a larger default for platforms like macOS/Linux. * Use a larger default for platforms like macOS/Linux.
* *
* For example, the classic intepreter loop which ended up with a trap * For example, the classic interpreter loop which ended up with a trap
* (wasm_runtime_set_exception) would consume about 2KB stack on x86-64 * (wasm_runtime_set_exception) would consume about 2KB stack on x86-64
* macOS. On Ubuntu amd64 20.04, it seems to consume a bit more. * macOS. On Ubuntu amd64 20.04, it seems to consume a bit more.
* *

View File

@ -94,7 +94,7 @@ check_buf(const uint8 *buf, const uint8 *buf_end, uint32 length,
{ {
if ((uintptr_t)buf + length < (uintptr_t)buf if ((uintptr_t)buf + length < (uintptr_t)buf
|| (uintptr_t)buf + length > (uintptr_t)buf_end) { || (uintptr_t)buf + length > (uintptr_t)buf_end) {
set_error_buf(error_buf, error_buf_size, "unexpect end"); set_error_buf(error_buf, error_buf_size, "unexpected end");
return false; return false;
} }
return true; return true;
@ -323,13 +323,13 @@ load_string(uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
#endif #endif
else if (is_load_from_file_buf) { else if (is_load_from_file_buf) {
/* The string is always terminated with '\0', use it directly. /* The string is always terminated with '\0', use it directly.
* In this case, the file buffer can be reffered to after loading. * In this case, the file buffer can be referred to after loading.
*/ */
bh_assert(p[str_len - 1] == '\0'); bh_assert(p[str_len - 1] == '\0');
str = (char *)p; str = (char *)p;
} }
else { else {
/* Load from sections, the file buffer cannot be reffered to /* Load from sections, the file buffer cannot be referred to
after loading, we must create another string and insert it after loading, we must create another string and insert it
into const string set */ into const string set */
bh_assert(p[str_len - 1] == '\0'); bh_assert(p[str_len - 1] == '\0');
@ -2518,7 +2518,7 @@ load_function_section(const uint8 *buf, const uint8 *buf_end, AOTModule *module,
#if defined(BUILD_TARGET_XTENSA) #if defined(BUILD_TARGET_XTENSA)
/* /*
* For Xtensa XIP, real func_count is doubled, including aot_func and * For Xtensa XIP, real func_count is doubled, including aot_func and
* aot_func_internal, so need to multipy func_count by 2 here. * aot_func_internal, so need to multiply func_count by 2 here.
*/ */
if (module->is_indirect_mode) { if (module->is_indirect_mode) {
func_count *= 2; func_count *= 2;
@ -3912,7 +3912,7 @@ resolve_execute_mode(const uint8 *buf, uint32 size, bool *p_mode,
p += 8; p += 8;
while (p < p_end) { while (p < p_end) {
read_uint32(p, p_end, section_type); read_uint32(p, p_end, section_type);
if (section_type <= AOT_SECTION_TYPE_SIGANATURE) { if (section_type <= AOT_SECTION_TYPE_SIGNATURE) {
read_uint32(p, p_end, section_size); read_uint32(p, p_end, section_size);
CHECK_BUF(p, p_end, section_size); CHECK_BUF(p, p_end, section_size);
if (section_type == AOT_SECTION_TYPE_TARGET_INFO) { if (section_type == AOT_SECTION_TYPE_TARGET_INFO) {
@ -3927,7 +3927,7 @@ resolve_execute_mode(const uint8 *buf, uint32 size, bool *p_mode,
break; break;
} }
} }
else { /* section_type > AOT_SECTION_TYPE_SIGANATURE */ else { /* section_type > AOT_SECTION_TYPE_SIGNATURE */
set_error_buf(error_buf, error_buf_size, set_error_buf(error_buf, error_buf_size,
"resolve execute mode failed"); "resolve execute mode failed");
break; break;
@ -3966,7 +3966,7 @@ create_sections(AOTModule *module, const uint8 *buf, uint32 size,
p += 8; p += 8;
while (p < p_end) { while (p < p_end) {
read_uint32(p, p_end, section_type); read_uint32(p, p_end, section_type);
if (section_type < AOT_SECTION_TYPE_SIGANATURE if (section_type < AOT_SECTION_TYPE_SIGNATURE
|| section_type == AOT_SECTION_TYPE_CUSTOM) { || section_type == AOT_SECTION_TYPE_CUSTOM) {
read_uint32(p, p_end, section_size); read_uint32(p, p_end, section_size);
CHECK_BUF(p, p_end, section_size); CHECK_BUF(p, p_end, section_size);

View File

@ -1119,7 +1119,7 @@ init_func_ptrs(AOTModuleInstance *module_inst, AOTModule *module,
#if defined(BUILD_TARGET_XTENSA) #if defined(BUILD_TARGET_XTENSA)
/* /*
* For Xtensa XIP, real func_count is doubled, including aot_func and * For Xtensa XIP, real func_count is doubled, including aot_func and
* aot_func_internal, so need to multipy func_count by 2 here. * aot_func_internal, so need to multiply func_count by 2 here.
*/ */
if (module->is_indirect_mode) { if (module->is_indirect_mode) {
func_count *= 2; func_count *= 2;
@ -1166,7 +1166,7 @@ init_func_type_indexes(AOTModuleInstance *module_inst, AOTModule *module,
#if defined(BUILD_TARGET_XTENSA) #if defined(BUILD_TARGET_XTENSA)
/* /*
* For Xtensa XIP, real func_count is doubled, including aot_func and * For Xtensa XIP, real func_count is doubled, including aot_func and
* aot_func_internal, so need to multipy func_count by 2 here. * aot_func_internal, so need to multiply func_count by 2 here.
*/ */
if (module->is_indirect_mode) { if (module->is_indirect_mode) {
func_count *= 2; func_count *= 2;
@ -1394,7 +1394,7 @@ execute_post_instantiate_functions(AOTModuleInstance *module_inst,
} }
#endif #endif
/* Execute start function for both main insance and sub instance */ /* Execute start function for both main instance and sub instance */
if (module->start_function) { if (module->start_function) {
AOTFunctionInstance start_func = { 0 }; AOTFunctionInstance start_func = { 0 };
uint32 func_type_idx; uint32 func_type_idx;
@ -2221,8 +2221,8 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
#if WASM_ENABLE_AOT_STACK_FRAME != 0 #if WASM_ENABLE_AOT_STACK_FRAME != 0
/* Free all frames allocated, note that some frames /* Free all frames allocated, note that some frames
may be allocated in AOT code and havent' been may be allocated in AOT code and haven't been
freed if exception occured */ freed if exception occurred */
while (exec_env->cur_frame != prev_frame) while (exec_env->cur_frame != prev_frame)
aot_free_frame(exec_env); aot_free_frame(exec_env);
#endif #endif
@ -2291,8 +2291,8 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
#if WASM_ENABLE_AOT_STACK_FRAME != 0 #if WASM_ENABLE_AOT_STACK_FRAME != 0
/* Free all frames allocated, note that some frames /* Free all frames allocated, note that some frames
may be allocated in AOT code and havent' been may be allocated in AOT code and haven't been
freed if exception occured */ freed if exception occurred */
while (exec_env->cur_frame != prev_frame) while (exec_env->cur_frame != prev_frame)
aot_free_frame(exec_env); aot_free_frame(exec_env);
#endif #endif
@ -4296,7 +4296,7 @@ aot_dump_pgo_prof_data_to_buf(AOTModuleInstance *module_inst, char *buf,
LLVMProfileData_64 *prof_data_64 = (LLVMProfileData_64 *)buf; LLVMProfileData_64 *prof_data_64 = (LLVMProfileData_64 *)buf;
/* Convert LLVMProfileData to LLVMProfileData_64, the pointer width /* Convert LLVMProfileData to LLVMProfileData_64, the pointer width
in the output file is alawys 8 bytes */ in the output file is always 8 bytes */
prof_data = (LLVMProfileData *)module->data_sections[i].data; prof_data = (LLVMProfileData *)module->data_sections[i].data;
prof_data_64->func_md5 = prof_data->func_md5; prof_data_64->func_md5 = prof_data->func_md5;
prof_data_64->func_hash = prof_data->func_hash; prof_data_64->func_hash = prof_data->func_hash;

View File

@ -43,7 +43,7 @@ typedef enum AOTSectionType {
AOT_SECTION_TYPE_FUNCTION = 3, AOT_SECTION_TYPE_FUNCTION = 3,
AOT_SECTION_TYPE_EXPORT = 4, AOT_SECTION_TYPE_EXPORT = 4,
AOT_SECTION_TYPE_RELOCATION = 5, AOT_SECTION_TYPE_RELOCATION = 5,
AOT_SECTION_TYPE_SIGANATURE = 6, AOT_SECTION_TYPE_SIGNATURE = 6,
AOT_SECTION_TYPE_CUSTOM = 100, AOT_SECTION_TYPE_CUSTOM = 100,
} AOTSectionType; } AOTSectionType;
@ -420,7 +420,7 @@ typedef struct LLVMProfileData {
uint16 num_value_sites[2]; uint16 num_value_sites[2];
} LLVMProfileData; } LLVMProfileData;
/* The profiling data for writting to the output file, the width of /* The profiling data for writing to the output file, the width of
pointer is 8 bytes suppose we always use wamrc and llvm-profdata pointer is 8 bytes suppose we always use wamrc and llvm-profdata
with 64-bit mode */ with 64-bit mode */
typedef struct LLVMProfileData_64 { typedef struct LLVMProfileData_64 {

View File

@ -13,7 +13,7 @@ extern "C" {
#endif #endif
/** /**
* Object header of a WASM object, as the adddress of allocated memory * Object header of a WASM object, as the address of allocated memory
* must be 8-byte aligned, the lowest 3 bits are zero, we use them to * must be 8-byte aligned, the lowest 3 bits are zero, we use them to
* mark the object: * mark the object:
* bits[0] is 1: the object is an externref object * bits[0] is 1: the object is an externref object
@ -85,7 +85,7 @@ typedef struct WASMArrayObject {
/* Must be pointer of WASMRttObject of array type */ /* Must be pointer of WASMRttObject of array type */
WASMObjectHeader header; WASMObjectHeader header;
/* (<array length> << 2) | <array element size>, /* (<array length> << 2) | <array element size>,
* elem_count = lenght >> 2 * elem_count = length >> 2
* elem_size = 2 ^ (length & 0x3) * elem_size = 2 ^ (length & 0x3)
*/ */
uint32 length; uint32 length;

View File

@ -127,7 +127,7 @@ execute_main(WASMModuleInstanceCommon *module_inst, int32 argc, char *argv[])
#if WASM_ENABLE_THREAD_MGR != 0 #if WASM_ENABLE_THREAD_MGR != 0
if (ret) { if (ret) {
/* On a successful return from the `_start` function, /* On a successful return from the `_start` function,
we terminate other threads by mimicing wasi:proc_exit(0). we terminate other threads by mimicking wasi:proc_exit(0).
Note: Note:
- A return from the `main` function is an equivalent of - A return from the `main` function is an equivalent of
@ -516,11 +516,11 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name,
case VALUE_TYPE_V128: case VALUE_TYPE_V128:
{ {
/* it likes 0x123\0x234 or 123\234 */ /* it likes 0x123\0x234 or 123\234 */
/* retrive first i64 */ /* retrieve first i64 */
*(uint64 *)(argv1 + p) = strtoull(argv[i], &endptr, 0); *(uint64 *)(argv1 + p) = strtoull(argv[i], &endptr, 0);
/* skip \ */ /* skip \ */
endptr++; endptr++;
/* retrive second i64 */ /* retrieve second i64 */
*(uint64 *)(argv1 + p + 2) = strtoull(endptr, &endptr, 0); *(uint64 *)(argv1 + p + 2) = strtoull(endptr, &endptr, 0);
p += 4; p += 4;
break; break;

View File

@ -536,7 +536,7 @@ search_thread_local_store_num(Vector *stores_by_tid, korp_tid tid,
#endif #endif
static unsigned static unsigned
retrive_thread_local_store_num(Vector *stores_by_tid, korp_tid tid) retrieve_thread_local_store_num(Vector *stores_by_tid, korp_tid tid)
{ {
#ifndef os_thread_local_attribute #ifndef os_thread_local_attribute
unsigned i = 0; unsigned i = 0;
@ -664,8 +664,8 @@ wasm_store_new(wasm_engine_t *engine)
if (!engine || singleton_engine != engine) if (!engine || singleton_engine != engine)
return NULL; return NULL;
if (!retrive_thread_local_store_num(&engine->stores_by_tid, if (!retrieve_thread_local_store_num(&engine->stores_by_tid,
os_self_thread())) { os_self_thread())) {
if (!wasm_runtime_init_thread_env()) { if (!wasm_runtime_init_thread_env()) {
LOG_ERROR("init thread environment failed"); LOG_ERROR("init thread environment failed");
return NULL; return NULL;
@ -734,8 +734,8 @@ wasm_store_delete(wasm_store_t *store)
if (decrease_thread_local_store_num(&singleton_engine->stores_by_tid, if (decrease_thread_local_store_num(&singleton_engine->stores_by_tid,
os_self_thread())) { os_self_thread())) {
if (!retrive_thread_local_store_num(&singleton_engine->stores_by_tid, if (!retrieve_thread_local_store_num(&singleton_engine->stores_by_tid,
os_self_thread())) { os_self_thread())) {
wasm_runtime_destroy_thread_env(); wasm_runtime_destroy_thread_env();
} }
} }
@ -2263,7 +2263,7 @@ wasm_module_new_ex(wasm_store_t *store, const wasm_byte_vec_t *binary,
result = result || (pkg_type == Wasm_Module_AoT); result = result || (pkg_type == Wasm_Module_AoT);
#endif #endif
if (!result) { if (!result) {
LOG_VERBOSE("current building isn't compatiable with the module," LOG_VERBOSE("current building isn't compatible with the module,"
"may need recompile"); "may need recompile");
goto quit; goto quit;
} }
@ -3386,7 +3386,7 @@ wasm_func_call(const wasm_func_t *func, const wasm_val_vec_t *params,
} }
} }
/* copy parametes */ /* copy parameters */
if (param_count if (param_count
&& !params_to_argv(params, wasm_functype_params(func->type), argv, && !params_to_argv(params, wasm_functype_params(func->type), argv,
&argc)) { &argc)) {

View File

@ -71,7 +71,7 @@ struct wasm_memorytype_t {
struct wasm_externtype_t { struct wasm_externtype_t {
uint32 extern_kind; uint32 extern_kind;
/* reservered space */ /* reserved space */
uint8 data[1]; uint8 data[1];
}; };
@ -205,7 +205,7 @@ struct wasm_extern_t {
wasm_name_t *module_name; wasm_name_t *module_name;
wasm_name_t *name; wasm_name_t *name;
wasm_externkind_t kind; wasm_externkind_t kind;
/* reservered space */ /* reserved space */
uint8 data[1]; uint8 data[1];
}; };

View File

@ -202,7 +202,7 @@ wasm_exec_env_destroy(WASMExecEnv *exec_env)
wasm_cluster_wait_for_all_except_self(cluster, exec_env); wasm_cluster_wait_for_all_except_self(cluster, exec_env);
#if WASM_ENABLE_DEBUG_INTERP != 0 #if WASM_ENABLE_DEBUG_INTERP != 0
/* Must fire exit event after other threads exits, otherwise /* Must fire exit event after other threads exits, otherwise
the stopped thread will be overrided by other threads */ the stopped thread will be overriden by other threads */
wasm_cluster_thread_exited(exec_env); wasm_cluster_thread_exited(exec_env);
#endif #endif
/* We have waited for other threads, this is the only alive thread, so /* We have waited for other threads, this is the only alive thread, so

View File

@ -71,7 +71,7 @@ uint32
get_lib_rats_export_apis(NativeSymbol **p_lib_rats_apis); get_lib_rats_export_apis(NativeSymbol **p_lib_rats_apis);
static bool static bool
compare_type_with_signautre(uint8 type, const char signature) compare_type_with_signature(uint8 type, const char signature)
{ {
const char num_sig_map[] = { 'F', 'f', 'I', 'i' }; const char num_sig_map[] = { 'F', 'f', 'I', 'i' };
@ -122,10 +122,10 @@ check_symbol_signature(const WASMFuncType *type, const char *signature)
sig = *p++; sig = *p++;
/* a f64/f32/i64/i32/externref parameter */ /* a f64/f32/i64/i32/externref parameter */
if (compare_type_with_signautre(type->types[i], sig)) if (compare_type_with_signature(type->types[i], sig))
continue; continue;
/* a pointer/string paramter */ /* a pointer/string parameter */
if (type->types[i] != VALUE_TYPE_I32) if (type->types[i] != VALUE_TYPE_I32)
/* pointer and string must be i32 type */ /* pointer and string must be i32 type */
return false; return false;
@ -156,7 +156,7 @@ check_symbol_signature(const WASMFuncType *type, const char *signature)
return false; return false;
/* result types includes: f64,f32,i64,i32,externref */ /* result types includes: f64,f32,i64,i32,externref */
if (!compare_type_with_signautre(type->types[i], *p)) if (!compare_type_with_signature(type->types[i], *p))
return false; return false;
p++; p++;

View File

@ -922,7 +922,7 @@ wasm_runtime_is_xip_file(const uint8 *buf, uint32 size)
read_uint16(p, p_end, e_type); read_uint16(p, p_end, e_type);
return (e_type == E_TYPE_XIP) ? true : false; return (e_type == E_TYPE_XIP) ? true : false;
} }
else if (section_type >= AOT_SECTION_TYPE_SIGANATURE) { else if (section_type >= AOT_SECTION_TYPE_SIGNATURE) {
return false; return false;
} }
p += section_size; p += section_size;
@ -1034,7 +1034,7 @@ wasm_runtime_register_module_internal(const char *module_name,
} }
} }
else { else {
/* module has empyt name, reset it */ /* module has empty name, reset it */
node->module_name = module_name; node->module_name = module_name;
return true; return true;
} }
@ -2150,7 +2150,7 @@ wasm_runtime_finalize_call_function(WASMExecEnv *exec_env,
bh_assert((argv && ret_argv) || (argc == 0)); bh_assert((argv && ret_argv) || (argc == 0));
if (argv == ret_argv) { if (argv == ret_argv) {
/* no need to transfrom externref results */ /* no need to transform externref results */
return true; return true;
} }
@ -2823,7 +2823,7 @@ void
wasm_runtime_set_bounds_checks(WASMModuleInstanceCommon *module_inst, wasm_runtime_set_bounds_checks(WASMModuleInstanceCommon *module_inst,
bool enable) bool enable)
{ {
/* Alwary disable bounds checks if hw bounds checks enabled */ /* Always disable bounds checks if hw bounds checks is enabled */
#ifdef OS_ENABLE_HW_BOUND_CHECK #ifdef OS_ENABLE_HW_BOUND_CHECK
enable = false; enable = false;
#endif #endif
@ -5892,7 +5892,7 @@ wasm_externref_ref2obj(uint32 externref_idx, void **p_extern_obj)
{ {
ExternRefMapNode *node; ExternRefMapNode *node;
/* catch a `ref.null` vairable */ /* catch a `ref.null` variable */
if (externref_idx == NULL_REF) { if (externref_idx == NULL_REF) {
*p_extern_obj = NULL; *p_extern_obj = NULL;
return true; return true;
@ -6866,7 +6866,7 @@ wasm_runtime_load_depended_module(const WASMModuleCommon *parent_module,
goto delete_loading_module; goto delete_loading_module;
} }
if (get_package_type(buffer, buffer_size) != parent_module->module_type) { if (get_package_type(buffer, buffer_size) != parent_module->module_type) {
LOG_DEBUG("moudle %s type error", sub_module_name); LOG_DEBUG("module %s type error", sub_module_name);
goto destroy_file_buffer; goto destroy_file_buffer;
} }
@ -7130,7 +7130,7 @@ wasm_runtime_detect_native_stack_overflow(WASMExecEnv *exec_env)
uint8 *boundary = exec_env->native_stack_boundary; uint8 *boundary = exec_env->native_stack_boundary;
RECORD_STACK_USAGE(exec_env, (uint8 *)&boundary); RECORD_STACK_USAGE(exec_env, (uint8 *)&boundary);
if (boundary == NULL) { if (boundary == NULL) {
/* the platfrom doesn't support os_thread_get_stack_boundary */ /* the platform doesn't support os_thread_get_stack_boundary */
return true; return true;
} }
#if defined(OS_ENABLE_HW_BOUND_CHECK) && WASM_DISABLE_STACK_HW_BOUND_CHECK == 0 #if defined(OS_ENABLE_HW_BOUND_CHECK) && WASM_DISABLE_STACK_HW_BOUND_CHECK == 0
@ -7153,7 +7153,7 @@ wasm_runtime_detect_native_stack_overflow_size(WASMExecEnv *exec_env,
uint8 *boundary = exec_env->native_stack_boundary; uint8 *boundary = exec_env->native_stack_boundary;
RECORD_STACK_USAGE(exec_env, (uint8 *)&boundary); RECORD_STACK_USAGE(exec_env, (uint8 *)&boundary);
if (boundary == NULL) { if (boundary == NULL) {
/* the platfrom doesn't support os_thread_get_stack_boundary */ /* the platform doesn't support os_thread_get_stack_boundary */
return true; return true;
} }
#if defined(OS_ENABLE_HW_BOUND_CHECK) && WASM_DISABLE_STACK_HW_BOUND_CHECK == 0 #if defined(OS_ENABLE_HW_BOUND_CHECK) && WASM_DISABLE_STACK_HW_BOUND_CHECK == 0

View File

@ -909,7 +909,7 @@ WASMExport *
loader_find_export(const WASMModuleCommon *module, const char *module_name, loader_find_export(const WASMModuleCommon *module, const char *module_name,
const char *field_name, uint8 export_kind, char *error_buf, const char *field_name, uint8 export_kind, char *error_buf,
uint32 error_buf_size); uint32 error_buf_size);
#endif /* WASM_ENALBE_MULTI_MODULE */ #endif /* WASM_ENABLE_MULTI_MODULE */
bool bool
wasm_runtime_is_built_in_module(const char *module_name); wasm_runtime_is_built_in_module(const char *module_name);

View File

@ -3090,7 +3090,7 @@ aot_resolve_target_info(AOTCompContext *comp_ctx, AOTObjectData *obj_data)
&& bin_type != LLVMBinaryTypeMachO32B && bin_type != LLVMBinaryTypeMachO32B
&& bin_type != LLVMBinaryTypeMachO64L && bin_type != LLVMBinaryTypeMachO64L
&& bin_type != LLVMBinaryTypeMachO64B) { && bin_type != LLVMBinaryTypeMachO64B) {
aot_set_last_error("invaid llvm binary bin_type."); aot_set_last_error("invalid llvm binary bin_type.");
return false; return false;
} }
@ -3166,13 +3166,13 @@ aot_resolve_target_info(AOTCompContext *comp_ctx, AOTObjectData *obj_data)
else if (bin_type == LLVMBinaryTypeMachO32L else if (bin_type == LLVMBinaryTypeMachO32L
|| bin_type == LLVMBinaryTypeMachO32B) { || bin_type == LLVMBinaryTypeMachO32B) {
/* TODO: parse file type of Mach-O 32 */ /* TODO: parse file type of Mach-O 32 */
aot_set_last_error("invaid llvm binary bin_type."); aot_set_last_error("invalid llvm binary bin_type.");
return false; return false;
} }
else if (bin_type == LLVMBinaryTypeMachO64L else if (bin_type == LLVMBinaryTypeMachO64L
|| bin_type == LLVMBinaryTypeMachO64B) { || bin_type == LLVMBinaryTypeMachO64B) {
/* TODO: parse file type of Mach-O 64 */ /* TODO: parse file type of Mach-O 64 */
aot_set_last_error("invaid llvm binary bin_type."); aot_set_last_error("invalid llvm binary bin_type.");
return false; return false;
} }

View File

@ -261,7 +261,7 @@ simd_integer_extension(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
return false; return false;
} }
/* retrive the low or high half */ /* retrieve the low or high half */
if (!(sub_vector = LLVMBuildShuffleVector(comp_ctx->builder, vector, if (!(sub_vector = LLVMBuildShuffleVector(comp_ctx->builder, vector,
undef[itype], mask, "half"))) { undef[itype], mask, "half"))) {
HANDLE_FAILURE("LLVMBuildShuffleVector"); HANDLE_FAILURE("LLVMBuildShuffleVector");

View File

@ -707,7 +707,7 @@ wasm_externref_obj_to_internal_obj(const wasm_externref_obj_t externref_obj);
* @param exec_env the execution environment * @param exec_env the execution environment
* @param internal_obj the internal object * @param internal_obj the internal object
* *
* @return wasm_externref_obj_t if create success, NULL othersise * @return wasm_externref_obj_t if create success, NULL otherwise
*/ */
WASM_RUNTIME_API_EXTERN wasm_externref_obj_t WASM_RUNTIME_API_EXTERN wasm_externref_obj_t
wasm_internal_obj_to_externref_obj(wasm_exec_env_t exec_env, wasm_internal_obj_to_externref_obj(wasm_exec_env_t exec_env,
@ -757,7 +757,7 @@ WASM_RUNTIME_API_EXTERN bool
wasm_runtime_unpin_object(wasm_exec_env_t exec_env, wasm_obj_t obj); wasm_runtime_unpin_object(wasm_exec_env_t exec_env, wasm_obj_t obj);
/** /**
* Check whether an object is a struct objectc * Check whether an object is a struct object
* *
* @param obj the object to check * @param obj the object to check
* *

View File

@ -96,7 +96,7 @@ typedef double float64_t;
// Vectors // Vectors
// size: capacity // size: capacity
// num_elems: current number of elements // num_elems: current number of elements
// size_of_elem: size of one elemen // size_of_elem: size of one element
#define WASM_DECLARE_VEC(name, ptr_or_none) \ #define WASM_DECLARE_VEC(name, ptr_or_none) \
typedef struct wasm_##name##_vec_t { \ typedef struct wasm_##name##_vec_t { \
size_t size; \ size_t size; \
@ -183,7 +183,7 @@ typedef union MemAllocOption {
} MemAllocOption; } MemAllocOption;
#endif /* MEM_ALLOC_OPTION_DEFINED */ #endif /* MEM_ALLOC_OPTION_DEFINED */
/* Runtime configration */ /* Runtime configuration */
struct wasm_config_t { struct wasm_config_t {
mem_alloc_type_t mem_alloc_type; mem_alloc_type_t mem_alloc_type;
MemAllocOption mem_alloc_option; MemAllocOption mem_alloc_option;

View File

@ -428,7 +428,7 @@ wasm_runtime_register_module(const char *module_name, wasm_module_t module,
/** /**
* Check if there is already a loaded module named module_name in the * Check if there is already a loaded module named module_name in the
* runtime. Repeately loading a module with the same name is not allowed. * runtime. Repeatedly loading a module with the same name is not allowed.
* *
* @param module_name indicate a name * @param module_name indicate a name
* *
@ -451,7 +451,7 @@ wasm_runtime_find_module_registered(const char *module_name);
* @param buf the byte buffer which contains the WASM/AOT binary data, * @param buf the byte buffer which contains the WASM/AOT binary data,
* note that the byte buffer must be writable since runtime may * note that the byte buffer must be writable since runtime may
* change its content for footprint and performance purpose, and * change its content for footprint and performance purpose, and
* it must be referencable until wasm_runtime_unload is called * it must be referenceable until wasm_runtime_unload is called
* @param size the size of the buffer * @param size the size of the buffer
* @param error_buf output of the exception info * @param error_buf output of the exception info
* @param error_buf_size the size of the exception string * @param error_buf_size the size of the exception string
@ -921,7 +921,7 @@ wasm_runtime_call_wasm_v(wasm_exec_env_t exec_env,
* @param exec_env the execution environment to call the function * @param exec_env the execution environment to call the function
* which must be created from wasm_create_exec_env() * which must be created from wasm_create_exec_env()
* @param element_index the function reference index, usually * @param element_index the function reference index, usually
* prvovided by the caller of a registed native function * provided by the caller of a registered native function
* @param argc the number of arguments * @param argc the number of arguments
* @param argv the arguments. If the function method has return value, * @param argv the arguments. If the function method has return value,
* the first (or first two in case 64-bit return value) element of * the first (or first two in case 64-bit return value) element of
@ -1169,7 +1169,7 @@ wasm_runtime_validate_native_addr(wasm_module_inst_t module_inst,
* stable.) * stable.)
* *
* @param module_inst the WASM module instance * @param module_inst the WASM module instance
* @param app_offset the app adress * @param app_offset the app address
* *
* @return the native address converted * @return the native address converted
*/ */
@ -1439,7 +1439,7 @@ WASM_RUNTIME_API_EXTERN double
wasm_runtime_sum_wasm_exec_time(wasm_module_inst_t module_inst); wasm_runtime_sum_wasm_exec_time(wasm_module_inst_t module_inst);
/** /**
* Return execution time in ms of a given wasm funciton with * Return execution time in ms of a given wasm function with
* func_name. If the function is not found, return 0. * func_name. If the function is not found, return 0.
* *
* @param module_inst the WASM module instance to profile * @param module_inst the WASM module instance to profile
@ -1706,7 +1706,7 @@ wasm_runtime_set_enlarge_mem_error_callback(
* to all threads in the cluster. * to all threads in the cluster.
* It's an undefined behavior if multiple threads in a cluster call * It's an undefined behavior if multiple threads in a cluster call
* wasm_runtime_set_context_spread on the same key * wasm_runtime_set_context_spread on the same key
* simultaneously. It's a caller's resposibility to perform necessary * simultaneously. It's a caller's responsibility to perform necessary
* serialization if necessary. For example: * serialization if necessary. For example:
* *
* if (wasm_runtime_get_context(inst, key) == NULL) { * if (wasm_runtime_get_context(inst, key) == NULL) {
@ -1726,7 +1726,7 @@ wasm_runtime_set_enlarge_mem_error_callback(
* *
* Note: dynamic key create/destroy while instances are live is not * Note: dynamic key create/destroy while instances are live is not
* implemented as of writing this. * implemented as of writing this.
* it's caller's resposibility to ensure destorying all module instances * it's caller's responsibility to ensure destroying all module instances
* before calling wasm_runtime_create_context_key or * before calling wasm_runtime_create_context_key or
* wasm_runtime_destroy_context_key. * wasm_runtime_destroy_context_key.
* otherwise, it's an undefined behavior. * otherwise, it's an undefined behavior.
@ -1787,7 +1787,7 @@ wasm_runtime_get_context(wasm_module_inst_t inst, void *key);
* *
* The actual wake up mechanism used by `os_wakeup_blocking_op` is * The actual wake up mechanism used by `os_wakeup_blocking_op` is
* platform-dependent. It might impose some platform-dependent restrictions * platform-dependent. It might impose some platform-dependent restrictions
* on the implementation of the blocking opearation. * on the implementation of the blocking operation.
* *
* For example, on POSIX-like platforms, a signal (by default SIGUSR1) is * For example, on POSIX-like platforms, a signal (by default SIGUSR1) is
* used. The signal delivery configurations (eg. signal handler, signal mask, * used. The signal delivery configurations (eg. signal handler, signal mask,

View File

@ -85,8 +85,8 @@ extern "C" {
/** /**
* Used by wamr compiler to represent object ref types, * Used by wamr compiler to represent object ref types,
* including func object ref, externref object ref, * including func object ref, externref object ref,
* internal object ref, eq obect ref, i31 object ref, * internal object ref, eq object ref, i31 object ref,
* struct object ref, array obect ref * struct object ref, array object ref
*/ */
#define VALUE_TYPE_GC_REF 0x43 #define VALUE_TYPE_GC_REF 0x43
@ -762,7 +762,7 @@ typedef struct WASIArguments {
uint32 map_dir_count; uint32 map_dir_count;
const char **env; const char **env;
uint32 env_count; uint32 env_count;
/* in CIDR noation */ /* in CIDR notation */
const char **addr_pool; const char **addr_pool;
uint32 addr_count; uint32 addr_count;
const char **ns_lookup_pool; const char **ns_lookup_pool;
@ -1021,7 +1021,7 @@ struct WASMModule {
/** /**
* func pointers of LLVM JITed (un-imported) functions * func pointers of LLVM JITed (un-imported) functions
* for non Multi-Tier JIT mode: * for non Multi-Tier JIT mode:
* each pointer is set to the lookuped llvm jit func ptr, note that it * each pointer is set to the looked up llvm jit func ptr, note that it
* is a stub and will trigger the actual compilation when it is called * is a stub and will trigger the actual compilation when it is called
* for Multi-Tier JIT mode: * for Multi-Tier JIT mode:
* each pointer is inited as call_to_fast_jit code block, when the llvm * each pointer is inited as call_to_fast_jit code block, when the llvm

View File

@ -1355,7 +1355,7 @@ execute_post_instantiate_functions(WASMModuleInstance *module_inst,
} }
} }
/* Execute start function for both main insance and sub instance */ /* Execute start function for both main instance and sub instance */
if (start_func && !wasm_call_function(exec_env, start_func, 0, NULL)) { if (start_func && !wasm_call_function(exec_env, start_func, 0, NULL)) {
goto fail; goto fail;
} }
@ -2022,7 +2022,7 @@ wasm_instantiate(WASMModule *module, WASMModuleInstance *parent,
* (module->import_memory_count + module->memory_count); * (module->import_memory_count + module->memory_count);
#if WASM_ENABLE_JIT != 0 #if WASM_ENABLE_JIT != 0
/* If the module dosen't have memory, reserve one mem_info space /* If the module doesn't have memory, reserve one mem_info space
with empty content to align with llvm jit compiler */ with empty content to align with llvm jit compiler */
if (module_inst_mem_inst_size == 0) if (module_inst_mem_inst_size == 0)
module_inst_mem_inst_size = (uint64)sizeof(WASMMemoryInstance); module_inst_mem_inst_size = (uint64)sizeof(WASMMemoryInstance);
@ -3791,13 +3791,13 @@ wasm_get_module_inst_mem_consumption(const WASMModuleInstance *module_inst,
mem_conspn->app_heap_size += memory->heap_data_end - memory->heap_data; mem_conspn->app_heap_size += memory->heap_data_end - memory->heap_data;
/* size of app heap structure */ /* size of app heap structure */
mem_conspn->memories_size += mem_allocator_get_heap_struct_size(); mem_conspn->memories_size += mem_allocator_get_heap_struct_size();
/* Module instance structures have been appened into the end of /* Module instance structures have been appended into the end of
module instance */ module instance */
} }
mem_conspn->tables_size = mem_conspn->tables_size =
sizeof(WASMTableInstance *) * module_inst->table_count; sizeof(WASMTableInstance *) * module_inst->table_count;
/* Table instance structures and table elements have been appened into /* Table instance structures and table elements have been appended into
the end of module instance */ the end of module instance */
mem_conspn->functions_size = mem_conspn->functions_size =
@ -3805,7 +3805,7 @@ wasm_get_module_inst_mem_consumption(const WASMModuleInstance *module_inst,
mem_conspn->globals_size = mem_conspn->globals_size =
sizeof(WASMGlobalInstance) * module_inst->e->global_count; sizeof(WASMGlobalInstance) * module_inst->e->global_count;
/* Global data has been appened into the end of module instance */ /* Global data has been appended into the end of module instance */
mem_conspn->exports_size = mem_conspn->exports_size =
sizeof(WASMExportFuncInstance) * module_inst->export_func_count; sizeof(WASMExportFuncInstance) * module_inst->export_func_count;

View File

@ -1194,7 +1194,7 @@ wait_for_thread_visitor(void *node, void *user_data)
} }
void void
wams_cluster_wait_for_all(WASMCluster *cluster) wasm_cluster_wait_for_all(WASMCluster *cluster)
{ {
os_mutex_lock(&cluster->lock); os_mutex_lock(&cluster->lock);
cluster->processing = true; cluster->processing = true;

View File

@ -45,7 +45,7 @@ struct WASMCluster {
* requests. This is a short-lived state, must be cleared immediately once * requests. This is a short-lived state, must be cleared immediately once
* the processing finished. * the processing finished.
* This is used to avoid dead lock when one thread waiting another thread * This is used to avoid dead lock when one thread waiting another thread
* with lock, see wams_cluster_wait_for_all and wasm_cluster_terminate_all * with lock, see wasm_cluster_wait_for_all and wasm_cluster_terminate_all
*/ */
bool processing; bool processing;
#if WASM_ENABLE_DEBUG_INTERP != 0 #if WASM_ENABLE_DEBUG_INTERP != 0
@ -135,7 +135,7 @@ wasm_cluster_terminate_all_except_self(WASMCluster *cluster,
WASMExecEnv *exec_env); WASMExecEnv *exec_env);
void void
wams_cluster_wait_for_all(WASMCluster *cluster); wasm_cluster_wait_for_all(WASMCluster *cluster);
void void
wasm_cluster_wait_for_all_except_self(WASMCluster *cluster, wasm_cluster_wait_for_all_except_self(WASMCluster *cluster,

View File

@ -7,7 +7,7 @@
/** /**
* The verbose level of the log system. Only those verbose logs whose * The verbose level of the log system. Only those verbose logs whose
* levels are less than or equal to this value are outputed. * levels are less than or equal to this value are output.
*/ */
static uint32 log_verbose_level = BH_LOG_LEVEL_WARNING; static uint32 log_verbose_level = BH_LOG_LEVEL_WARNING;

View File

@ -70,11 +70,11 @@ Create a corresponding concept for every native structured data type includes
#### Enum types #### Enum types
For example, if there is a `enum wams_mutability_enum` in native. For example, if there is a `enum wasm_mutability_enum` in native.
```c ```c
typedef uint8_t wams_mutability_t; typedef uint8_t wasm_mutability_t;
enum wams_mutability_enum { enum wasm_mutability_enum {
WASM_CONST, WASM_CONST,
WASM_VAR WASM_VAR
}; };
@ -83,7 +83,7 @@ enum wams_mutability_enum {
Use `ctypes.int`(or any integer types in ctypes) to represents its value directly. Use `ctypes.int`(or any integer types in ctypes) to represents its value directly.
```python ```python
# represents enum wams_mutability_enum # represents enum wasm_mutability_enum
wasm_mutability_t = c_uint8 wasm_mutability_t = c_uint8
WASM_CONST = 0 WASM_CONST = 0

View File

@ -2,7 +2,7 @@
iwasm is the executable binary built with WAMR VMcore supports WASI and command line interface. Refer to [**how to build wamr vmcore**](../doc/build_wamr.md) for all the supported CMAKE compilation variables. iwasm is the executable binary built with WAMR VMcore supports WASI and command line interface. Refer to [**how to build wamr vmcore**](../doc/build_wamr.md) for all the supported CMAKE compilation variables.
If you are building for ARM architecture on a X86 development machine, you can use the `CMAKE_TOOLCHAIN_FILE` to set the toolchain file for cross compling. If you are building for ARM architecture on a X86 development machine, you can use the `CMAKE_TOOLCHAIN_FILE` to set the toolchain file for cross compiling.
``` ```
cmake .. -DCMAKE_TOOLCHAIN_FILE=$TOOL_CHAIN_FILE \ cmake .. -DCMAKE_TOOLCHAIN_FILE=$TOOL_CHAIN_FILE \

View File

@ -157,7 +157,7 @@ align_ptr(const uint8 *p, uint32 b)
} }
#define AOT_SECTION_TYPE_TARGET_INFO 0 #define AOT_SECTION_TYPE_TARGET_INFO 0
#define AOT_SECTION_TYPE_SIGANATURE 6 #define AOT_SECTION_TYPE_SIGNATURE 6
#define E_TYPE_XIP 4 #define E_TYPE_XIP 4
#define CHECK_BUF(buf, buf_end, length) \ #define CHECK_BUF(buf, buf_end, length) \
@ -205,7 +205,7 @@ is_xip_file(const uint8 *buf, uint32 size)
read_uint16(p, p_end, e_type); read_uint16(p, p_end, e_type);
return (e_type == E_TYPE_XIP) ? true : false; return (e_type == E_TYPE_XIP) ? true : false;
} }
else if (section_type >= AOT_SECTION_TYPE_SIGANATURE) { else if (section_type >= AOT_SECTION_TYPE_SIGNATURE) {
return false; return false;
} }
p += section_size; p += section_size;

View File

@ -429,7 +429,7 @@ module_reader_callback(package_type_t module_type, const char *module_name,
} }
static void static void
moudle_destroyer(uint8 *buffer, uint32 size) module_destroyer_callback(uint8 *buffer, uint32 size)
{ {
if (!buffer) { if (!buffer) {
return; return;
@ -906,7 +906,8 @@ main(int argc, char *argv[])
#endif #endif
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
wasm_runtime_set_module_reader(module_reader_callback, moudle_destroyer); wasm_runtime_set_module_reader(module_reader_callback,
module_destroyer_callback);
#endif #endif
/* load WASM module */ /* load WASM module */

View File

@ -246,7 +246,7 @@ module_reader_callback(package_type_t module_type, const char *module_name,
} }
static void static void
moudle_destroyer(uint8 *buffer, uint32 size) module_destroyer_callback(uint8 *buffer, uint32 size)
{ {
if (!buffer) { if (!buffer) {
return; return;
@ -506,7 +506,8 @@ main(int argc, char *argv[])
#endif #endif
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
wasm_runtime_set_module_reader(module_reader_callback, moudle_destroyer); wasm_runtime_set_module_reader(module_reader_callback,
module_destroyer_callback);
#endif #endif
/* load WASM module */ /* load WASM module */

View File

@ -38,7 +38,7 @@ module_reader_callback(package_type_t module_type, const char *module_name,
} }
static void static void
moudle_destroyer(uint8 *buffer, uint32 size) module_destroyer_callback(uint8 *buffer, uint32 size)
{ {
if (!buffer) { if (!buffer) {
return; return;
@ -89,7 +89,8 @@ main(int argc, char *argv[])
#if WASM_ENABLE_MULTI_MODULE != 0 #if WASM_ENABLE_MULTI_MODULE != 0
printf("- wasm_runtime_set_module_reader\n"); printf("- wasm_runtime_set_module_reader\n");
/* set module reader and destroyer */ /* set module reader and destroyer */
wasm_runtime_set_module_reader(module_reader_callback, moudle_destroyer); wasm_runtime_set_module_reader(module_reader_callback,
module_destroyer_callback);
#endif #endif
/* load WASM byte buffer from WASM bin file */ /* load WASM byte buffer from WASM bin file */
@ -163,7 +164,7 @@ UNLOAD_MODULE:
printf("- wasm_runtime_unload\n"); printf("- wasm_runtime_unload\n");
wasm_runtime_unload(module); wasm_runtime_unload(module);
RELEASE_BINARY: RELEASE_BINARY:
moudle_destroyer(file_buf, file_buf_size); module_destroyer_callback(file_buf, file_buf_size);
RELEASE_RUNTIME: RELEASE_RUNTIME:
printf("- wasm_runtime_destroy\n"); printf("- wasm_runtime_destroy\n");
wasm_runtime_destroy(); wasm_runtime_destroy();

View File

@ -181,13 +181,13 @@ vm_clone_from_instance(const wasm_vm_t *base)
{ {
/** /**
* if do a clone of the level instantiated_module, need to malloc and * if do a clone of the level instantiated_module, need to malloc and
* initialie * initialize
* - global. WASMGlobalIntance and global data * - global. WASMGlobalInstance and global data
* - memory. WAAMMemoryInstance, memory_data and heap * - memory. WASMMemoryInstance, memory_data and heap
* - table. WASMTableInstance, table_data * - table. WASMTableInstance, table_data
* - exports. all global, memory and table * - exports. all global, memory and table
* *
* it is almost everything in wasm_instantiate() except funciton. * it is almost everything in wasm_instantiate() except function.
*/ */
(void)base; (void)base;
printf("Unsupported\n"); printf("Unsupported\n");