Fix some more spelling issues (#3393)

This commit is contained in:
Benbuck Nason 2024-05-07 18:30:29 -07:00 committed by GitHub
parent ca61184ced
commit 1c2a8fca4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
37 changed files with 134 additions and 134 deletions

View File

@ -11,7 +11,7 @@ on:
required: false
default: x86_64
cwd:
description: workfing directory
description: working directory
type: string
required: true
llvm_cache_key:

View File

@ -150,8 +150,8 @@ jobs:
os: [ubuntu-22.04]
platform: [android, linux]
exclude:
# uncompatiable feature and platform
# uncompatiable mode and feature
# incompatible feature and platform
# incompatible mode and feature
# MULTI_MODULE only on INTERP mode and AOT mode
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
@ -542,7 +542,7 @@ jobs:
running_mode: aot
test_option: $WAMR_COMPILER_TEST_OPTIONS
exclude:
# uncompatiable modes and features
# incompatible modes and features
# classic-interp and fast-interp don't support simd
- running_mode: "classic-interp"
test_option: $SIMD_TEST_OPTIONS

View File

@ -134,8 +134,8 @@ jobs:
os: [macos-13]
platform: [darwin]
exclude:
# uncompatiable feature and platform
# uncompatiable mode and feature
# incompatible feature and platform
# incompatible mode and feature
# MULTI_MODULE only on INTERP mode and AOT mode
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"

View File

@ -99,7 +99,7 @@ jobs:
os: [ubuntu-20.04]
platform: [linux-sgx]
exclude:
# uncompatiable mode and feature
# incompatible mode and feature
# MINI_LOADER only on INTERP mode
- make_options_run_mode: $AOT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"

View File

@ -135,8 +135,8 @@ jobs:
os: [ubuntu-20.04]
platform: [android, linux]
exclude:
# uncompatiable feature and platform
# uncompatiable mode and feature
# incompatible feature and platform
# incompatible mode and feature
# MULTI_MODULE only on INTERP mode and AOT mode
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
@ -290,8 +290,8 @@ jobs:
"-DWAMR_BUILD_MEMORY64=1",
]
exclude:
# uncompatiable feature and platform
# uncompatiable mode and feature
# incompatible feature and platform
# incompatible mode and feature
# MULTI_MODULE only on INTERP mode and AOT mode
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
@ -619,7 +619,7 @@ jobs:
ubuntu_version: "22.04"
exclude:
# uncompatiable modes and features
# incompatible modes and features
- os: ubuntu-20.04
sanitizer: tsan
# asan works only for aot now

View File

@ -685,7 +685,7 @@ add_f64xi64_intrinsics(AOTCompContext *comp_ctx)
}
static void
add_common_float_integer_convertion(AOTCompContext *comp_ctx)
add_common_float_integer_conversion(AOTCompContext *comp_ctx)
{
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I32_TO_F32);
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_U32_TO_F32);
@ -851,7 +851,7 @@ aot_intrinsic_fill_capability_flags(AOTCompContext *comp_ctx)
add_f32_common_intrinsics(comp_ctx);
add_f64_common_intrinsics(comp_ctx);
add_i64_common_intrinsics(comp_ctx);
add_common_float_integer_convertion(comp_ctx);
add_common_float_integer_conversion(comp_ctx);
}
}
else if (!strncmp(comp_ctx->target_arch, "riscv", 5)) {
@ -862,7 +862,7 @@ aot_intrinsic_fill_capability_flags(AOTCompContext *comp_ctx)
*/
add_f32_common_intrinsics(comp_ctx);
add_f64_common_intrinsics(comp_ctx);
add_common_float_integer_convertion(comp_ctx);
add_common_float_integer_conversion(comp_ctx);
if (!strncmp(comp_ctx->target_arch, "riscv32", 7)) {
add_i64_common_intrinsics(comp_ctx);
}
@ -876,7 +876,7 @@ aot_intrinsic_fill_capability_flags(AOTCompContext *comp_ctx)
add_i32_common_intrinsics(comp_ctx);
add_f64_common_intrinsics(comp_ctx);
add_i64_common_intrinsics(comp_ctx);
add_common_float_integer_convertion(comp_ctx);
add_common_float_integer_conversion(comp_ctx);
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F32_CONST);
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_F64_CONST);
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I32_CONST);

View File

@ -333,7 +333,7 @@ wasm_runtime_atomic_wait(WASMModuleInstanceCommon *module, void *address,
while (1) {
if (timeout < 0) {
/* wait forever until it is notified or terminatied
/* wait forever until it is notified or terminated
here we keep waiting and checking every second */
os_cond_reltimedwait(&wait_node->wait_cond, lock,
(uint64)timeout_1sec);

View File

@ -3966,7 +3966,7 @@ aot_compile_wasm(AOTCompContext *comp_ctx)
orc_main_dylib = LLVMOrcLLLazyJITGetMainJITDylib(comp_ctx->orc_jit);
if (!orc_main_dylib) {
aot_set_last_error(
"failed to get orc orc_jit main dynmaic library");
"failed to get orc orc_jit main dynamic library");
return false;
}
@ -4191,7 +4191,7 @@ aot_emit_object_file(AOTCompContext *comp_ctx, char *file_name)
/*
* move the temporary .su file to the specified location.
*
* Note: the former is automatimally inferred from the output
* Note: the former is automatically inferred from the output
* filename (file_name here) by clang.
*
* Note: the latter might be user-specified.
@ -4247,7 +4247,7 @@ aot_emit_object_file(AOTCompContext *comp_ctx, char *file_name)
#endif /* end of !(defined(_WIN32) || defined(_WIN32_)) */
if (!strncmp(LLVMGetTargetName(target), "arc", 3))
/* Emit to assmelby file instead for arc target
/* Emit to assembly file instead for arc target
as it cannot emit to object file */
file_type = LLVMAssemblyFile;

View File

@ -2125,7 +2125,7 @@ aot_compile_op_call_indirect(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
if (!(table_size_const =
LLVMBuildBitCast(comp_ctx->builder, table_size_const,
INT32_PTR_TYPE, "cur_siuze_i32p"))) {
INT32_PTR_TYPE, "cur_size_i32p"))) {
HANDLE_FAILURE("LLVMBuildBitCast");
goto fail;
}

View File

@ -569,7 +569,7 @@ aot_compile_op_struct_new(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
SET_BUILDER_POS(check_struct_obj_succ);
/* For WASM_OP_STRUCT_NEW, init filed with poped value */
/* For WASM_OP_STRUCT_NEW, init field with poped value */
if (!init_with_default
&& !struct_new_canon_init_fields(comp_ctx, func_ctx, type_index,
struct_obj)) {

View File

@ -145,7 +145,7 @@ aot_check_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(addr)) {
uint64 mem_offset =
(uint64)LLVMConstIntGetZExtValue(addr) + (uint64)offset;
@ -1410,7 +1410,7 @@ aot_compile_op_atomic_cmpxchg(AOTCompContext *comp_ctx,
LLVMSetVolatile(result, true);
/* CmpXchg return {i32, i1} structure,
we need to extrack the previous_value from the structure */
we need to extract the previous_value from the structure */
if (!(result = LLVMBuildExtractValue(comp_ctx->builder, result, 0,
"previous_value"))) {
goto fail;

View File

@ -554,7 +554,7 @@ compile_int_div(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
}
}
else {
/* Check divied by zero */
/* Check divided by zero */
LLVM_BUILD_ICMP(LLVMIntEQ, right, is_i32 ? I32_ZERO : I64_ZERO,
cmp_div_zero, "cmp_div_zero");
ADD_BASIC_BLOCK(check_div_zero_succ, "check_div_zero_success");

View File

@ -147,7 +147,7 @@ aot_check_table_access(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
}
if (!(tbl_sz = LLVMBuildBitCast(comp_ctx->builder, tbl_sz, INT32_PTR_TYPE,
"cur_siuze_i32p"))) {
"cur_size_i32p"))) {
HANDLE_FAILURE("LLVMBuildBitCast");
goto fail;
}

View File

@ -2418,7 +2418,7 @@ orc_jit_create(AOTCompContext *comp_ctx)
}
if (comp_ctx->enable_stack_bound_check || comp_ctx->enable_stack_estimation)
LLVMOrcLLJITBuilderSetCompileFuncitonCreatorWithStackSizesCallback(
LLVMOrcLLJITBuilderSetCompileFunctionCreatorWithStackSizesCallback(
builder, jit_stack_size_callback, comp_ctx);
err = LLVMOrcJITTargetMachineBuilderDetectHost(&jtmb);

View File

@ -374,7 +374,7 @@ typedef struct AOTCompContext {
char target_arch[16];
unsigned pointer_size;
/* Hardware intrinsic compability flags */
/* Hardware intrinsic compatibility flags */
uint64 flags[8];
/* required by JIT */
@ -441,7 +441,7 @@ typedef struct AOTCompContext {
/* Use profile file collected by LLVM PGO */
char *use_prof_file;
/* Enable to use segument register as the base addr
/* Enable to use segment register as the base addr
of linear memory for load/store operations */
bool enable_segue_i32_load;
bool enable_segue_i64_load;

View File

@ -203,7 +203,7 @@ PartitionFunction(GlobalValueSet Requested)
* if the jit wrapper (which has "_wrapper" suffix in
* the name) is requested, compile others in the group too.
* otherwise, only compile the requested one.
* (and possibly the correspondig wrapped function,
* (and possibly the corresponding wrapped function,
* which has AOT_FUNC_INTERNAL_PREFIX.)
*/
wrapper = strstr(gvname + prefix_len, "_wrapper");

View File

@ -72,7 +72,7 @@ LLVMOrcObjectTransformLayerRef
LLVMOrcLLLazyJITGetObjTransformLayer(LLVMOrcLLLazyJITRef J);
void
LLVMOrcLLJITBuilderSetCompileFuncitonCreatorWithStackSizesCallback(
LLVMOrcLLJITBuilderSetCompileFunctionCreatorWithStackSizesCallback(
LLVMOrcLLLazyJITBuilderRef Builder,
void (*cb)(void *, const char *, size_t, size_t), void *cb_data);

View File

@ -130,7 +130,7 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(llvm::orc::LLLazyJITBuilder,
LLVMOrcLLLazyJITBuilderRef)
void
LLVMOrcLLJITBuilderSetCompileFuncitonCreatorWithStackSizesCallback(
LLVMOrcLLJITBuilderSetCompileFunctionCreatorWithStackSizesCallback(
LLVMOrcLLLazyJITBuilderRef Builder,
void (*cb)(void *, const char *, size_t, size_t), void *cb_data)
{

View File

@ -37,7 +37,7 @@ typedef struct dwarf_extractor {
#define TO_HANDLE(extractor) (dwarf_extractor_handle_t)(extractor)
#define TO_EXTACTOR(handle) (dwarf_extractor *)(handle)
#define TO_EXTRACTOR(handle) (dwarf_extractor *)(handle)
static bool is_debugger_initialized;
@ -103,7 +103,7 @@ fail3:
void
destroy_dwarf_extractor(dwarf_extractor_handle_t handle)
{
dwarf_extractor *extractor = TO_EXTACTOR(handle);
dwarf_extractor *extractor = TO_EXTRACTOR(handle);
if (!extractor)
return;
extractor->debugger.DeleteTarget(extractor->target);
@ -122,7 +122,7 @@ dwarf_gen_file_info(const AOTCompContext *comp_ctx)
const char *file_name;
const char *dir_name;
if (!(extractor = TO_EXTACTOR(comp_ctx->comp_data->extractor)))
if (!(extractor = TO_EXTRACTOR(comp_ctx->comp_data->extractor)))
return NULL;
units_number = extractor->module.GetNumCompileUnits();
@ -198,7 +198,7 @@ dwarf_gen_comp_unit_info(const AOTCompContext *comp_ctx)
int units_number;
LLVMMetadataRef comp_unit = NULL;
if (!(extractor = TO_EXTACTOR(comp_ctx->comp_data->extractor)))
if (!(extractor = TO_EXTRACTOR(comp_ctx->comp_data->extractor)))
return NULL;
units_number = extractor->module.GetNumCompileUnits();
@ -312,12 +312,12 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
case eLanguageTypeC17:
break;
default:
LOG_WARNING("func %s has unsuppoted language_type 0x%x",
LOG_WARNING("func %s has unsupported language_type 0x%x",
function_name, (int)language_type);
return NULL;
}
if (!(extractor = TO_EXTACTOR(comp_ctx->comp_data->extractor)))
if (!(extractor = TO_EXTRACTOR(comp_ctx->comp_data->extractor)))
return NULL;
LLVMDIBuilderRef DIB = comp_ctx->debug_builder;
@ -389,7 +389,7 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
function.GetBlock().GetVariables(extractor->target, true, false, false);
if (num_function_args != variable_list.GetSize()) {
LOG_ERROR(
"function args number dismatch!:value number=%d, function args=%d",
"function args number mismatch!:value number=%d, function args=%d",
variable_list.GetSize(), num_function_args);
}
@ -399,13 +399,13 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
// TODO:change to void * or WasmExenv *
LLVMMetadataRef voidtype =
LLVMDIBuilderCreateBasicType(DIB, "void", 4, 0, 0, LLVMDIFlagZero);
LLVMMetadataRef voidpionter =
LLVMMetadataRef voidpointer =
LLVMDIBuilderCreatePointerType(DIB, voidtype, 64, 0, 0, "void *", 6);
LLVMMetadataRef ParamVar = LLVMDIBuilderCreateParameterVariable(
DIB, FunctionMetadata, "exenv", 5, 1,
File, // starts form 1, and 1 is exenv,
line_entry.GetLine(), voidpionter, true, LLVMDIFlagZero);
line_entry.GetLine(), voidpointer, true, LLVMDIFlagZero);
LLVMValueRef Param = LLVMGetParam(func_ctx->func, 0);
LLVMBasicBlockRef block_curr = LLVMGetEntryBasicBlock(func_ctx->func);
LLVMDIBuilderInsertDbgValueAtEnd(DIB, Param, ParamVar, ParamExpression,
@ -447,13 +447,13 @@ dwarf_gen_func_info(const AOTCompContext *comp_ctx,
uint64_t vm_offset;
AOTFunc *func = func_ctx->aot_func;
if (!(extractor = TO_EXTACTOR(comp_ctx->comp_data->extractor)))
if (!(extractor = TO_EXTRACTOR(comp_ctx->comp_data->extractor)))
return NULL;
// A code address in DWARF for WebAssembly is the offset of an
// instruction relative within the Code section of the WebAssembly file.
// For this reason Section::GetFileAddress() must return zero for the
// Code section. (refert to ObjectFileWasm.cpp)
// Code section. (refer to ObjectFileWasm.cpp)
vm_offset = func->code - comp_ctx->comp_data->wasm_module->buf_code;
auto sbaddr = extractor->target.ResolveFileAddress(vm_offset);
@ -479,13 +479,13 @@ dwarf_get_func_name(const AOTCompContext *comp_ctx,
name[0] = '\0';
if (!(extractor = TO_EXTACTOR(comp_ctx->comp_data->extractor)))
if (!(extractor = TO_EXTRACTOR(comp_ctx->comp_data->extractor)))
return;
// A code address in DWARF for WebAssembly is the offset of an
// instruction relative within the Code section of the WebAssembly file.
// For this reason Section::GetFileAddress() must return zero for the
// Code section. (refert to ObjectFileWasm.cpp)
// Code section. (refer to ObjectFileWasm.cpp)
vm_offset = func->code - comp_ctx->comp_data->wasm_module->buf_code;
auto sbaddr = extractor->target.ResolveFileAddress(vm_offset);
@ -509,7 +509,7 @@ dwarf_gen_location(const AOTCompContext *comp_ctx,
if (func_ctx->debug_func == NULL)
return NULL;
if (!(extractor = TO_EXTACTOR(comp_ctx->comp_data->extractor)))
if (!(extractor = TO_EXTRACTOR(comp_ctx->comp_data->extractor)))
return NULL;
auto sbaddr = extractor->target.ResolveFileAddress(vm_offset);
@ -550,13 +550,13 @@ dwarf_gen_func_ret_location(const AOTCompContext *comp_ctx,
AOTFunc *func = func_ctx->aot_func;
LLVMMetadataRef location_info = NULL;
if (!(extractor = TO_EXTACTOR(comp_ctx->comp_data->extractor)))
if (!(extractor = TO_EXTRACTOR(comp_ctx->comp_data->extractor)))
return NULL;
// A code address in DWARF for WebAssembly is the offset of an
// instruction relative within the Code section of the WebAssembly file.
// For this reason Section::GetFileAddress() must return zero for the
// Code section. (refert to ObjectFileWasm.cpp)
// Code section. (refer to ObjectFileWasm.cpp)
vm_offset = (func->code + func->code_size - 1)
- comp_ctx->comp_data->wasm_module->buf_code;
location_info = dwarf_gen_location(comp_ctx, func_ctx, vm_offset);

View File

@ -85,7 +85,7 @@ aot_compile_simd_swizzle_x86(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
if (!(condition = LLVMBuildICmp(comp_ctx->builder, LLVMIntUGE, mask,
max_lanes, "compare_with_16"))) {
HANDLE_FAILURE("LLVMBuldICmp");
HANDLE_FAILURE("LLVMBuildICmp");
goto fail;
}
@ -363,7 +363,7 @@ aot_compile_simd_replace(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
goto fail;
}
return simd_bitcast_and_push_v128(comp_ctx, func_ctx, result, "reesult");
return simd_bitcast_and_push_v128(comp_ctx, func_ctx, result, "result");
fail:
return false;

View File

@ -45,7 +45,7 @@ simd_build_bitmask(const AOTCompContext *comp_ctx,
goto fail;
}
/* fill every bit in a lange with its sign bit */
/* fill every bit in a lane with its sign bit */
if (!(ashr_distance = simd_build_splat_const_integer_vector(
comp_ctx, element_type[itype], lane_bits[itype] - 1,
lanes[itype]))) {

View File

@ -86,8 +86,8 @@ fail:
}
static bool
interger_vector_compare(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
IntCond cond, LLVMTypeRef vector_type)
integer_vector_compare(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
IntCond cond, LLVMTypeRef vector_type)
{
LLVMValueRef vec1, vec2, result;
LLVMIntPredicate int_pred;
@ -138,28 +138,28 @@ bool
aot_compile_simd_i8x16_compare(AOTCompContext *comp_ctx,
AOTFuncContext *func_ctx, IntCond cond)
{
return interger_vector_compare(comp_ctx, func_ctx, cond, V128_i8x16_TYPE);
return integer_vector_compare(comp_ctx, func_ctx, cond, V128_i8x16_TYPE);
}
bool
aot_compile_simd_i16x8_compare(AOTCompContext *comp_ctx,
AOTFuncContext *func_ctx, IntCond cond)
{
return interger_vector_compare(comp_ctx, func_ctx, cond, V128_i16x8_TYPE);
return integer_vector_compare(comp_ctx, func_ctx, cond, V128_i16x8_TYPE);
}
bool
aot_compile_simd_i32x4_compare(AOTCompContext *comp_ctx,
AOTFuncContext *func_ctx, IntCond cond)
{
return interger_vector_compare(comp_ctx, func_ctx, cond, V128_i32x4_TYPE);
return integer_vector_compare(comp_ctx, func_ctx, cond, V128_i32x4_TYPE);
}
bool
aot_compile_simd_i64x2_compare(AOTCompContext *comp_ctx,
AOTFuncContext *func_ctx, IntCond cond)
{
return interger_vector_compare(comp_ctx, func_ctx, cond, V128_i64x2_TYPE);
return integer_vector_compare(comp_ctx, func_ctx, cond, V128_i64x2_TYPE);
}
static bool

View File

@ -12,7 +12,7 @@
static bool
simd_integer_narrow_x86(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
LLVMTypeRef in_vector_type, LLVMTypeRef out_vector_type,
const char *instrinsic)
const char *intrinsic)
{
LLVMValueRef vector1, vector2, result;
LLVMTypeRef param_types[2] = { in_vector_type, in_vector_type };
@ -24,7 +24,7 @@ simd_integer_narrow_x86(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
return false;
}
if (!(result = aot_call_llvm_intrinsic(comp_ctx, func_ctx, instrinsic,
if (!(result = aot_call_llvm_intrinsic(comp_ctx, func_ctx, intrinsic,
out_vector_type, param_types, 2,
vector1, vector2))) {
HANDLE_FAILURE("LLVMBuildCall");
@ -659,7 +659,7 @@ aot_compile_simd_i16x8_q15mulr_sat(AOTCompContext *comp_ctx,
if (!(result = LLVMBuildTrunc(comp_ctx->builder, result, V128_i16x8_TYPE,
"down_to_v8i16"))) {
HANDLE_FAILURE("LLVMBuidlTrunc");
HANDLE_FAILURE("LLVMBuildTrunc");
return false;
}

View File

@ -1,36 +1,36 @@
# Wasm Function
# Wasm Function
## Internal data structure
![](./images/wasm_function.svg)
## Module level data (function)
**WASMModule**: Data structure created for loading a module.
**WASMModule**: Data structure created for loading a module.
- `WASMImport *import_functions`: initialized from the Wasm file function section
- `WASMImport *import_functions`: initialized from the Wasm file import section. The runtime will try to solve the imports from the native API registration, refer to [Export native API to WASM application](../../../doc/export_native_api.md).
- `WASMImport *import_functions`: initialized from the Wasm file import section. The runtime will try to solve the imports from the native API registration, refer to [Export native API to WASM application](../../../doc/export_native_api.md).
**WASMFunction**: represent a Wasm function located in Wasm file code section. Track the links to the compiled function body.
**WASMFunction**: represent a Wasm function located in Wasm file code section. Track the links to the compiled function body.
**WASMImport**: represent a imported Wasm function which can be a solved as a native function or another Wasm module exported function.
## Instance level data (function)
**WASMModuleInstance**: Data structure created for instantiating a module
- `WASMModuleInstanceExtra::functions`: combined the imported and internal functions into single array of structure `WASMFunctionInstance`
- `WASMModuleInstance::import_func_ptrs`: pointer array for solved function imports. This array is referred during calling imported native function. Note it is initialzed with the module level solved imports, but may points to different native function later due to c-api calls.
- `WASMModuleInstance::import_func_ptrs`: pointer array for solved function imports. This array is referred during calling imported native function. Note it is initialized with the module level solved imports, but may points to different native function later due to c-api calls.
## Execution paths
**Interpreter**:
- Execute internal bytecode function:
```
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
-> WASMFunctionInstance::func
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
-> WASMFunctionInstance::func
-> WASMFunction::code
```
- Execute imported function from other module:
```
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
(WASMFunctionInstance flag indicates an import)
-> WASMFunctionInstance::import_func_inst
-> WASMModuleInstance(second)::func
@ -39,9 +39,9 @@
- Execute imported native function:
```
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
WASMModuleInstance::e
-> WASMModuleInstanceExtra::functions[..]
(flag indicates imported native)
WASMModuleInstance::import_func_ptrs[..]
-> native function
```
```

View File

@ -1584,7 +1584,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
uint32 *tgtframe_sp = tgtframe->frame_sp;
/* frame sp of tgtframe points to catched exception */
/* frame sp of tgtframe points to caught exception */
exception_tag_index = *((uint32 *)tgtframe_sp);
tgtframe_sp++;
@ -1655,7 +1655,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
* BLOCK, IF and LOOP do not contain handlers and
* cannot catch exceptions.
* blocks marked as CATCH or
* CATCH_ALL did already caugth an exception and can
* CATCH_ALL did already caught an exception and can
* only be a target for RETHROW, but cannot catch an
* exception again
*/
@ -1787,7 +1787,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
}
handler_number++;
}
/* exception not catched in this frame */
/* exception not caught in this frame */
break;
}
case LABEL_TYPE_FUNCTION:
@ -6411,7 +6411,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
}
}
/*
* excange the thrown exception (index valid in submodule)
* exchange the thrown exception (index valid in submodule)
* with the imported exception index (valid in this module)
* if the module did not import the exception,
* that results in a "INVALID_TAGINDEX", that triggers
@ -6468,7 +6468,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
goto find_a_catch_handler;
}
/* when throw hits the end of a function it signalles with a
/* when throw hits the end of a function it signals with a
* "uncaught wasm exception" trap */
if (has_exception
&& strstr(uncaught_exception, "uncaught wasm exception")) {

View File

@ -1143,14 +1143,14 @@ load_init_expr(WASMModule *module, const uint8 **p_buf, const uint8 *buf_end,
case WASM_OP_ANY_CONVERT_EXTERN:
{
set_error_buf(error_buf, error_buf_size,
"unsuppoted constant expression of "
"unsupported constant expression of "
"extern.internalize");
goto fail;
}
case WASM_OP_EXTERN_CONVERT_ANY:
{
set_error_buf(error_buf, error_buf_size,
"unsuppoted constant expression of "
"unsupported constant expression of "
"extern.externalize");
goto fail;
}
@ -5433,7 +5433,7 @@ orcjit_thread_callback(void *arg)
uint32 i;
#if WASM_ENABLE_FAST_JIT != 0
/* Compile fast jit funcitons of this group */
/* Compile fast jit functions of this group */
for (i = group_idx; i < func_count; i += group_stride) {
if (!jit_compiler_compile(module, i + module->import_function_count)) {
LOG_ERROR("failed to compile fast jit function %u\n", i);
@ -5547,7 +5547,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,
@ -6431,7 +6431,7 @@ check_wasi_abi_compatibility(const WASMModule *module,
{
/**
* be careful with:
* wasi compatiable modules(command/reactor) which don't import any wasi
* wasi compatible modules(command/reactor) which don't import any wasi
* APIs. Usually, a command has to import a "prox_exit" at least, but a
* reactor can depend on nothing. At the same time, each has its own entry
* point.
@ -6508,7 +6508,7 @@ check_wasi_abi_compatibility(const WASMModule *module,
}
}
/* filter out non-wasi compatiable modules */
/* filter out non-wasi compatible modules */
if (!module->import_wasi_api && !start && !initialize) {
return true;
}
@ -6521,7 +6521,7 @@ check_wasi_abi_compatibility(const WASMModule *module,
/*
* there is at least one of `_start` and `_initialize` in below cases.
* according to the assumption, they should be all wasi compatiable
* according to the assumption, they should be all wasi compatible
*/
#if WASM_ENABLE_MULTI_MODULE != 0
@ -6786,7 +6786,7 @@ wasm_loader_unload(WASMModule *module)
WASMRegisteredModule *next = bh_list_elem_next(node);
bh_list_remove(module->import_module_list, node);
/*
* unload(sub_module) will be trigged during runtime_destroy().
* unload(sub_module) will be triggered during runtime_destroy().
* every module in the global module list will be unloaded one by
* one. so don't worry.
*/
@ -7049,9 +7049,9 @@ wasm_loader_find_block_addr(WASMExecEnv *exec_env, BlockAddr *block_addr_cache,
break;
case WASM_OP_BR_TABLE:
read_leb_uint32(p, p_end, count); /* lable num */
read_leb_uint32(p, p_end, count); /* label num */
#if WASM_ENABLE_FAST_INTERP != 0
for (i = 0; i <= count; i++) /* lableidxs */
for (i = 0; i <= count; i++) /* labelidxs */
skip_leb_uint32(p, p_end);
#else
p += count + 1;
@ -7062,7 +7062,7 @@ wasm_loader_find_block_addr(WASMExecEnv *exec_env, BlockAddr *block_addr_cache,
#if WASM_ENABLE_FAST_INTERP == 0
case EXT_OP_BR_TABLE_CACHE:
read_leb_uint32(p, p_end, count); /* lable num */
read_leb_uint32(p, p_end, count); /* label num */
while (*p == WASM_OP_NOP)
p++;
break;
@ -7086,7 +7086,7 @@ wasm_loader_find_block_addr(WASMExecEnv *exec_env, BlockAddr *block_addr_cache,
#if WASM_ENABLE_REF_TYPES == 0 && WASM_ENABLE_GC == 0
u8 = read_uint8(p); /* 0x00 */
#else
skip_leb_uint32(p, p_end); /* talbeidx */
skip_leb_uint32(p, p_end); /* tableidx */
#endif
break;
@ -7661,7 +7661,7 @@ wasm_loader_find_block_addr(WASMExecEnv *exec_env, BlockAddr *block_addr_cache,
{
WASMDebugInstance *debug_instance =
wasm_exec_env_get_instance(exec_env);
char orignal_opcode[1];
char original_opcode[1];
uint64 size = 1;
WASMModuleInstance *module_inst =
(WASMModuleInstance *)exec_env->module_inst;
@ -7670,12 +7670,12 @@ wasm_loader_find_block_addr(WASMExecEnv *exec_env, BlockAddr *block_addr_cache,
: ~0;
if (debug_instance) {
if (wasm_debug_instance_get_obj_mem(debug_instance, offset,
orignal_opcode, &size)
original_opcode, &size)
&& size == 1) {
LOG_VERBOSE("WASM loader find OP_BREAK , recover it "
"with %02x: ",
orignal_opcode[0]);
opcode = orignal_opcode[0];
original_opcode[0]);
opcode = original_opcode[0];
goto op_break_retry;
}
}
@ -9373,7 +9373,7 @@ wasm_loader_get_const_offset(WASMLoaderContext *ctx, uint8 type, void *value,
sizeof(float64));
ctx->const_cell_num += 2;
/* The const buf will be reversed, we use the second cell */
/* of the i64/f64 const so the finnal offset is corrent */
/* of the i64/f64 const so the final offset is correct */
operand_offset++;
break;
case VALUE_TYPE_I64:
@ -9405,7 +9405,7 @@ wasm_loader_get_const_offset(WASMLoaderContext *ctx, uint8 type, void *value,
LOG_OP("#### new const [%d]: %ld\n", ctx->num_const,
(int64)c->value.i64);
}
/* use negetive index for const */
/* use negative index for const */
operand_offset = -(operand_offset + 1);
*offset = operand_offset;
return true;
@ -11300,7 +11300,7 @@ re_scan:
* CATCH Blocks */
RESET_STACK();
/* push types on the stack according to catched type */
/* push types on the stack according to caught type */
if (BLOCK_HAS_PARAM(new_block_type)) {
for (i = 0; i < new_block_type.u.type->param_count; i++)
PUSH_TYPE(new_block_type.u.type->types[i]);
@ -13643,7 +13643,7 @@ re_scan:
if (u32 >= module->data_seg_count) {
set_error_buf(error_buf, error_buf_size,
"unknown data segement");
"unknown data segment");
goto fail;
}
@ -13662,7 +13662,7 @@ re_scan:
if (u32 >= module->table_seg_count) {
set_error_buf(error_buf, error_buf_size,
"unknown element segement");
"unknown element segment");
goto fail;
}
if (!wasm_reftype_is_subtype_of(

View File

@ -2311,7 +2311,7 @@ orcjit_thread_callback(void *arg)
uint32 i;
#if WASM_ENABLE_FAST_JIT != 0
/* Compile fast jit funcitons of this group */
/* Compile fast jit functions of this group */
for (i = group_idx; i < func_count; i += group_stride) {
if (!jit_compiler_compile(module, i + module->import_function_count)) {
LOG_ERROR("failed to compile fast jit function %u\n", i);

View File

@ -86,7 +86,7 @@ typedef enum WASMOpcode {
WASM_OP_I32_STORE8 = 0x3a, /* i32.store8 */
WASM_OP_I32_STORE16 = 0x3b, /* i32.store16 */
WASM_OP_I64_STORE8 = 0x3c, /* i64.store8 */
WASM_OP_I64_STORE16 = 0x3d, /* i64.sotre16 */
WASM_OP_I64_STORE16 = 0x3d, /* i64.store16 */
WASM_OP_I64_STORE32 = 0x3e, /* i64.store32 */
WASM_OP_MEMORY_SIZE = 0x3f, /* memory.size */
WASM_OP_MEMORY_GROW = 0x40, /* memory.grow */
@ -325,7 +325,7 @@ typedef enum WASMGCEXTOpcode {
WASM_OP_I31_GET_S = 0x1D, /* i31.get_s */
WASM_OP_I31_GET_U = 0x1E, /* i31.get_u */
/* stringref related opcoded */
/* stringref related opcodes */
WASM_OP_STRING_NEW_UTF8 = 0x80, /* string.new_utf8 */
WASM_OP_STRING_NEW_WTF16 = 0x81, /* string.new_wtf16 */
WASM_OP_STRING_CONST = 0x82, /* string.const */

View File

@ -79,7 +79,7 @@ cmake -DWAMR_BUILD_PLATFORM=linux -DWAMR_BUILD_TARGET=ARM
#### **Enable memory64 feature**
- **WAMR_BUILD_MEMORY64**=1/0, default to disable if not set
> Note: Currently, the memory64 feature is only supported in classic interpreter running mode.
> Note: Currently, the memory64 feature is only supported in classic interpreter running mode.
#### **Enable thread manager**
- **WAMR_BUILD_THREAD_MGR**=1/0, default to disable if not set
@ -137,7 +137,7 @@ cmake -DWAMR_BUILD_PLATFORM=linux -DWAMR_BUILD_TARGET=ARM
#### **Enable Exception Handling**
- **WAMR_BUILD_EXCE_HANDLING**=1/0, default to disable if not set
> Note: Currently, the exception handling feature is only supported in classic interpreter running mode.
> Note: Currently, the exception handling feature is only supported in classic interpreter running mode.
#### **Enable Garbage Collection**
- **WAMR_BUILD_GC**=1/0, default to disable if not set
@ -210,7 +210,7 @@ Currently we only profile the memory consumption of module, module_instance and
> }
> ```
>
> and then use `cmake -DWAMR_BH_VPRINTF=my_vprintf ..` to pass the callback function, or add `BH_VPRINTF=my_vprintf` macro for the compiler, e.g. add line `add_defintions(-DBH_VPRINTF=my_vprintf)` in CMakeListst.txt. See [basic sample](../samples/basic/src/main.c) for a usage example.
> and then use `cmake -DWAMR_BH_VPRINTF=my_vprintf ..` to pass the callback function, or add `BH_VPRINTF=my_vprintf` macro for the compiler, e.g. add line `add_definitions(-DBH_VPRINTF=my_vprintf)` in CMakeLists.txt. See [basic sample](../samples/basic/src/main.c) for a usage example.
#### **WAMR_BH_LOG**=<log_callback>, default to disable if not set
> Note: if the log_callback function is provided by the developer, WAMR logs are redirected to such callback. For example:
@ -285,7 +285,7 @@ Currently we only profile the memory consumption of module, module_instance and
- **WAMR_BUILD_AOT_INTRINSICS**=1/0, enable the AOT intrinsic functions, default to enable if not set. These functions can be called from the AOT code when `--disable-llvm-intrinsics` flag or `--enable-builtin-intrinsics=<intr1,intr2,...>` flag is used by wamrc to generate the AOT file.
> Note: See [Tuning the XIP intrinsic functions](./xip.md#tuning-the-xip-intrinsic-functions) for more details.
#### **Configurale memory access boundary check**
#### **Configurable memory access boundary check**
- **WAMR_CONFIGUABLE_BOUNDS_CHECKS**=1/0, default to disable if not set
> Note: If it is enabled, allow to run `iwasm --disable-bounds-checks` to disable the memory access boundary checks for interpreter mode.

View File

@ -207,7 +207,7 @@ There are two runtime APIs available for this purpose.
/**
* malloc a buffer from instance's private memory space.
*
* return: the buffer address in instance's memory space (pass to the WASM funciton)
* return: the buffer address in instance's memory space (pass to the WASM function)
* p_native_addr: return the native address of allocated memory
* size: the buffer size to allocate
*/
@ -219,7 +219,7 @@ wasm_runtime_module_malloc(wasm_module_inst_t module_inst,
* malloc a buffer from instance's private memory space,
* and copy the data from another native buffer to it.
*
* return: the buffer address in instance's memory space (pass to the WASM funciton)
* return: the buffer address in instance's memory space (pass to the WASM function)
* src: the native buffer address
* size: the size of buffer to be allocated and copy data
*/

View File

@ -36,7 +36,7 @@ void foo2(wasm_exec_env_t exec_env, char * msg, uint8 * buffer, int buf_len)
}
```
The first parameter exec_env must be defined using type **wasm_exec_env_t** which is the calling convention by WAMR.
The first parameter exec_env must be defined using type **wasm_exec_env_t** which is the calling convention by WAMR.
The rest parameters should be in the same types as the parameters of WASM function foo(), but there are a few special cases that are explained in section "Buffer address conversion and boundary check". Regarding the parameter names, they don't have to be the same, but we would suggest using the same names for easy maintenance.
@ -47,10 +47,10 @@ The rest parameters should be in the same types as the parameters of WASM functi
Register the native APIs in the runtime, then everything is fine. It is ready to build the runtime software.
``` C
// Define an array of NativeSymbol for the APIs to be exported.
// Define an array of NativeSymbol for the APIs to be exported.
// Note: the array must be static defined since runtime
// will keep it after registration
static NativeSymbol native_symbols[] =
static NativeSymbol native_symbols[] =
{
{
"foo", // the name of WASM function name
@ -61,7 +61,7 @@ static NativeSymbol native_symbols[] =
"foo2", // the name of WASM function name
foo2, // the native function pointer
"($*~)" // the function prototype signature
}
}
};
// initialize the runtime before registering the native functions
@ -69,12 +69,12 @@ wasm_runtime_init();
int n_native_symbols = sizeof(native_symbols) / sizeof(NativeSymbol);
if (!wasm_runtime_register_natives("env",
native_symbols,
native_symbols,
n_native_symbols)) {
goto fail1;
}
// natives registeration must be done before loading WASM modules
// natives registration must be done before loading WASM modules
module = wasm_runtime_load(buffer, size, error_buf, sizeof(error_buf));
```
@ -86,7 +86,7 @@ The function signature field in **NativeSymbol** structure is a string for descr
Each letter in the "()" represents a parameter type, and the one following after ")" represents the return value type. The meaning of each letter:
- '**i**': i32
- '**I**': i64
- '**I**': i64
- '**f**': f32
- '**F**': f64
- '**r**': externref (has to be the value of a `uintptr_t` variable), or all kinds of GC reference types when GC feature is enabled
@ -101,13 +101,13 @@ The signature can defined as NULL, then all function parameters are assumed as i
The `NativeSymbol` element for `foo2 ` above can be also defined with macro EXPORT_WASM_API_WITH_SIG. This macro can be used when the native function name is the same as the WASM symbol name.
```c
static NativeSymbol native_symbols[] =
static NativeSymbol native_symbols[] =
{
EXPORT_WASM_API_WITH_SIG(foo2, "($*~)") // wasm symbol name will be "foo2"
};
```
## Call exported API in WASM application
@ -124,7 +124,7 @@ int main(int argc, char **argv)
int c = foo(a, b); // call into native foo_native()
foo2(msg, buffer, sizeof(buffer)); // call into native foo2()
return 0;
}
```
@ -157,9 +157,9 @@ As function parameters are always passed in 32 bits numbers, you can also use 'i
// for buffer address or string parameters, here
// is how to do address conversion and boundary check manually
//
void foo2(wasm_exec_env_t exec_env,
uint32 msg_offset,
uint32 buffer_offset,
void foo2(wasm_exec_env_t exec_env,
uint32 msg_offset,
uint32 buffer_offset,
int32 buf_len)
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
@ -169,7 +169,7 @@ void foo2(wasm_exec_env_t exec_env,
// do boundary check
if (!wasm_runtime_validate_app_str_add(msg_offset))
return 0;
if (!wasm_runtime_validate_app_addr((uint64)buffer_offset, (uint64)buf_len))
return;
@ -187,7 +187,7 @@ void foo2(wasm_exec_env_t exec_env,
## Sandbox security attention
The runtime builder should ensure not broking the memory sandbox when exporting the native function to WASM.
The runtime builder should ensure not broking the memory sandbox when exporting the native function to WASM.
A ground rule:
@ -196,7 +196,7 @@ A ground rule:
A few recommendations:
- Never pass any structure/class object pointer to native (do data serialization instead)
- Never pass a function pointer to the native
- Never pass a function pointer to the native
Note: while not recommended here, nothing prevents you from passing
structure/function pointers as far as the native API is aware of

View File

@ -48,7 +48,7 @@ A WASM linear memory is either shared or non-shared.
A WASM linear memory has `min` and `max` sizes.
(They correspond to `wasm-ld`'s `--init-memory` and `--max-memory` options.)
They are in the number of WASM pages, each of which is of 65536 bytes.
The `max` is optional for non-shared memory. When omitted, it effectivily
The `max` is optional for non-shared memory. When omitted, it effectively
means unlimited.
The linear memory is allocated via `os_mmap` and `os_mem_commit`/`os_mprotect`.

View File

@ -132,7 +132,7 @@ make
```
## Aux stack seperation
## Aux stack separation
The compiler may use some spaces in the linear memory as an auxiliary stack. When pthread is enabled, every thread should have its own aux stack space, so the total aux stack space reserved by the compiler will be divided into N + 1 parts, where N is the maximum number of threads that can be created by the user code.
The default value of N is 4, which means you can create 4 threads at most. This value can be changed by an option if you are using product-mini:

View File

@ -13,7 +13,7 @@ There are three parts in the new version string:
## Legacy versions
All legacy versions(tags) will keep their current status. No existed releasings names
All legacy versions(tags) will keep their current status. No existing release names
and links will be changed.
## Reference

View File

@ -13,8 +13,8 @@ llvm-dwarfdump-12 test.wasm
## Debugging with interpreter
See [Debuggging with interpreter](source_debugging_interpreter.md).
See [Debugging with interpreter](source_debugging_interpreter.md).
## Debugging with AOT
See [Debuggging with AOT](source_debugging_aot.md).
See [Debugging with AOT](source_debugging_aot.md).

View File

@ -31,7 +31,7 @@ are helpful.
- call `wasm_engine_new` or `wasm_engine_delete` multiple times in
different threads
## unspported list
## unsupported list
Currently WAMR supports most of the APIs, the unsupported APIs are listed as below:

View File

@ -252,10 +252,10 @@ main(int argc, const char *argv[])
return 1;
}
#define DESTROY_WASM_FUNCITON(name, index, ...) \
#define DESTROY_WASM_FUNCTION(name, index, ...) \
wasm_func_delete(function_##name);
IMPORT_FUNCTION_LIST(DESTROY_WASM_FUNCITON)
#undef DESTROY_WASM_FUNCITON
IMPORT_FUNCTION_LIST(DESTROY_WASM_FUNCTION)
#undef DESTROY_WASM_FUNCTION
// Extract export.
printf("Extracting export...\n");