mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-03-12 00:45:28 +00:00
fix: correct typos and improve comments across multiple files by codespell (#4116)
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
parent
73998e4c85
commit
412631ac13
|
@ -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.
|
||||
|
|
|
@ -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 ()
|
||||
|
|
|
@ -1715,7 +1715,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 */
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -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) */
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -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) */
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
*
|
||||
*/
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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))) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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))) { \
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
@ -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))) {
|
||||
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
|
|
@ -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-")
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -423,7 +423,7 @@ 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
|
||||
|
@ -431,7 +431,7 @@ jmp_from_label_to_label(x86::Assembler &a, bh_list *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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -5602,7 +5602,7 @@ fail:
|
|||
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] \
|
||||
|
@ -6169,7 +6169,7 @@ fail:
|
|||
* 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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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]]);
|
||||
}
|
||||
|
@ -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]]);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
@ -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;
|
||||
|
|
|
@ -94,7 +94,7 @@ typedef uint32 JitReg;
|
|||
/*
|
||||
* Constant index flag of non-constant-value (constant value flag is
|
||||
* not set in register no. field) integer, floating point and vector
|
||||
* regisers. If this flag is set, the rest bits of the register
|
||||
* registers. If this flag is set, the rest bits of the register
|
||||
* no. represent an index to the constant value table of the
|
||||
* corresponding type of the register and the register is read-only.
|
||||
*/
|
||||
|
@ -1084,7 +1084,7 @@ typedef struct JitCompContext {
|
|||
/* Capacity of register annotations of each kind. */
|
||||
uint32 _capacity[JIT_REG_KIND_L32];
|
||||
|
||||
/* Constant vallues of each kind. */
|
||||
/* Constant values of each kind. */
|
||||
uint8 *_value[JIT_REG_KIND_L32];
|
||||
|
||||
/* Next element on the list of values with the same hash code. */
|
||||
|
@ -1145,7 +1145,7 @@ typedef struct JitCompContext {
|
|||
JitInsn **_table;
|
||||
} _insn_hash_table;
|
||||
|
||||
/* indicate if the last comparision is about floating-point numbers or not
|
||||
/* indicate if the last comparison is about floating-point numbers or not
|
||||
*/
|
||||
bool last_cmp_on_fp;
|
||||
} JitCompContext;
|
||||
|
@ -1203,7 +1203,7 @@ typedef struct JitCompContext {
|
|||
* Annotation disabling functions jit_annl_disable_NAME,
|
||||
* jit_anni_disable_NAME and jit_annr_disable_NAME, which release
|
||||
* memory of the annotations. Before calling these functions,
|
||||
* resources owned by the annotations must be explictely released.
|
||||
* resources owned by the annotations must be explicitly released.
|
||||
*/
|
||||
#define ANN_LABEL(TYPE, NAME) void jit_annl_disable_##NAME(JitCompContext *cc);
|
||||
#define ANN_INSN(TYPE, NAME) void jit_anni_disable_##NAME(JitCompContext *cc);
|
||||
|
@ -1559,7 +1559,7 @@ _jit_cc_new_insn_norm(JitCompContext *cc, JitReg *result, JitInsn *insn);
|
|||
*
|
||||
* @param cc the compilationo context
|
||||
* @param result returned result of the instruction. If the value is
|
||||
* non-zero, it is the result of the constant-folding or an exsiting
|
||||
* non-zero, it is the result of the constant-folding or an existing
|
||||
* equivalent instruction, in which case no instruction is added into
|
||||
* the compilation context. Otherwise, a new normalized instruction
|
||||
* has been added into the compilation context.
|
||||
|
|
|
@ -221,7 +221,7 @@ get_reg_stride(JitReg reg)
|
|||
* @param rc the regalloc context
|
||||
* @param vreg the virtual register
|
||||
*
|
||||
* @return the spill slot encoded in a consant register
|
||||
* @return the spill slot encoded in a constant register
|
||||
*/
|
||||
static JitReg
|
||||
rc_alloc_spill_slot(RegallocContext *rc, JitReg vreg)
|
||||
|
@ -478,7 +478,7 @@ reload_vreg(RegallocContext *rc, JitReg vreg, JitInsn *cur_insn)
|
|||
JitReg fp_reg = rc->cc->fp_reg, offset;
|
||||
|
||||
if (!vr->slot && !(vr->slot = rc_alloc_spill_slot(rc, vreg)))
|
||||
/* Cannot allocte spill slot (due to OOM or frame size limit). */
|
||||
/* Cannot allocate spill slot (due to OOM or frame size limit). */
|
||||
return NULL;
|
||||
|
||||
offset = offset_of_spill_slot(rc->cc, vr->slot);
|
||||
|
@ -579,7 +579,7 @@ spill_vreg(RegallocContext *rc, JitReg vreg, JitInsn *cur_insn)
|
|||
|
||||
/**
|
||||
* Allocate a hard register for the virtual register. Necessary
|
||||
* reloade instruction will be inserted after the given instruction.
|
||||
* reload instruction will be inserted after the given instruction.
|
||||
*
|
||||
* @param rc the regalloc context
|
||||
* @param vreg the virtual register
|
||||
|
@ -665,7 +665,7 @@ allocate_hreg(RegallocContext *rc, JitReg vreg, JitInsn *insn, int distance)
|
|||
|
||||
/**
|
||||
* Allocate a hard register for the virtual register if not allocated
|
||||
* yet. Necessary spill and reloade instructions will be inserted
|
||||
* yet. Necessary spill and reload instructions will be inserted
|
||||
* before/after and after the given instruction. This operation will
|
||||
* convert the virtual register's state from 1 or 3 to 2.
|
||||
*
|
||||
|
|
|
@ -2283,7 +2283,7 @@ wasm_runtime_detach_shared_heap(wasm_module_inst_t module_inst);
|
|||
* @param size required memory size
|
||||
* @param p_native_addr native address of allocated memory
|
||||
*
|
||||
* @return return the allocated memory address, which re-uses part of the wasm
|
||||
* @return return the allocated memory address, which reuses part of the wasm
|
||||
* address space and is in the range of [UINT32 - shared_heap_size + 1, UINT32]
|
||||
* (when the wasm memory is 32-bit) or [UINT64 - shared_heap_size + 1, UINT64]
|
||||
* (when the wasm memory is 64-bit). Note that it is not an absolute address.
|
||||
|
|
|
@ -1934,7 +1934,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
|||
UNWIND_CSP(relative_depth, LABEL_TYPE_FUNCTION);
|
||||
/* push exception values for catch
|
||||
* The values are copied to the CALLER FRAME
|
||||
* (prev_frame->sp) same behvior ad WASM_OP_RETURN
|
||||
* (prev_frame->sp) same behavior ad WASM_OP_RETURN
|
||||
*/
|
||||
if (cell_num_to_copy > 0) {
|
||||
word_copy(prev_frame->sp,
|
||||
|
@ -4963,7 +4963,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
|||
HANDLE_OP_END();
|
||||
}
|
||||
|
||||
/* numberic instructions of i32 */
|
||||
/* numeric instructions of i32 */
|
||||
HANDLE_OP(WASM_OP_I32_CLZ)
|
||||
{
|
||||
DEF_OP_BIT_COUNT(uint32, I32, clz32);
|
||||
|
@ -5120,7 +5120,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
|||
HANDLE_OP_END();
|
||||
}
|
||||
|
||||
/* numberic instructions of i64 */
|
||||
/* numeric instructions of i64 */
|
||||
HANDLE_OP(WASM_OP_I64_CLZ)
|
||||
{
|
||||
DEF_OP_BIT_COUNT(uint64, I64, clz64);
|
||||
|
@ -5277,7 +5277,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
|||
HANDLE_OP_END();
|
||||
}
|
||||
|
||||
/* numberic instructions of f32 */
|
||||
/* numeric instructions of f32 */
|
||||
HANDLE_OP(WASM_OP_F32_ABS)
|
||||
{
|
||||
DEF_OP_MATH(float32, F32, fabsf);
|
||||
|
@ -5381,7 +5381,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
|||
HANDLE_OP_END();
|
||||
}
|
||||
|
||||
/* numberic instructions of f64 */
|
||||
/* numeric instructions of f64 */
|
||||
HANDLE_OP(WASM_OP_F64_ABS)
|
||||
{
|
||||
DEF_OP_MATH(float64, F64, fabs);
|
||||
|
@ -6680,7 +6680,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
|||
tag++, t++) {
|
||||
|
||||
/* compare the module and the external index with the
|
||||
* imort tag data */
|
||||
* import tag data */
|
||||
if ((cur_func->u.func_import->import_module
|
||||
== tag->u.tag_import->import_module)
|
||||
&& (ext_exception
|
||||
|
|
|
@ -4149,7 +4149,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
|||
HANDLE_OP_END();
|
||||
}
|
||||
|
||||
/* numberic instructions of i32 */
|
||||
/* numeric instructions of i32 */
|
||||
HANDLE_OP(WASM_OP_I32_CLZ)
|
||||
{
|
||||
DEF_OP_BIT_COUNT(uint32, I32, clz32);
|
||||
|
@ -4319,7 +4319,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
|||
HANDLE_OP_END();
|
||||
}
|
||||
|
||||
/* numberic instructions of i64 */
|
||||
/* numeric instructions of i64 */
|
||||
HANDLE_OP(WASM_OP_I64_CLZ)
|
||||
{
|
||||
DEF_OP_BIT_COUNT(uint64, I64, clz64);
|
||||
|
@ -4476,7 +4476,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
|||
HANDLE_OP_END();
|
||||
}
|
||||
|
||||
/* numberic instructions of f32 */
|
||||
/* numeric instructions of f32 */
|
||||
HANDLE_OP(WASM_OP_F32_ABS)
|
||||
{
|
||||
DEF_OP_MATH(float32, F32, fabsf);
|
||||
|
@ -4581,7 +4581,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
|||
HANDLE_OP_END();
|
||||
}
|
||||
|
||||
/* numberic instructions of f64 */
|
||||
/* numeric instructions of f64 */
|
||||
HANDLE_OP(WASM_OP_F64_ABS)
|
||||
{
|
||||
DEF_OP_MATH(float64, F64, fabs);
|
||||
|
|
|
@ -399,7 +399,7 @@ check_array_type(const WASMModule *module, uint32 type_index, char *error_buf,
|
|||
return false;
|
||||
}
|
||||
if (module->types[type_index]->type_flag != WASM_TYPE_ARRAY) {
|
||||
set_error_buf(error_buf, error_buf_size, "unkown array type");
|
||||
set_error_buf(error_buf, error_buf_size, "unknown array type");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -954,7 +954,7 @@ load_init_expr(WASMModule *module, const uint8 **p_buf, const uint8 *buf_end,
|
|||
if (struct_type->base_type.type_flag
|
||||
!= WASM_TYPE_STRUCT) {
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"unkown struct type");
|
||||
"unknown struct type");
|
||||
goto fail;
|
||||
}
|
||||
field_count = struct_type->field_count;
|
||||
|
@ -1020,7 +1020,7 @@ load_init_expr(WASMModule *module, const uint8 **p_buf, const uint8 *buf_end,
|
|||
if (module->types[type_idx]->type_flag
|
||||
!= WASM_TYPE_STRUCT) {
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"unkown struct type");
|
||||
"unknown struct type");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -1059,7 +1059,7 @@ load_init_expr(WASMModule *module, const uint8 **p_buf, const uint8 *buf_end,
|
|||
if (array_type->base_type.type_flag
|
||||
!= WASM_TYPE_ARRAY) {
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"unkown array type");
|
||||
"unknown array type");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -11420,7 +11420,7 @@ re_scan:
|
|||
if (!check_offset_push(loader_ctx, error_buf,
|
||||
error_buf_size))
|
||||
goto fail;
|
||||
/* for following dummy value assignemnt */
|
||||
/* for following dummy value assignment */
|
||||
loader_ctx->frame_offset -= cell_num;
|
||||
}
|
||||
|
||||
|
@ -11732,7 +11732,7 @@ re_scan:
|
|||
*/
|
||||
cur_block->label_type = LABEL_TYPE_CATCH;
|
||||
|
||||
/* RESET_STACK removes the values pushed in TRY or pervious
|
||||
/* RESET_STACK removes the values pushed in TRY or previous
|
||||
* CATCH Blocks */
|
||||
RESET_STACK();
|
||||
|
||||
|
@ -11774,7 +11774,7 @@ re_scan:
|
|||
/* replace frame_csp by LABEL_TYPE_CATCH_ALL */
|
||||
cur_block->label_type = LABEL_TYPE_CATCH_ALL;
|
||||
|
||||
/* RESET_STACK removes the values pushed in TRY or pervious
|
||||
/* RESET_STACK removes the values pushed in TRY or previous
|
||||
* CATCH Blocks */
|
||||
RESET_STACK();
|
||||
|
||||
|
@ -12128,7 +12128,7 @@ re_scan:
|
|||
}
|
||||
if (module->types[type_idx1]->type_flag != WASM_TYPE_FUNC) {
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"unkown function type");
|
||||
"unknown function type");
|
||||
goto fail;
|
||||
}
|
||||
if (!wasm_loader_pop_nullable_typeidx(loader_ctx, &type,
|
||||
|
@ -12145,7 +12145,7 @@ re_scan:
|
|||
}
|
||||
if (module->types[type_idx]->type_flag != WASM_TYPE_FUNC) {
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"unkown function type");
|
||||
"unknown function type");
|
||||
goto fail;
|
||||
}
|
||||
if (!wasm_func_type_is_super_of(
|
||||
|
@ -13911,7 +13911,7 @@ re_scan:
|
|||
if (module->types[type_idx]->type_flag
|
||||
!= WASM_TYPE_STRUCT) {
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"unkown struct type");
|
||||
"unknown struct type");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
|
@ -2457,7 +2457,7 @@ orcjit_thread_callback(void *arg)
|
|||
i + j * group_stride + module->import_function_count,
|
||||
(void *)func_addr);
|
||||
|
||||
/* Try to switch to call this llvm jit funtion instead of
|
||||
/* Try to switch to call this llvm jit function instead of
|
||||
fast jit function from fast jit jitted code */
|
||||
jit_compiler_set_call_to_llvm_jit(
|
||||
module,
|
||||
|
|
|
@ -991,7 +991,7 @@ __wasi_sock_get_ipv6_only(__wasi_fd_t fd, bool *option)
|
|||
/**
|
||||
* TODO: modify recv() and send()
|
||||
* since don't want to re-compile the wasi-libc,
|
||||
* we tend to keep original implentations of recv() and send().
|
||||
* we tend to keep original implementations of recv() and send().
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -65,7 +65,7 @@ test(int iter_num, int max_threads_num, int retry_num, int retry_time_us)
|
|||
}
|
||||
|
||||
while ((__atomic_load_n(&threads_in_use, __ATOMIC_SEQ_CST) != 0)) {
|
||||
// Casting to int* to supress compiler warning
|
||||
// Casting to int* to suppress compiler warning
|
||||
__builtin_wasm_memory_atomic_wait32((int *)(&threads_in_use), 0,
|
||||
second_us);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ typedef __wasi_dircookie_t wasi_dircookie_t;
|
|||
// result are not guaranteed to be zero'ed by us so the result essentially
|
||||
// contains garbage from the WASM app perspective. To prevent this, we return
|
||||
// uint32 directly instead so as not to be reliant on the correct behaviour of
|
||||
// any current/future WASI SDK implemenations.
|
||||
// any current/future WASI SDK implementations.
|
||||
typedef uint32_t wasi_errno_t;
|
||||
typedef __wasi_event_t wasi_event_t;
|
||||
typedef __wasi_exitcode_t wasi_exitcode_t;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* The defitions of type, macro and structure in this file should be
|
||||
* The definitions of type, macro and structure in this file should be
|
||||
* consistent with those in wasi-libc:
|
||||
* https://github.com/WebAssembly/wasi-libc/blob/main/libc-bottom-half/headers/public/wasi/api.h
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,7 @@ extern char const *LLAMA_COMMIT;
|
|||
extern char const *LLAMA_COMPILER;
|
||||
extern char const *LLAMA_BUILD_TARGET;
|
||||
|
||||
// compatable with WasmEdge
|
||||
// compatible with WasmEdge
|
||||
// https://github.com/second-state/WasmEdge-WASINN-examples/blob/master/wasmedge-ggml/README.md#parameters
|
||||
// https://github.com/WasmEdge/WasmEdge/blob/master/plugins/wasi_nn/ggml.cpp
|
||||
struct wasi_nn_llama_config {
|
||||
|
|
|
@ -56,7 +56,7 @@ initialize_g(TFLiteContext *tfl_ctx, graph *g)
|
|||
os_mutex_lock(&tfl_ctx->g_lock);
|
||||
if (tfl_ctx->current_models == MAX_GRAPHS_PER_INST) {
|
||||
os_mutex_unlock(&tfl_ctx->g_lock);
|
||||
NN_ERR_PRINTF("Excedded max graphs per WASM instance");
|
||||
NN_ERR_PRINTF("Exceeded max graphs per WASM instance");
|
||||
return runtime_error;
|
||||
}
|
||||
*g = tfl_ctx->current_models++;
|
||||
|
@ -70,7 +70,7 @@ initialize_graph_ctx(TFLiteContext *tfl_ctx, graph g,
|
|||
os_mutex_lock(&tfl_ctx->g_lock);
|
||||
if (tfl_ctx->current_interpreters == MAX_GRAPH_EXEC_CONTEXTS_PER_INST) {
|
||||
os_mutex_unlock(&tfl_ctx->g_lock);
|
||||
NN_ERR_PRINTF("Excedded max graph execution context per WASM instance");
|
||||
NN_ERR_PRINTF("Exceeded max graph execution context per WASM instance");
|
||||
return runtime_error;
|
||||
}
|
||||
*ctx = tfl_ctx->current_interpreters++;
|
||||
|
@ -325,7 +325,7 @@ set_input(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
|
|||
int size = model_tensor_size * sizeof(float);
|
||||
bh_memcpy_s(it, size, input_tensor->data, size);
|
||||
}
|
||||
else { // TODO: Assumming uint8 quantized networks.
|
||||
else { // TODO: Assuming uint8 quantized networks.
|
||||
TfLiteAffineQuantization *quant_info =
|
||||
(TfLiteAffineQuantization *)tensor->quantization.params;
|
||||
if (quant_info->scale->size != 1 || quant_info->zero_point->size != 1) {
|
||||
|
@ -406,7 +406,7 @@ get_output(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
|
|||
int size = model_tensor_size * sizeof(float);
|
||||
bh_memcpy_s(output_tensor, size, ot, size);
|
||||
}
|
||||
else { // TODO: Assumming uint8 quantized networks.
|
||||
else { // TODO: Assuming uint8 quantized networks.
|
||||
TfLiteAffineQuantization *quant_info =
|
||||
(TfLiteAffineQuantization *)tensor->quantization.params;
|
||||
if (quant_info->scale->size != 1 || quant_info->zero_point->size != 1) {
|
||||
|
|
|
@ -286,7 +286,7 @@ def execute_wasmedge_ggml_qwen(iwasm_bin: str, wasmedge_bin: str, cwd: Path):
|
|||
|
||||
p.stdin.write(b"hi\n")
|
||||
p.stdin.flush()
|
||||
# ASSITANT
|
||||
# ASSISTANT
|
||||
p.stdout.readline()
|
||||
# xxx
|
||||
p.stdout.readline()
|
||||
|
@ -296,7 +296,7 @@ def execute_wasmedge_ggml_qwen(iwasm_bin: str, wasmedge_bin: str, cwd: Path):
|
|||
p.stdin.write(prompt.encode())
|
||||
p.stdin.write(b"\n")
|
||||
p.stdin.flush()
|
||||
# ASSITANT
|
||||
# ASSISTANT
|
||||
p.stdout.readline()
|
||||
# xxx
|
||||
answer = p.stdout.readline().decode("utf-8")
|
||||
|
|
|
@ -40,7 +40,7 @@ hmu_is_in_heap(void *hmu, gc_uint8 *heap_base_addr, gc_uint8 *heap_end_addr)
|
|||
* the node will be removed from the tree, and the left, right and
|
||||
* parent pointers of the node @p will be set to be NULL. Other fields
|
||||
* won't be touched. The tree will be re-organized so that the order
|
||||
* conditions are still satisified.
|
||||
* conditions are still satisfied.
|
||||
*/
|
||||
static bool
|
||||
remove_tree_node(gc_heap_t *heap, hmu_tree_node_t *p)
|
||||
|
@ -648,7 +648,7 @@ gc_realloc_vo_internal(void *vheap, void *ptr, gc_size_t size, const char *file,
|
|||
hmu_old = obj_to_hmu(obj_old);
|
||||
tot_size_old = hmu_get_size(hmu_old);
|
||||
if (tot_size <= tot_size_old)
|
||||
/* current node alreay meets requirement */
|
||||
/* current node already meets requirement */
|
||||
return obj_old;
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ gc_init_with_struct_and_pool(char *struct_buf, gc_size_t struct_buf_size,
|
|||
char *pool_buf, gc_size_t pool_buf_size);
|
||||
|
||||
/**
|
||||
* Destroy heap which is initilized from a buffer
|
||||
* Destroy heap which is initialized from a buffer
|
||||
*
|
||||
* @param handle handle to heap needed destroy
|
||||
*
|
||||
|
|
|
@ -287,7 +287,7 @@ typedef struct gc_heap_struct {
|
|||
additional memory fails. When the fast mode fails, the
|
||||
marking process can still be done in the slow mode, which
|
||||
doesn't need additional memory (by walking through all
|
||||
blocks and marking sucessors of marked nodes until no new
|
||||
blocks and marking successors of marked nodes until no new
|
||||
node is marked). TODO: slow mode is not implemented. */
|
||||
unsigned is_fast_marking_failed : 1;
|
||||
|
||||
|
@ -319,7 +319,7 @@ typedef struct gc_heap_struct {
|
|||
* the nodes, a new space will be allocated from heap */
|
||||
extra_info_node_t *extra_info_normal_nodes[EXTRA_INFO_NORMAL_NODE_CNT];
|
||||
/* Used to store extra information such as finalizer for specified nodes, we
|
||||
* introduce a seperate space to store these information so only nodes who
|
||||
* introduce a separate space to store these information so only nodes who
|
||||
* really require extra information will occupy additional memory spaces. */
|
||||
extra_info_node_t **extra_info_nodes;
|
||||
gc_size_t extra_info_node_cnt;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
/**
|
||||
* Set default value to prefix and suffix
|
||||
* @param hmu should not be NULL and should have been correctly initilized
|
||||
* @param hmu should not be NULL and should have been correctly initialized
|
||||
* (except prefix and suffix part)
|
||||
* @param tot_size is offered here because hmu_get_size can not be used
|
||||
* till now. tot_size should not be smaller than OBJ_EXTRA_SIZE.
|
||||
|
|
|
@ -232,7 +232,7 @@ gc_migrate(gc_handle_t handle, char *pool_buf_new, gc_size_t pool_buf_size)
|
|||
heap_max_size = (uint32)(pool_buf_end - base_addr_new) & (uint32)~7;
|
||||
|
||||
if (pool_buf_end < base_addr_new || heap_max_size < heap->current_size) {
|
||||
LOG_ERROR("[GC_ERROR]heap migrate invlaid pool buf size\n");
|
||||
LOG_ERROR("[GC_ERROR]heap migrate invalid pool buf size\n");
|
||||
return GC_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -495,7 +495,7 @@ os_thread_jit_write_protect_np(bool enabled)
|
|||
#define SIG_ALT_STACK_SIZE (32 * 1024)
|
||||
|
||||
/**
|
||||
* Whether thread signal enviornment is initialized:
|
||||
* Whether thread signal environment is initialized:
|
||||
* the signal handler is registered, the stack pages are touched,
|
||||
* the stack guard pages are set and signal alternate stack are set.
|
||||
*/
|
||||
|
@ -696,7 +696,7 @@ os_thread_signal_init(os_signal_handler handler)
|
|||
memset(&prev_sig_act_SIGSEGV, 0, sizeof(struct sigaction));
|
||||
memset(&prev_sig_act_SIGBUS, 0, sizeof(struct sigaction));
|
||||
|
||||
/* Install signal hanlder */
|
||||
/* Install signal handler */
|
||||
sig_act.sa_sigaction = signal_callback;
|
||||
sig_act.sa_flags = SA_SIGINFO | SA_NODEFER;
|
||||
#if WASM_DISABLE_STACK_HW_BOUND_CHECK == 0
|
||||
|
|
|
@ -209,7 +209,7 @@ int
|
|||
os_cond_wait(korp_cond *cond, korp_mutex *mutex);
|
||||
|
||||
/**
|
||||
* Wait a condition varible or return if time specified passes.
|
||||
* Wait a condition variable or return if time specified passes.
|
||||
*
|
||||
* @param cond pointer to condition variable
|
||||
* @param mutex pointer to mutex to protect the condition variable
|
||||
|
@ -766,7 +766,7 @@ int
|
|||
os_socket_get_recv_timeout(bh_socket_t socket, uint64 *timeout_us);
|
||||
|
||||
/**
|
||||
* Enable re-use of local addresses
|
||||
* Enable reuse of local addresses
|
||||
*
|
||||
* @param socket the socket to set
|
||||
* @param is_enabled 1 to enable or 0 to disable
|
||||
|
@ -777,7 +777,7 @@ int
|
|||
os_socket_set_reuse_addr(bh_socket_t socket, bool is_enabled);
|
||||
|
||||
/**
|
||||
* Get whether re-use of local addresses is enabled
|
||||
* Get whether reuse of local addresses is enabled
|
||||
*
|
||||
* @param socket the socket to set
|
||||
* @param is_enabled 1 for enabled or 0 for disabled
|
||||
|
@ -788,7 +788,7 @@ int
|
|||
os_socket_get_reuse_addr(bh_socket_t socket, bool *is_enabled);
|
||||
|
||||
/**
|
||||
* Enable re-use of local ports
|
||||
* Enable reuse of local ports
|
||||
*
|
||||
* @param socket the socket to set
|
||||
* @param is_enabled 1 to enable or 0 to disable
|
||||
|
@ -799,7 +799,7 @@ int
|
|||
os_socket_set_reuse_port(bh_socket_t socket, bool is_enabled);
|
||||
|
||||
/**
|
||||
* Get whether re-use of local ports is enabled
|
||||
* Get whether reuse of local ports is enabled
|
||||
*
|
||||
* @param socket the socket to set
|
||||
* @param is_enabled 1 for enabled or 0 for disabled
|
||||
|
@ -1120,7 +1120,7 @@ os_dumps_proc_mem_info(char *out, unsigned int size);
|
|||
|
||||
/**
|
||||
* NOTES:
|
||||
* Fileystem APIs are required for WASI libc support. If you don't need to
|
||||
* Filesystem APIs are required for WASI libc support. If you don't need to
|
||||
* support WASI libc, there is no need to implement these APIs. With a
|
||||
* few exceptions, each filesystem function has been named after the equivalent
|
||||
* POSIX filesystem function with an os_ prefix.
|
||||
|
@ -1134,12 +1134,12 @@ os_dumps_proc_mem_info(char *out, unsigned int size);
|
|||
* os_file_handle: the file handle type used in the WASI libc fd
|
||||
* table. Filesystem implementations can use it as a means to store any
|
||||
* necessary platform-specific information which may not be directly available
|
||||
* through the raw OS file handle. Similiar to POSIX file descriptors, file
|
||||
* through the raw OS file handle. Similar to POSIX file descriptors, file
|
||||
* handles may also refer to sockets, directories, symbolic links or character
|
||||
* devices and any of the filesystem operations which make sense for these
|
||||
* resource types should be supported as far as possible.
|
||||
*
|
||||
* os_dir_stream: a directory stream type in which fileystem implementations
|
||||
* os_dir_stream: a directory stream type in which filesystem implementations
|
||||
* can store any necessary state to iterate over the entries in a directory.
|
||||
*/
|
||||
|
||||
|
@ -1166,7 +1166,7 @@ os_fstatat(os_file_handle handle, const char *path,
|
|||
struct __wasi_filestat_t *buf, __wasi_lookupflags_t lookup_flags);
|
||||
|
||||
/**
|
||||
* Obtain the file status flags for the provided handle. This is similiar to the
|
||||
* Obtain the file status flags for the provided handle. This is similar to the
|
||||
* POSIX function fcntl called with the F_GETFL command.
|
||||
*
|
||||
* @param handle the handle for which to obtain the file status flags
|
||||
|
@ -1176,7 +1176,7 @@ __wasi_errno_t
|
|||
os_file_get_fdflags(os_file_handle handle, __wasi_fdflags_t *flags);
|
||||
|
||||
/**
|
||||
* Set the file status flags for the provided handle. This is similiar to the
|
||||
* Set the file status flags for the provided handle. This is similar to the
|
||||
* POSIX function fcntl called with the F_SETFL command.
|
||||
*
|
||||
* @param handle the handle for which to set the file status flags
|
||||
|
@ -1235,7 +1235,7 @@ os_openat(os_file_handle handle, const char *path, __wasi_oflags_t oflags,
|
|||
wasi_libc_file_access_mode access_mode, os_file_handle *out);
|
||||
|
||||
/**
|
||||
* Obtain the file access mode for the provided handle. This is similiar to the
|
||||
* Obtain the file access mode for the provided handle. This is similar to the
|
||||
* POSIX function fcntl called with the F_GETFL command combined with the
|
||||
* O_ACCMODE mask.
|
||||
*
|
||||
|
@ -1480,9 +1480,9 @@ os_file_handle
|
|||
os_convert_stdin_handle(os_raw_file_handle raw_stdin);
|
||||
|
||||
/**
|
||||
* Converts a raw file handle to STDOUT to a correponding file handle to STDOUT.
|
||||
* If the provided raw file handle is invalid, the platform-default raw handle
|
||||
* for STDOUT will be used.
|
||||
* Converts a raw file handle to STDOUT to a corresponding file handle to
|
||||
* STDOUT. If the provided raw file handle is invalid, the platform-default raw
|
||||
* handle for STDOUT will be used.
|
||||
*
|
||||
* @param raw_stdout a raw file handle to STDOUT
|
||||
*
|
||||
|
@ -1492,9 +1492,9 @@ os_file_handle
|
|||
os_convert_stdout_handle(os_raw_file_handle raw_stdout);
|
||||
|
||||
/**
|
||||
* Converts a raw file handle to STDERR to a correponding file handle to STDERR.
|
||||
* If the provided raw file handle is invalid, the platform-default raw handle
|
||||
* for STDERR will be used.
|
||||
* Converts a raw file handle to STDERR to a corresponding file handle to
|
||||
* STDERR. If the provided raw file handle is invalid, the platform-default raw
|
||||
* handle for STDERR will be used.
|
||||
*
|
||||
* @param raw_stderr a raw file handle to STDERR
|
||||
*
|
||||
|
|
|
@ -53,7 +53,7 @@ convert_sgx_errno(int error)
|
|||
* continue (only used when no EXXX is returned) */
|
||||
case SGX_ERROR_FILE_CANT_WRITE_RECOVERY_FILE:
|
||||
return EIO;
|
||||
/* When openeing the file, recovery is needed, but the recovery
|
||||
/* When opening the file, recovery is needed, but the recovery
|
||||
* process failed */
|
||||
case SGX_ERROR_FILE_RECOVERY_NEEDED:
|
||||
return EIO;
|
||||
|
|
|
@ -51,7 +51,7 @@ extern "C" {
|
|||
#define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */
|
||||
#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */
|
||||
#define TCP_INFO 11 /* Information about this connection. */
|
||||
#define TCP_QUICKACK 12 /* Bock/reenable quick ACKs. */
|
||||
#define TCP_QUICKACK 12 /* Bock/re-enable quick ACKs. */
|
||||
#define TCP_CONGESTION 13 /* Congestion control algorithm. */
|
||||
#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */
|
||||
#define TCP_COOKIE_TRANSACTIONS 15 /* TCP Cookie Transactions */
|
||||
|
|
|
@ -282,7 +282,7 @@ os_thread_join(korp_tid thread, void **value_ptr)
|
|||
mutex_unlock(&thread_data->wait_list_lock);
|
||||
|
||||
sema_wait(&node.sem);
|
||||
// get the return value pointer conted may not be availible after return
|
||||
// get the return value pointer conted may not be available after return
|
||||
if (value_ptr)
|
||||
(*value_ptr) = node.ret;
|
||||
/* Wait some time for the thread to be actually terminated */
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#if BH_DEBUG != 0
|
||||
/**
|
||||
* Test whehter a pointer value has exist in given list.
|
||||
* Test whether a pointer value has exist in given list.
|
||||
*
|
||||
* @param list pointer to list.
|
||||
* @param elem pointer to elem that will be inserted into list.
|
||||
|
|
|
@ -90,7 +90,7 @@ There are some useful options that are used to compile C/C++ to Wasm (for a full
|
|||
|
||||
- **-Wl,--max-memory=\<value\>** Maximum size of the linear memory, which must be a multiple of 65536
|
||||
|
||||
- **-z stack-size=\<vlaue\>** The auxiliary stack size, which is an area of linear memory, must be smaller than the initial memory size.
|
||||
- **-z stack-size=\<value\>** The auxiliary stack size, which is an area of linear memory, must be smaller than the initial memory size.
|
||||
|
||||
- **-Wl,--strip-all** Strip all symbols
|
||||
|
||||
|
@ -343,7 +343,7 @@ Usage: wamrc [options] -o output_file wasm_file
|
|||
Use --cpu-features=+help to list all the features supported
|
||||
--opt-level=n Set the optimization level (0 to 3, default is 3)
|
||||
--size-level=n Set the code size level (0 to 3, default is 3)
|
||||
-sgx Generate code for SGX platform (Intel Software Guard Extention)
|
||||
-sgx Generate code for SGX platform (Intel Software Guard Extension)
|
||||
--bounds-checks=1/0 Enable or disable the bounds checks for memory access:
|
||||
by default it is disabled in all 64-bit platforms except SGX and
|
||||
in these platforms runtime does bounds checks with hardware trap,
|
||||
|
|
|
@ -62,7 +62,7 @@ You will get ```test.wasm``` which is the WASM app binary.
|
|||
|
||||
## Using Docker
|
||||
|
||||
Another method availble is using [Docker](https://www.docker.com/). We assume you've already configured Docker (see Platform section above) and have a running interactive shell. Currently the Dockerfile only supports compiling apps with clang, with Emscripten planned for the future.
|
||||
Another method available is using [Docker](https://www.docker.com/). We assume you've already configured Docker (see Platform section above) and have a running interactive shell. Currently the Dockerfile only supports compiling apps with clang, with Emscripten planned for the future.
|
||||
|
||||
Use the clang-8 command below to build the WASM C source code into the WASM binary.
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ wamrc -o test.aot test.wasm
|
|||
function of the AOT-compiled wasm module.
|
||||
|
||||
* WAMR AOT debugging uses the GDB JIT loader mechanism to load
|
||||
the debug info of the debugee module.
|
||||
the debug info of the debuggee module.
|
||||
On some platforms including macOS, you need to enable it explicitly.
|
||||
(`settings set plugin.jit-loader.gdb.enable on`)
|
||||
|
||||
|
|
|
@ -87,8 +87,8 @@ make
|
|||
```
|
||||
|
||||
Note:
|
||||
By default, the LLVM Orc JIT with Lazy compilation is enabled to speedup the lanuching process and reduce
|
||||
the JIT compilation time by creating backend threads to compile the WASM functions parallely, and for the
|
||||
By default, the LLVM Orc JIT with Lazy compilation is enabled to speedup the launching process and reduce
|
||||
the JIT compilation time by creating backend threads to compile the WASM functions parallelly, and for the
|
||||
main thread, the functions in the module will not be compiled until they are firstly called and haven't been
|
||||
compiled by the compilation threads.
|
||||
|
||||
|
@ -114,7 +114,7 @@ mkdir build && cd build
|
|||
cmake .. -DWAMR_BUILD_FAST_JTI=1 -DWAMR_BUILD_JIT=1
|
||||
make
|
||||
```
|
||||
The Multi-tier JIT is a two level JIT tier-up engine, which launchs Fast JIT to run the wasm module as soon as possible and creates backend threads to compile the LLVM JIT functions at the same time, and when the LLVM JIT functions are compiled, the runtime will switch the extecution from the Fast JIT jitted code to LLVM JIT jitted code gradually, so as to gain the best performance.
|
||||
The Multi-tier JIT is a two level JIT tier-up engine, which launches Fast JIT to run the wasm module as soon as possible and creates backend threads to compile the LLVM JIT functions at the same time, and when the LLVM JIT functions are compiled, the runtime will switch the extecution from the Fast JIT jitted code to LLVM JIT jitted code gradually, so as to gain the best performance.
|
||||
|
||||
## Linux SGX (Intel Software Guard Extension)
|
||||
|
||||
|
@ -335,7 +335,7 @@ $ cd build
|
|||
$ cmake ..
|
||||
$ make
|
||||
$ # check output in distribution/wasm
|
||||
$ # include/ includes all necesary head files
|
||||
$ # include/ includes all necessary head files
|
||||
$ # lib includes libiwasm.so
|
||||
```
|
||||
|
||||
|
@ -350,7 +350,7 @@ $ cmake .. -DWAMR_BUILD_TARGET=AARCH64 -DANDROID_ABI=arm64-v8a # 64-bit ARM C
|
|||
|
||||
## NuttX
|
||||
|
||||
WAMR is intergrated with NuttX, just enable the WAMR in Kconfig option (Application Configuration/Interpreters).
|
||||
WAMR is integrated with NuttX, just enable the WAMR in Kconfig option (Application Configuration/Interpreters).
|
||||
|
||||
## ESP-IDF
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ libc_wasi_print_help(void)
|
|||
"--map-dir=<guest-path2::host-path2>\n");
|
||||
printf(" --addr-pool=<addrs> Grant wasi access to the given network "
|
||||
"addresses in\n");
|
||||
printf(" CIDR notation to the program, seperated "
|
||||
printf(" CIDR notation to the program, separated "
|
||||
"with ',',\n");
|
||||
printf(" for example:\n");
|
||||
printf(" --addr-pool=1.2.3.4/15,2.3.4.5/16\n");
|
||||
|
|
|
@ -153,7 +153,7 @@ enclave_init(sgx_enclave_id_t *p_eid)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* reopen the file with write capablity */
|
||||
/* reopen the file with write capability */
|
||||
fp = freopen(token_path, "wb", fp);
|
||||
if (fp == NULL)
|
||||
return 0;
|
||||
|
@ -228,7 +228,7 @@ print_help()
|
|||
printf(" to the program, for example:\n");
|
||||
printf(" --dir=<dir1> --dir=<dir2>\n");
|
||||
printf(" --addr-pool= Grant wasi access to the given network addresses in\n");
|
||||
printf(" CIDR notation to the program, seperated with ',',\n");
|
||||
printf(" CIDR notation to the program, separated with ',',\n");
|
||||
printf(" for example:\n");
|
||||
printf(" --addr-pool=1.2.3.4/15,2.3.4.5/16\n");
|
||||
printf(" --max-threads=n Set maximum thread number per cluster, default is 4\n");
|
||||
|
|
|
@ -67,7 +67,7 @@ struct wamr_pal_create_process_args {
|
|||
// Mandatory field. Must not be NULL.
|
||||
const char *path;
|
||||
|
||||
// Argments array pass to new process.
|
||||
// Arguments array pass to new process.
|
||||
//
|
||||
// The arguments to the command. By convention, the argv[0] should be the
|
||||
// program name. And the last element of the array must be NULL to indicate
|
||||
|
|
|
@ -200,7 +200,7 @@ set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..)
|
|||
# enable WAMR build system
|
||||
include(${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
|
||||
|
||||
# NuttX wamr lib complie required: `WAMR_SOURCES` `WAMR_CFLAGS` `WAMR_INCDIRS`
|
||||
# NuttX wamr lib compile required: `WAMR_SOURCES` `WAMR_CFLAGS` `WAMR_INCDIRS`
|
||||
# `WAMR_DEFINITIONS`
|
||||
set(WAMR_SOURCES ${WAMR_RUNTIME_LIB_SOURCE})
|
||||
set(WAMR_CFLAGS -Wno-shadow -Wno-unused-variable
|
||||
|
|
|
@ -22,7 +22,7 @@ QUIET ?= 1
|
|||
|
||||
ARCHIVES += $(BINDIR)/libwamr.a
|
||||
|
||||
#Load the usual RIOT make infastructure
|
||||
#Load the usual RIOT make infrastructure
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
|
|
|
@ -395,7 +395,7 @@ iwasm(int argc, char **argv)
|
|||
else {
|
||||
exception = app_instance_main(wasm_module_inst, argc - i_arg_begin,
|
||||
&argv[i_arg_begin]);
|
||||
rt_kprintf("finshed run app_instance_main\n");
|
||||
rt_kprintf("finished run app_instance_main\n");
|
||||
}
|
||||
|
||||
if (exception)
|
||||
|
@ -448,4 +448,4 @@ fail1:
|
|||
wasm_runtime_destroy();
|
||||
return 0;
|
||||
}
|
||||
MSH_CMD_EXPORT(iwasm, Embeded VM of WebAssembly);
|
||||
MSH_CMD_EXPORT(iwasm, Embedded VM of WebAssembly);
|
||||
|
|
|
@ -47,9 +47,9 @@ to setup for local development.
|
|||
## Building for a Specific Board
|
||||
|
||||
With an environment setup either locally or in a Docker container, you can build
|
||||
for a Zephyr suppported board using
|
||||
for a Zephyr supported board using
|
||||
[`west`](https://docs.zephyrproject.org/latest/develop/west/index.html). There
|
||||
are already [configuaration files](./boards) for a few boards in this sample.
|
||||
are already [configuration files](./boards) for a few boards in this sample.
|
||||
However, if you are using a new board, you will need to add your own file for
|
||||
the board, or define configuration in the [`prj.conf](./prj.conf). After doing
|
||||
so, use the following command with your board identifier to build the sample
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "wasm_export.h"
|
||||
#include "math.h"
|
||||
|
||||
// The first parameter is not exec_env because it is invoked by native funtions
|
||||
// The first parameter is not exec_env because it is invoked by native functions
|
||||
void
|
||||
reverse(char *str, int len)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ $ ./FlameGraph/stackcollapse-perf.pl out.perf > out.folded
|
|||
$ ./FlameGraph/flamegraph.pl out.folded > perf.svg
|
||||
```
|
||||
|
||||
In this result, you'll see two modules's profiling result and all wasm functions are named as "aot_func#N" which is a little hard to distinguish.
|
||||
In this result, you'll see two modules' profiling result and all wasm functions are named as "aot_func#N" which is a little hard to distinguish.
|
||||
|
||||

|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ $ make
|
|||
$ # It will build multi_module runtime and
|
||||
$ # wasm file under the ./build .
|
||||
$ # If you have built wamrc,
|
||||
$ # aot file will also genrate.
|
||||
$ # aot file will also generate.
|
||||
$ ./multi_module mC.wasm
|
||||
$ ...
|
||||
$ ./multi_module mC.aot
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
This sample demonstrates how to write required interfaces in native library, build it into a shared library and register the shared library to iwasm.
|
||||
|
||||
The native library should provide `get_native_lib` API for iwasm to return the native library info, including the module name, the native symbol list and the native symbol count, so that iwasm can use them to regiter the native library, for example:
|
||||
The native library should provide `get_native_lib` API for iwasm to return the native library info, including the module name, the native symbol list and the native symbol count, so that iwasm can use them to register the native library, for example:
|
||||
|
||||
```C
|
||||
static int
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Examples of evidence verification without Intel SGX
|
||||
Intel SGX evidence generated using WAMR can be validated on trusted plaforms without Intel SGX, or an Intel processors.
|
||||
Intel SGX evidence generated using WAMR can be validated on trusted platforms without Intel SGX, or an Intel processors.
|
||||
|
||||
## Using C#
|
||||
The sample [csharp/](csharp/) demonstrates such validation using C# as a managed language.
|
||||
|
|
|
@ -54,7 +54,7 @@ The output of client is like:
|
|||
[Client] Connect socket
|
||||
[Client] Client receive
|
||||
[Client] 115 bytes received:
|
||||
Buffer recieved:
|
||||
Buffer received:
|
||||
Say Hi from the Server
|
||||
Say Hi from the Server
|
||||
Say Hi from the Server
|
||||
|
@ -117,7 +117,7 @@ The output is:
|
|||
```bash
|
||||
Wait for client to connect
|
||||
Client connected, sleeping for 10s
|
||||
Shuting down
|
||||
Shutting down
|
||||
```
|
||||
|
||||
```bash
|
||||
|
@ -195,7 +195,7 @@ The output of client is like:
|
|||
[Client] Create socket
|
||||
[Client] Client send
|
||||
[Client] Client receive
|
||||
[Client] Buffer recieved: Hello from server
|
||||
[Client] Buffer received: Hello from server
|
||||
[Client] BYE
|
||||
```
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ main(int argc, char *argv[])
|
|||
|
||||
printf("[Client] %d bytes received:\n", total_size);
|
||||
if (total_size > 0) {
|
||||
printf("Buffer recieved:\n%s\n", buffer);
|
||||
printf("Buffer received:\n%s\n", buffer);
|
||||
}
|
||||
|
||||
close(socket_fd);
|
||||
|
|
|
@ -37,7 +37,7 @@ run(void *arg)
|
|||
}
|
||||
}
|
||||
|
||||
printf("[Server] Shuting down the new connection #%u ..\n", new_socket);
|
||||
printf("[Server] Shutting down the new connection #%u ..\n", new_socket);
|
||||
shutdown(new_socket, SHUT_RDWR);
|
||||
|
||||
return NULL;
|
||||
|
@ -137,14 +137,14 @@ main(int argc, char *argv[])
|
|||
pthread_join(workers[i], NULL);
|
||||
}
|
||||
|
||||
printf("[Server] Shuting down ..\n");
|
||||
printf("[Server] Shutting down ..\n");
|
||||
shutdown(socket_fd, SHUT_RDWR);
|
||||
sleep(3);
|
||||
printf("[Server] BYE \n");
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
fail:
|
||||
printf("[Server] Shuting down ..\n");
|
||||
printf("[Server] Shutting down ..\n");
|
||||
if (socket_fd >= 0)
|
||||
close(socket_fd);
|
||||
sleep(3);
|
||||
|
|
|
@ -56,7 +56,7 @@ main(int argc, char *argv[])
|
|||
printf("Client connected, sleeping for 10s\n");
|
||||
sleep(10);
|
||||
|
||||
printf("Shuting down\n");
|
||||
printf("Shutting down\n");
|
||||
shutdown(client_socket_fd, SHUT_RDWR);
|
||||
close(client_socket_fd);
|
||||
shutdown(socket_fd, SHUT_RDWR);
|
||||
|
|
|
@ -75,7 +75,7 @@ main(int argc, char *argv[])
|
|||
|
||||
if (ret > 0) {
|
||||
buffer[ret] = '\0';
|
||||
printf("[Client] Buffer recieved: %s\n", buffer);
|
||||
printf("[Client] Buffer received: %s\n", buffer);
|
||||
}
|
||||
|
||||
close(socket_fd);
|
||||
|
|
|
@ -106,7 +106,7 @@ main(int argc, char *argv[])
|
|||
printf("[Server] Achieve maximum amount of connections\n");
|
||||
}
|
||||
|
||||
printf("[Server] Shuting down ..\n");
|
||||
printf("[Server] Shutting down ..\n");
|
||||
shutdown(socket_fd, SHUT_RDWR);
|
||||
close(socket_fd);
|
||||
sleep(3);
|
||||
|
@ -114,7 +114,7 @@ main(int argc, char *argv[])
|
|||
return EXIT_SUCCESS;
|
||||
|
||||
fail:
|
||||
printf("[Server] Shuting down ..\n");
|
||||
printf("[Server] Shutting down ..\n");
|
||||
if (socket_fd >= 0)
|
||||
close(socket_fd);
|
||||
sleep(3);
|
||||
|
|
|
@ -93,14 +93,14 @@ also not economical to code for those functions.
|
|||
Using module names as a filter seems to be a simple way. But some private
|
||||
additional c/c++ libraries are supported in WAMR. Those supporting will bring
|
||||
more import items that don't use `wasi_snapshot_preview1` as module names but are still
|
||||
covered by the WASM runtime. Like `env.pthread_`. Plus, [the native lib registeration](https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/export_native_api.md)
|
||||
covered by the WASM runtime. Like `env.pthread_`. Plus, [the native lib registration](https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/export_native_api.md)
|
||||
provides another possible way to fill in the requirement of _the import section_.
|
||||
|
||||
Let's take summarize. A proper `wasm_extern_vec_t *imports` should include:
|
||||
|
||||
1. provides all necessary host implementations for items in _the import section_
|
||||
2. should not override runtime provided implementation or covered by native
|
||||
registrations. functinal or econmical.
|
||||
registrations. functional or econmical.
|
||||
3. keep them in a right order
|
||||
|
||||
## A recommendation
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
WAMR supports *wasm-c-api* in both *interpreter* mode and *aot* mode.
|
||||
|
||||
Before staring, we need to download and intall [WABT](https://github.com/WebAssembly/wabt/releases/latest).
|
||||
Before staring, we need to download and install [WABT](https://github.com/WebAssembly/wabt/releases/latest).
|
||||
|
||||
``` shell
|
||||
$ cd /opt
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
All workloads have similar requirment of software dependencies, including **emsdk** and **binaryen**
|
||||
All workloads have similar requirement of software dependencies, including **emsdk** and **binaryen**
|
||||
|
||||
> There might be slight differences when using MacOS and other Linux distro than Ubuntu. This document targets
|
||||
Ubuntu 20.04 as an example.
|
||||
|
|
|
@ -48,22 +48,22 @@ AoTFile::ParseTargetInfo()
|
|||
CHECK_RESULT(ReadT(&abi_type, this, "uint16_t"));
|
||||
target_info_.abi_type = abi_type;
|
||||
|
||||
// exectuion type
|
||||
// execution type
|
||||
uint16_t e_type = 0;
|
||||
CHECK_RESULT(ReadT(&e_type, this, "uint16_t"));
|
||||
target_info_.e_type = e_type;
|
||||
|
||||
// exectuion machine
|
||||
// execution machine
|
||||
uint16_t e_machine = 0;
|
||||
CHECK_RESULT(ReadT(&e_machine, this, "uint16_t"));
|
||||
target_info_.e_machine = e_machine;
|
||||
|
||||
// exectuion version
|
||||
// execution version
|
||||
uint32_t e_version = 0;
|
||||
CHECK_RESULT(ReadT(&e_version, this, "uint32_t"));
|
||||
target_info_.e_version = e_version;
|
||||
|
||||
// exectuion flags
|
||||
// execution flags
|
||||
uint32_t e_flags = 0;
|
||||
CHECK_RESULT(ReadT(&e_flags, this, "uint32_t"));
|
||||
target_info_.e_flags = e_flags;
|
||||
|
@ -165,7 +165,7 @@ AoTFile::GetExectuionTypeName(uint16_t e_type)
|
|||
break;
|
||||
}
|
||||
default:
|
||||
name = "bad exectuion type";
|
||||
name = "bad execution type";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ AoTFile::GetExectuionMachineName(uint16_t e_machine)
|
|||
break;
|
||||
}
|
||||
default:
|
||||
machine = "bad exectuion machine type";
|
||||
machine = "bad execution machine type";
|
||||
}
|
||||
return machine;
|
||||
}
|
||||
|
|
|
@ -163,12 +163,12 @@ DumpInfo(AoTFile *aot)
|
|||
printf("Binary type: %s\n",
|
||||
aot->GetBinTypeName(target_info.bin_type).c_str());
|
||||
printf("ABI type: %d\n", target_info.abi_type);
|
||||
printf("Exectuion type: %s\n",
|
||||
printf("Execution type: %s\n",
|
||||
aot->GetExectuionTypeName(target_info.e_type).c_str());
|
||||
printf("Exectuion machine: %s\n",
|
||||
printf("Execution machine: %s\n",
|
||||
aot->GetExectuionMachineName(target_info.e_machine).c_str());
|
||||
printf("Exectuion version: %u\n", target_info.e_version);
|
||||
printf("Exectuion flags: %u\n", target_info.e_flags);
|
||||
printf("Execution version: %u\n", target_info.e_version);
|
||||
printf("Execution flags: %u\n", target_info.e_flags);
|
||||
printf("Feature flags: %" PRId64 "\n", target_info.feature_flags);
|
||||
printf("Reserved: %" PRId64 "\n", target_info.reserved);
|
||||
printf("Arch: %s\n", target_info.arch);
|
||||
|
@ -546,7 +546,7 @@ ProgramMain(int argc, char **argv)
|
|||
reader = new WasmFile(filename);
|
||||
}
|
||||
else {
|
||||
printf("unkown file extension: %s\n", dot);
|
||||
printf("unknown file extension: %s\n", dot);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ def create_custom_section_aligned(
|
|||
full_content_bin = b""
|
||||
pos = start_pos
|
||||
|
||||
# custome section id 0
|
||||
# custom section id 0
|
||||
pos, full_content_bin = build_content(full_content_bin, pos, b"\x00")
|
||||
|
||||
# custom section length
|
||||
|
|
|
@ -70,7 +70,7 @@ gdbserver hostip:port ./iwasm test.aot
|
|||
#### Local remote debugging
|
||||
|
||||
```bash
|
||||
expport OBJ_PATH=~/aot_debug
|
||||
export OBJ_PATH=~/aot_debug
|
||||
cd ~/aot_debug # This directory contains iwasm, test.c, test obj file and dynamic_aot_debug.py
|
||||
gdb ./iwasm
|
||||
(gdb) target remote hostip:port
|
||||
|
|
|
@ -40,7 +40,7 @@ external_repos = {
|
|||
}
|
||||
}
|
||||
|
||||
# TOOD: can we use headers from wasi-libc and clang directly ?
|
||||
# TODO: can we use headers from wasi-libc and clang directly ?
|
||||
emscripten_headers_src_dst = [
|
||||
("include/compat/emmintrin.h", "sse/emmintrin.h"),
|
||||
("include/compat/immintrin.h", "sse/immintrin.h"),
|
||||
|
@ -159,7 +159,7 @@ def download_repo(name, root):
|
|||
download_flag.touch()
|
||||
|
||||
# leave download files in /tmp
|
||||
logger.info(f"Has downloaed and stored in {store_dir.relative_to(root)}")
|
||||
logger.info(f"Has downloaded and stored in {store_dir.relative_to(root)}")
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# setup docker command exectuion without sudo permission
|
||||
# setup docker command execution without sudo permission
|
||||
sudo groupadd docker
|
||||
sudo gpasswd -a ${USER} docker
|
||||
sudo service docker restart
|
||||
|
|
|
@ -170,9 +170,9 @@ def obj_summary(valobj, unavailable='{...}'):
|
|||
return unavailable
|
||||
|
||||
|
||||
def sequence_summary(childern, maxsize=32):
|
||||
def sequence_summary(children, maxsize=32):
|
||||
s = ''
|
||||
for child in childern:
|
||||
for child in children:
|
||||
if len(s) > 0:
|
||||
s += ', '
|
||||
s += obj_summary(child)
|
||||
|
|
|
@ -12,7 +12,7 @@ IF %ERRORLEVEL% GTR 0 (
|
|||
|
||||
call docker images>nul 2>nul
|
||||
IF %ERRORLEVEL% GTR 0 (
|
||||
echo "Docker is not ready, please lanuch docker desktop firstly."
|
||||
echo "Docker is not ready, please launch docker desktop firstly."
|
||||
echo
|
||||
exit /b 2
|
||||
)
|
||||
|
|
|
@ -103,7 +103,7 @@ class AOTTest : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp()
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ class aot_compiler_test_suit : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp() {}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class aot_emit_aot_file_test_suite : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp() {}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class aot_emit_control_test_suite : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp() {}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class aot_emit_function_test_suite : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp() {}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class aot_emit_numberic_test_suite : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp() {}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class aot_emit_parametric_test_suite : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp() {}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class aot_emit_table_test_suite : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp() {}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class aot_llvm_test_suite : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp() {}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class CustomSectionTest : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp() {}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class InterpreterTest : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp()
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ class LibcBuiltinTest : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp()
|
||||
{
|
||||
|
@ -88,8 +88,8 @@ TEST_F(LibcBuiltinTest, puts)
|
|||
|
||||
/* Capture the stdout */
|
||||
testing::internal::CaptureStdout();
|
||||
EXPECT_EQ(CALL_FUNC(puts, "Hello Wrold"), strlen("Hello Wrold\n"));
|
||||
EXPECT_EQ(testing::internal::GetCapturedStdout(), "Hello Wrold\n");
|
||||
EXPECT_EQ(CALL_FUNC(puts, "Hello World"), strlen("Hello World\n"));
|
||||
EXPECT_EQ(testing::internal::GetCapturedStdout(), "Hello World\n");
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
EXPECT_EQ(CALL_FUNC(puts, "c"), strlen("c\n"));
|
||||
|
@ -113,9 +113,9 @@ TEST_F(LibcBuiltinTest, printf)
|
|||
|
||||
/* Capture the stdout */
|
||||
testing::internal::CaptureStdout();
|
||||
EXPECT_EQ(CALL_FUNC(printf, "Hello Wrold", empty_va_list.get()),
|
||||
strlen("Hello Wrold"));
|
||||
EXPECT_EQ(testing::internal::GetCapturedStdout(), "Hello Wrold");
|
||||
EXPECT_EQ(CALL_FUNC(printf, "Hello World", empty_va_list.get()),
|
||||
strlen("Hello World"));
|
||||
EXPECT_EQ(testing::internal::GetCapturedStdout(), "Hello World");
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
EXPECT_EQ(CALL_FUNC(printf, "c", empty_va_list.get()), strlen("c"));
|
||||
|
@ -290,7 +290,7 @@ TEST_F(LibcBuiltinTest, printf)
|
|||
va_list.add(0x7FFFFFFF); //%ld 2147483647 - sing long
|
||||
va_list.add(0xFFFFFFFF); //%lu 4294967295 -unsigned long
|
||||
va_list.add(0x7FFFFFFFFFFFFFFF); //%lld 9223372036854775807 sing long long
|
||||
va_list.add(0xFFFFFFFFFFFFFFFF);//%llu 18446744073709551615 unsiged long long
|
||||
va_list.add(0xFFFFFFFFFFFFFFFF);//%llu 18446744073709551615 unsigned long long
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
|
||||
|
@ -300,17 +300,17 @@ TEST_F(LibcBuiltinTest, printf)
|
|||
/* clang-format on */
|
||||
}
|
||||
|
||||
EXPECT_EQ(CALL_FUNC(printf, "Hello Wrold", 0), 0);
|
||||
EXPECT_EQ(CALL_FUNC(printf, "Hello World", 0), 0);
|
||||
EXPECT_STREQ(dummy_exec_env.get_exception(),
|
||||
"Exception: out of bounds memory access");
|
||||
dummy_exec_env.clear_exception();
|
||||
|
||||
EXPECT_EQ(CALL_FUNC(printf, "Hello Wrold", NULL), 0);
|
||||
EXPECT_EQ(CALL_FUNC(printf, "Hello World", NULL), 0);
|
||||
EXPECT_STREQ(dummy_exec_env.get_exception(),
|
||||
"Exception: out of bounds memory access");
|
||||
dummy_exec_env.clear_exception();
|
||||
|
||||
EXPECT_EQ(CALL_FUNC(printf, "Hello Wrold", (char *)-1), 0);
|
||||
EXPECT_EQ(CALL_FUNC(printf, "Hello World", (char *)-1), 0);
|
||||
EXPECT_STREQ(dummy_exec_env.get_exception(),
|
||||
"Exception: out of bounds memory access");
|
||||
dummy_exec_env.clear_exception();
|
||||
|
@ -324,7 +324,7 @@ TEST_F(LibcBuiltinTest, printf)
|
|||
TEST_F(LibcBuiltinTest, sprintf)
|
||||
{
|
||||
char buf[200] = {0};
|
||||
const char *str = "Hello Wrold";
|
||||
const char *str = "Hello World";
|
||||
const char *str_sig = "c";
|
||||
const char *str_f = "20, 3.140000, Hello World";
|
||||
const char *str_long = "eqwewerwerqwer34were"; // test ok
|
||||
|
@ -399,19 +399,19 @@ TEST_F(LibcBuiltinTest, snprintf)
|
|||
|
||||
WAMRVaList empty_va_list(dummy_exec_env.get());
|
||||
|
||||
EXPECT_EQ(CALL_FUNC(snprintf, buf, strlen("Hello Wrold"), "Hello Wrold", 0),
|
||||
EXPECT_EQ(CALL_FUNC(snprintf, buf, strlen("Hello World"), "Hello World", 0),
|
||||
0);
|
||||
EXPECT_EQ(
|
||||
CALL_FUNC(snprintf, buf, strlen("Hello Wrold"), "Hello Wrold", NULL),
|
||||
CALL_FUNC(snprintf, buf, strlen("Hello World"), "Hello World", NULL),
|
||||
0);
|
||||
EXPECT_EQ(CALL_FUNC(snprintf, buf, strlen("Hello Wrold"), "Hello Wrold",
|
||||
EXPECT_EQ(CALL_FUNC(snprintf, buf, strlen("Hello World"), "Hello World",
|
||||
(char *)-1),
|
||||
0);
|
||||
|
||||
EXPECT_EQ(CALL_FUNC(snprintf, buf, strlen("Hello Wrold"), "Hello Wrold",
|
||||
EXPECT_EQ(CALL_FUNC(snprintf, buf, strlen("Hello World"), "Hello World",
|
||||
empty_va_list.get()),
|
||||
strlen("Hello Wrold"));
|
||||
EXPECT_EQ(CALL_FUNC(memcmp, buf, "Hello Wrold", strlen("Hello Wrold")), 0);
|
||||
strlen("Hello World"));
|
||||
EXPECT_EQ(CALL_FUNC(memcmp, buf, "Hello World", strlen("Hello World")), 0);
|
||||
|
||||
EXPECT_EQ(CALL_FUNC(snprintf, buf, strlen(very_long_string),
|
||||
very_long_string, empty_va_list.get()),
|
||||
|
|
|
@ -41,7 +41,7 @@ class TEST_SUITE_NAME : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp() {}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ class TEST_SUITE_NAME : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp() {}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ class memory64_test_suite : public testing::TestWithParam<RunningMode>
|
|||
// TEST_P.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp()
|
||||
{
|
||||
|
|
|
@ -193,7 +193,7 @@ class wasm_running_modes_test_suite : public testing::TestWithParam<RunningMode>
|
|||
// TEST_P.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp()
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ class wasm_exec_env_test_suite : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp() {}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ class wasm_runtime_common_test_suite : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp() {}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class wasm_runtime_init_test_suite : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp() {}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class bh_assert_test_suite : public testing::Test
|
|||
// accessed from sub-classes.
|
||||
|
||||
// virtual void SetUp() will be called before each test is run. You
|
||||
// should define it if you need to initialize the varaibles.
|
||||
// should define it if you need to initialize the variables.
|
||||
// Otherwise, this can be skipped.
|
||||
virtual void SetUp() {}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user