Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct typos and improve comments across multiple files by codespell #4116

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: correct typos and improve comments across multiple files by code…
…spell

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
  • Loading branch information
no1wudi committed Mar 6, 2025
commit 161f1ea6c04eecbe1abc94c1d32e000a50096ae1
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Code changes
We Use Github Flow, So All Code Changes Happen Through Pull Requests. Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests:

- If you've added code that should be tested, add tests. Ensure the test suite passes.
- Avoid use macros for different platforms. Use seperate folder of source files to host diffeent platform logic.
- Avoid use macros for different platforms. Use separate folder of source files to host different platform logic.
- Put macro definitions inside share_lib/include/config.h if you have to use macro.
- Make sure your code lints and compliant to our coding style.
- Extend the application library is highly welcome.
Expand Down
2 changes: 1 addition & 1 deletion build-scripts/runtime_lib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if (NOT DEFINED DEPS_DIR)
set (DEPS_DIR ${WAMR_ROOT_DIR}/core/deps)
endif ()
if (NOT DEFINED SHARED_PLATFORM_CONFIG)
# CMake file for platform configuration. The PLATFORM_SHARED_SOURCE varable
# CMake file for platform configuration. The PLATFORM_SHARED_SOURCE variable
# should point to a list of platform-specfic source files to compile.
set (SHARED_PLATFORM_CONFIG ${SHARED_DIR}/platform/${WAMR_BUILD_PLATFORM}/shared_platform.cmake)
endif ()
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/aot/aot_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
read_uint16(buf, buf_end, type_flag);

read_uint8(buf, buf_end, is_equivalence_type);
/* If there is an equivalence type, re-use it */
/* If there is an equivalence type, reuse it */
if (is_equivalence_type) {
uint8 u8;
/* padding */
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/aot/arch/aot_reloc_xtensa.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ check_reloc_offset(uint32 target_section_size, uint64 reloc_offset,
* CPU like esp32 can read and write data through the instruction bus, but only
* in a word aligned manner; non-word-aligned access will cause a CPU exception.
* This function uses a world aligned manner to write 16bit value to instruction
* addreess.
* address.
*/
static void
put_imm16_to_addr(int16 imm16, int16 *addr)
Expand Down
4 changes: 2 additions & 2 deletions core/iwasm/common/arch/invokeNative_aarch64.s
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ _invokeNative:

/* Now x20 points to stack args */

/* Directly call the fucntion if no args in stack */
/* Directly call the function if no args in stack */
cmp x21, #0
beq call_func

Expand All @@ -69,7 +69,7 @@ loop_stack_args: /* copy stack arguments to stack */
call_func:
mov x20, x30 /* save x30(lr) */
blr x19
mov sp, x22 /* restore sp which is saved before calling fuction*/
mov sp, x22 /* restore sp which is saved before calling function*/

return:
mov x30, x20 /* restore x30(lr) */
Expand Down
4 changes: 2 additions & 2 deletions core/iwasm/common/arch/invokeNative_aarch64_simd.s
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ _invokeNative:

/* Now x20 points to stack args */

/* Directly call the fucntion if no args in stack */
/* Directly call the function if no args in stack */
cmp x21, #0
beq call_func

Expand All @@ -67,7 +67,7 @@ loop_stack_args: /* copy stack arguments to stack */
call_func:
mov x20, x30 /* save x30(lr) */
blr x19
mov sp, x22 /* restore sp which is saved before calling fuction*/
mov sp, x22 /* restore sp which is saved before calling function*/

return:
mov x30, x20 /* restore x30(lr) */
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/common/arch/invokeNative_arm_vfp.s
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ _invokeNative:
vldr s13, [r4, #52]
vldr s14, [r4, #56]
vldr s15, [r4, #60]
/* Directly call the fucntion if no args in stack */
/* Directly call the function if no args in stack */
cmp r5, #0
beq call_func

Expand Down
6 changes: 3 additions & 3 deletions core/iwasm/common/arch/invokeNative_riscv.S
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

/*
* The float abi macros used bellow are from risc-v c api:
* The float abi macros used below are from risc-v c api:
* https://github.com/riscv/riscv-c-api-doc/blob/master/riscv-c-api.md
*
*/
Expand Down Expand Up @@ -130,7 +130,7 @@ _invokeNative:
loop_stack_args:
beq t2, x0, call_func
RV_OP_LOADREG t5, 0(t1) /* load stack argument, t5 = argv[i] */
RV_OP_STOREREG t5, 0(t4) /* store t5 to reseved stack, sp[j] = t5 */
RV_OP_STOREREG t5, 0(t4) /* store t5 to reserved stack, sp[j] = t5 */
addi t1, t1, RV_REG_SIZE /* move to next stack argument */
addi t4, t4, RV_REG_SIZE /* move to next stack pointer */
addi t2, t2, -1 /* decrease t2 every loop, nstacks = nstacks -1 */
Expand All @@ -142,7 +142,7 @@ call_func:
/* restore registers pushed in stack or saved in another register */
return:
mv sp, fp /* restore sp saved in fp before function call */
RV_OP_LOADREG fp, 0 * RV_REG_SIZE(sp) /* load previous frame poniter to fp register */
RV_OP_LOADREG fp, 0 * RV_REG_SIZE(sp) /* load previous frame pointer to fp register */
RV_OP_LOADREG ra, 1 * RV_REG_SIZE(sp) /* load previous return address to ra register */
addi sp, sp, 2 * RV_REG_SIZE /* pop frame, restore sp */
jr ra
2 changes: 1 addition & 1 deletion core/iwasm/common/arch/invokeNative_thumb_vfp.s
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ _invokeNative:
vldr s13, [r4, #52]
vldr s14, [r4, #56]
vldr s15, [r4, #60]
/* Directly call the fucntion if no args in stack */
/* Directly call the function if no args in stack */
cmp r5, #0
beq call_func

Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/common/wasm_application.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ execute_main(WASMModuleInstanceCommon *module_inst, int32 argc, char *argv[])

#if WASM_ENABLE_LIBC_WASI != 0
/* In wasi mode, we should call the function named "_start"
which initializes the wasi envrionment and then calls
which initializes the wasi environment and then calls
the actual main function. Directly calling main function
may cause exception thrown. */
if ((func = wasm_runtime_lookup_wasi_start_function(module_inst))) {
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/common/wasm_c_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -2257,7 +2257,7 @@ wasm_module_new_ex(wasm_store_t *store, wasm_byte_vec_t *binary, LoadArgs *args)
if (!store || !binary || binary->size == 0 || binary->size > UINT32_MAX)
goto quit;

/* whether the combination of compilation flags are compatable with the
/* whether the combination of compilation flags are compatible with the
* package type */
{
PackageType pkg_type;
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/common/wasm_exec_env.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ wasm_exec_env_destroy(WASMExecEnv *exec_env)
wasm_cluster_wait_for_all_except_self(cluster, exec_env);
#if WASM_ENABLE_DEBUG_INTERP != 0
/* Must fire exit event after other threads exits, otherwise
the stopped thread will be overriden by other threads */
the stopped thread will be overridden by other threads */
wasm_cluster_thread_exited(exec_env);
#endif
/* We have waited for other threads, this is the only alive thread, so
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/compilation/aot_compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ set_local_gc_ref(AOTCompFrame *frame, int n, LLVMValueRef value, uint8 ref_type)
} \
else { \
char *func_name = #name; \
/* AOT mode, delcare the function */ \
/* AOT mode, declare the function */ \
if (!(func = LLVMGetNamedFunction(func_ctx->module, func_name)) \
&& !(func = LLVMAddFunction(func_ctx->module, func_name, \
func_type))) { \
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/compilation/aot_emit_aot_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -3846,7 +3846,7 @@ aot_resolve_object_relocation_group(AOTObjectData *obj_data,
}
}

/* pares each relocation */
/* parse each relocation */
if (!(rel_itr = LLVMGetRelocations(rel_sec))) {
aot_set_last_error("llvm get relocations failed.");
return false;
Expand Down
6 changes: 3 additions & 3 deletions core/iwasm/compilation/aot_emit_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
memory allocator, the hmu node includes hmu header and hmu
memory, only the latter is returned to the caller as the
allocated memory, the hmu header isn't returned so the
first byte of the shared heap won't be accesed, (2) using
first byte of the shared heap won't be accessed, (2) using
IntUGT gets better performance than IntUGE in some cases */
BUILD_ICMP(LLVMIntUGT, offset1, func_ctx->shared_heap_start_off,
is_in_shared_heap, "is_in_shared_heap");
Expand Down Expand Up @@ -1101,7 +1101,7 @@ aot_compile_op_memory_grow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
}
else {
char *func_name = "aot_enlarge_memory";
/* AOT mode, delcare the function */
/* AOT mode, declare the function */
if (!(func = LLVMGetNamedFunction(func_ctx->module, func_name))
&& !(func =
LLVMAddFunction(func_ctx->module, func_name, func_type))) {
Expand Down Expand Up @@ -1184,7 +1184,7 @@ check_bulk_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
* Note: not throw the integer-overflow-exception here since it must
* have been thrown when converting float to integer before
*/
/* return addres directly if constant offset and inside memory space */
/* return address directly if constant offset and inside memory space */
if (LLVMIsEfficientConstInt(offset) && LLVMIsEfficientConstInt(bytes)) {
uint64 mem_offset = (uint64)LLVMConstIntGetZExtValue(offset);
uint64 mem_len = (uint64)LLVMConstIntGetZExtValue(bytes);
Expand Down
6 changes: 3 additions & 3 deletions core/iwasm/compilation/aot_llvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1720,7 +1720,7 @@ aot_create_stack_sizes(const AOTCompData *comp_data, AOTCompContext *comp_ctx)
* This value is a placeholder, which will be replaced
* after the corresponding functions are compiled.
*
* Don't use zeros becasue LLVM can optimize them to
* Don't use zeros because LLVM can optimize them to
* zeroinitializer.
*/
values[i] = I32_NEG_ONE;
Expand Down Expand Up @@ -2354,7 +2354,7 @@ create_target_machine_detect_host(AOTCompContext *comp_ctx)
}

if (!LLVMTargetHasJIT(target)) {
aot_set_last_error("unspported JIT on this platform.");
aot_set_last_error("unsupported JIT on this platform.");
goto fail;
}

Expand Down Expand Up @@ -3412,7 +3412,7 @@ aot_get_native_symbol_index(AOTCompContext *comp_ctx, const char *symbol)

sym = bh_list_first_elem(&comp_ctx->native_symbols);

/* Lookup an existing symobl record */
/* Lookup an existing symbol record */

while (sym) {
if (strcmp(sym->symbol, symbol) == 0) {
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/compilation/iwasm_compl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endif()

set (IWASM_COMPL_SOURCE ${source_all})

# Disalbe rtti to works with LLVM
# Disable rtti to works with LLVM

if (MSVC)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/compilation/simd/simd_int_arith.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ simd_integer_arith(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
result = LLVMBuildMul(comp_ctx->builder, lhs, rhs, "product");
break;
default:
HANDLE_FAILURE("Unsupport arith_op");
HANDLE_FAILURE("Unsupported arith_op");
break;
}

Expand Down
20 changes: 10 additions & 10 deletions core/iwasm/fast-jit/cg/x86-64/jit_codegen_x86_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,15 +423,15 @@ jmp_from_label_to_label(x86::Assembler &a, bh_list *jmp_info_list,

/**
* Encode detecting compare result register according to condition code
* and then jumping to suitable label when the condtion is met
* and then jumping to suitable label when the condition is met
*
* @param cc the compiler context
* @param a the assembler to emit the code
* @param jmp_info_list the jmp info list
* @param label_src the index of src label
* @param op the opcode of condition operation
* @param r1 the label info when condition is met
* @param r2 the label info when condition is unmet, do nonthing if VOID
* @param r2 the label info when condition is unmet, do nothing if VOID
* @param is_last_insn if current insn is the last insn of current block
*
* @return true if success, false if failed
Expand Down Expand Up @@ -2589,7 +2589,7 @@ alu_r_r_r_i32(x86::Assembler &a, ALU_OP op, int32 reg_no_dst, int32 reg_no1_src,
if (reg_no2_src == REG_EDX_IDX) {
/* convert `REM_S edx, eax, edx` into
`mov esi, edx` and `REM_S edx eax, rsi` to
avoid overwritting edx when a.cdq() */
avoid overwriting edx when a.cdq() */
a.mov(regs_i32[REG_I32_FREE_IDX], regs_i32[REG_EDX_IDX]);
reg_no2_src = REG_I32_FREE_IDX;
}
Expand All @@ -2609,7 +2609,7 @@ alu_r_r_r_i32(x86::Assembler &a, ALU_OP op, int32 reg_no_dst, int32 reg_no1_src,
if (reg_no2_src == REG_EDX_IDX) {
/* convert `REM_U edx, eax, edx` into
`mov esi, edx` and `REM_U edx eax, rsi` to
avoid overwritting edx when unsigned extend
avoid overwriting edx when unsigned extend
eax to edx:eax */
a.mov(regs_i32[REG_I32_FREE_IDX], regs_i32[REG_EDX_IDX]);
reg_no2_src = REG_I32_FREE_IDX;
Expand Down Expand Up @@ -5602,7 +5602,7 @@ lower_select(JitCompContext *cc, x86::Assembler &a, COND_OP op, JitReg r0,
a.jmp(imm); \
if (!err_handler->err) { \
/* The offset written by asmjit is always 0, we patch it \
again, 6 is the size of jmp instruciton */ \
again, 6 is the size of jmp instruction */ \
stream = (char *)a.code()->sectionById(0)->buffer().data() \
+ a.code()->sectionById(0)->buffer().size() - 6; \
_offset = label_offsets[label_dst] \
Expand Down Expand Up @@ -6169,7 +6169,7 @@ lower_return(JitCompContext *cc, x86::Assembler &a, JitInsn *insn)
* Replace all the jmp address pre-saved when the code cache hasn't been
* allocated with actual address after code cache allocated
*
* @param cc compiler context containting the allocated code cacha info
* @param cc compiler context containing the allocated code cacha info
* @param jmp_info_list the jmp info list
*/
static void
Expand Down Expand Up @@ -6557,7 +6557,7 @@ at_cmpxchg_r_ra_base_r_offset_imm(x86::Assembler &a, uint32 bytes_dst,
* @param a the assembler to emit the code
* @param bytes_dst the bytes number of the data to actual operated on(load,
* compare, replacement) could be 1(byte), 2(short), 4(int32), 8(int64)
* @param data_xchg the immediate data for exchange(conditionally replacment
* @param data_xchg the immediate data for exchange(conditionally replacement
* value)
* @param reg_no_base the no of register that stores the base address
* of src&dst memory
Expand Down Expand Up @@ -6587,7 +6587,7 @@ at_cmpxchg_imm_ra_base_r_offset_r(x86::Assembler &a, uint32 bytes_dst,
* @param a the assembler to emit the code
* @param bytes_dst the bytes number of the data to actual operated on(load,
* compare, replacement) could be 1(byte), 2(short), 4(int32), 8(int64)
* @param data_xchg the immediate data for exchange(conditionally replacment
* @param data_xchg the immediate data for exchange(conditionally replacement
* value)
* @param reg_no_base the no of register that stores the base address
* of src&dst memory
Expand Down Expand Up @@ -8820,7 +8820,7 @@ jit_codegen_compile_call_to_fast_jit(const WASMModule *module, uint32 func_idx)

/* If yes, set eax to 0, return to caller */

/* Pop all integer arument registers */
/* Pop all integer argument registers */
for (i = 0; i < MAX_REG_INTS; i++) {
a.pop(regs_i64[reg_idx_of_int_args[i]]);
}
Expand Down Expand Up @@ -9084,7 +9084,7 @@ jit_codegen_compile_call_to_fast_jit(const WASMModule *module, uint32 func_idx)
a.mov(m, x86::rdx);
}

/* Pop all integer arument registers */
/* Pop all integer argument registers */
for (i = 0; i < MAX_REG_INTS; i++) {
a.pop(regs_i64[reg_idx_of_int_args[i]]);
}
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/fast-jit/fe/jit_emit_compare.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jit_compile_op_compare_integer(JitCompContext *cc, IntCond cond, bool is64Bit)
JitReg lhs, rhs, res, const_zero, const_one;

if (cond < INT_EQZ || cond > INT_GE_U) {
jit_set_last_error(cc, "unsupported comparation operation");
jit_set_last_error(cc, "unsupported comparison operation");
goto fail;
}

Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/fast-jit/fe/jit_emit_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ jit_compile_op_br_table(JitCompContext *cc, uint32 *br_depths, uint32 br_count,
copy_arities = check_copy_arities(block_dst, cc->jit_frame);

if (!copy_arities) {
/* No need to create new basic block, direclty jump to
/* No need to create new basic block, directly jump to
the existing basic block when no need to copy arities */
if (i == br_count) {
if (block_dst->label_type == LABEL_TYPE_LOOP) {
Expand Down
4 changes: 2 additions & 2 deletions core/iwasm/fast-jit/jit_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ get_global_base_offset(const WASMModule *module)
* (module->import_memory_count + module->memory_count);

#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 */
if (mem_inst_size == 0)
mem_inst_size = (uint32)sizeof(WASMMemoryInstance);
Expand Down Expand Up @@ -1169,7 +1169,7 @@ init_func_translation(JitCompContext *cc)
time_started = jit_cc_new_reg_I64(cc);
/* Call os_time_thread_cputime_us() to get time_started firstly
as there is stack frame switching below, calling native in them
may cause register spilling work inproperly */
may cause register spilling work improperly */
if (!jit_emit_callnative(cc, os_time_thread_cputime_us, time_started, NULL,
0)) {
return NULL;
Expand Down
Loading
Loading