Fix some more spelling issues (#3393)
This commit is contained in:
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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)) {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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]))) {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -1,36 +1,36 @@
|
||||
# Wasm Function
|
||||
# Wasm Function
|
||||
|
||||
## Internal data structure
|
||||
|
||||

|
||||
|
||||
## 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
|
||||
```
|
||||
```
|
||||
|
||||
@ -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")) {
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user