mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-11-27 18:11:21 +00:00
* build(deps): Bump github/codeql-action from 3.28.18 to 3.28.19 (#4346) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.18 to 3.28.19. - [Release notes](https://github.com/github/codeql-action/releases) - [Commits](https://github.com/github/codeql-action/compare/v3.28.18...v3.28.19) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 3.28.19 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * wasi_socket_ext.c: avoid tls to make this library-friendly (#4338) * Enable aot memory64 sw bounds checks by default (#4350) - enable aot memory64 sw bounds checks by default * build(deps): Bump requests from 2.32.3 to 2.32.4 in /build-scripts (#4349) Bumps [requests](https://github.com/psf/requests) from 2.32.3 to 2.32.4. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.32.3...v2.32.4) --- updated-dependencies: - dependency-name: requests dependency-version: 2.32.4 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * wasi_nn_types.h: remove a seemingly stale comment (#4348) * add heap-type check for GC when ref.null (#4300) - According to [Link 1](https://webassembly.github.io/gc/core/valid/instructions.html#xref-syntax-instructions-syntax-instr-ref-mathsf-ref-null-mathit-ht), we must ensure that the heap type is valid when ref.null. - According to [Link 2](https://webassembly.github.io/gc/core/valid/types.html#heap-types), a heap type is considered valid if it is either a concrete heap type or an abstract heap type. However, in this function, the check for abstract heap types (absheaptype) was clearly missing, so this condition needs to be added explicitly in the if statement. - When GC is disabled, no change is needed. - When GC is enabled, heap types in WAMR are LEB-encoded values ([Link 3](https://webassembly.github.io/gc/core/appendix/index-types.html)). Therefore, we must use read_leb_int32 to parse the heap type correctly. And we can compute the original type1 using type1 = (uint8)((int32)0x80 + heap_type);. * wamr-wasi-extensions: add a cmake package to provide our wasi extension (#4344) * wasi_ephemeral_nn.h: add a convenience wrapper header * wamr-wasi-extensions: add a cmake package to provide our wasi extension the sample app was tested with: * wasmtime * iwasm with https://github.com/bytecodealliance/wasm-micro-runtime/pull/4308 currently only contains wasi-nn. maybe it makes sense to add lib-socket things as well. cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/4288 * wasi_nn_openvino.c: remove the tensor layout adjustment logic (#4308) the logic in question seems like an attempt to work around some application bugs. my wild guess is that it was for classification-example. cf. https://github.com/bytecodealliance/wasmtime/issues/10867 * Update type validation in load_table_import() and load_table() (#4296) Prevent from value type. https://webassembly.github.io/spec/core/valid/types.html#table-types https://webassembly.github.io/gc/core/syntax/types.html#reference-types * Follow #4268 to deprecate wamr_ide-related components (#4341) refer to: Bypass wamr_ide-related components from the release process. (#4268) * clean up incompatible running mode checks in test script and ci (#4342) Rearrange the content of do_execute_in_running_mode() in alphabetical order. Add an incompatible check for x86_32. Now, all belows will be bypassed: - jit, fast-jit, multi-tier-jit - memory64 - multi-memory - simd * Update WABT downloads URL (#4357) Plus, skip unsupported running mode instead quit during wamr compiler test * Modify AOT static PGO to conform to llvm-18 and add a CI job to test static PGO on the coremark benchmark (#4345) * static PGO compatible with llvm18 and add CI job to test static PGO on coremark benchmark * update comments and warning info, bitmaps section in llvm profdata shouldn't be used in PGO * Collective fix for typos and minor bugs (#4369) * wasi-nn: fix backend leak on multiple loads (#4366) cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/4340 * build(deps): Bump github/codeql-action from 3.28.19 to 3.29.0 (#4371) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.19 to 3.29.0. - [Release notes](https://github.com/github/codeql-action/releases) - [Commits](https://github.com/github/codeql-action/compare/v3.28.19...v3.29.0) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 3.29.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * add validation for array type in load_init_expr(GC only) (#4370) * wasi_nn_openvino.c: remove broken xml check (#4365) `xml.buf[xml.size]` check is broken because it accesses past the end of the buffer. anyway, openvino doesn't seem to care the NUL termination. * wamr-wasi-extensions: add lib-socket things (#4360) * improve installation steps for wasi-sdk and wabt on Windows (#4359) * wasi_ephemeral_nn.h: prefix identfiers to avoid too generic names (#4358) * wasi_nn_openvino.c: add a missing buffer overflow check in get_output (#4353) cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/4351 * send an empty/error reply from server (#4362) Signed-off-by: Su Yihan <yihan.su@intel.com> * wasi_nn_openvino.c: remove pre/postprocessing and layout assumptions (#4361) as wasi-nn doesn't have these concepts, the best we can do without risking breaking certain applications here is to pass through tensors as they are. this matches wasmtime's behavior. tested with: * wasmtime classification-example (with this change, this example fails on tensor size mismatch instead of implicitly resizing it.) * license-plate-recognition-barrier-0007, a converted version with non-fp32 output. [1] (with this change, this model outputs integers as expected.) [1]cd7ebe313b/models/public/license-plate-recognition-barrier-0007* add nn-cli example (#4373) an example application with flexible cli options which aims to allow us to perform any wasi-nn operations. eg. ``` --load-graph=file=fixture/model.xml,file=fixture/model.bin,id=graph --init-execution-context=graph-id=graph,id=ctx --set-input=file=fixture/tensor.bgr,context-id=ctx,dim=1,dim=3,dim=224,dim=224 --compute=context-id=ctx --get-output=context-id=ctx,file=output.bin ``` * wasi-nn: apply the shared library hack to darwin as well (#4374) copied from the linux version. i'm a bit skeptical with this workaround though. it might be simpler to prohibit the use of wamr api in these shared libraries. after all, what these libraries do is nothing specific to wasm. * wasi-nn: don't try to deinit uninitialized backend (#4375) cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/4339 * core/iwasm/libraries/wasi-nn/test/build.sh: add a tip for intel mac (#4389) i keep forgetting this and had to re-investigate it at least twice. hopefully this can be helpful for others too. * wasi_nn_tensorflowlite.cpp: reject non-fp32 input earlier (#4388) this backend assumes fp32 here and there. it's safer to reject unexpected inputs explicitly. * Fix several issues related to night-run CI and test scripts. (#4385) - remove duplicated options - fix test script - change ci to use binary * core/iwasm/libraries/wasi-nn/test: use the correct version of keras (#4383) * wasi-nn: fix tensor_data abi for wasi_ephemeral_nn (#4379) it's "(list u8)" in the witx definition. the new definition matches both of our own host definition (struct tensor_wasm) and wasmtime. cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/4352 * enable WAMR_BUILD_WASI_EPHEMERAL_NN by default (#4381) cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/4326 * deprecate legacy WAMR-specific "wasi_nn" module (#4382) wasi_nn.h: deprecate legacy "wasi_nn" cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/4326 * wasi-nn: add minimum serialization on WASINNContext (#4387) currently this is not necessary because context (WASINNContext) is local to instance. (wasm_module_instance_t) i plan to make a context shared among instances in a cluster when fixing https://github.com/bytecodealliance/wasm-micro-runtime/issues/4313. this is a preparation for that direction. an obvious alternative is to tweak the module instance context APIs to allow declaring some kind of contexts instance-local. but i feel, in this particular case, it's more natural to make "wasi-nn handles" shared among threads within a "process". note that, spec-wise, how wasi-nn behaves wrt threads is not defined at all because wasi officially doesn't have threads yet. i suppose, at this point, that how wasi-nn interacts with wasi-threads is something we need to define by ourselves, especially when we are using an outdated wasi-nn version. with this change, if a thread attempts to access a context while another thread is using it, we simply make the operation fail with the "busy" error. this is intended for the mimimum serialization to avoid problems like crashes/leaks/etc. this is not intended to allow parallelism or such. no functional changes are intended at this point yet. cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/4313 https://github.com/bytecodealliance/wasm-micro-runtime/issues/2430 * Improve spec test execution by adding retry logic for transient errors (#4393) * wasi_nn_openvino.c: implement multiple models per instance (#4380) tested with two models: ``` --load-graph=id=graph1,file=public/license-plate-recognition-barrier-0007/FP32/license-plate-recognition-barrier-0007.xml,file=public/license-plate-recognition-barrier-0007/FP32/license-plate-recognition-barrier-0007.bin \ --load-graph=id=graph2,file=classify/model.xml,file=classify/model.bin \ --init-execution-context=id=exec1,graph-id=graph1 \ --init-execution-context=id=exec2,graph-id=graph2 \ --set-input=context-id=exec1,dim=1,dim=24,dim=94,dim=3,file=out.bin \ --set-input=context-id=exec2,file=classify/banana-3x224x224-bgr.bin,dim=1,dim=3,dim=224,dim=224 \ --compute=context-id=exec1 \ --compute=context-id=exec2 \ --get-output=context-id=exec1,file=exec1-result.bin \ --get-output=context-id=exec2,file=exec2-result.bin ``` a detailed HOWTO: https://github.com/bytecodealliance/wasm-micro-runtime/pull/4380#issuecomment-2986882718 * wamr-wasi-extensions/socket: disable reference-types (#4392) and add a comment to explain why. * CI: fix the description of upload_url (#4407) * wasi-nn: fix context lifetime issues (#4396) * wasi-nn: fix context lifetime issues use the module instance context api instead of trying to roll our own with a hashmap. this fixes context lifetime problems mentioned in https://github.com/bytecodealliance/wasm-micro-runtime/issues/4313. namely, * wasi-nn resources will be freed earlier now. before this change, they used to be kept until the runtime shutdown. (wasm_runtime_destroy) after this change, they will be freed together with the associated instances. * wasm_module_inst_t pointer uniqueness assumption (which is wrong after wasm_runtime_deinstantiate) was lifted. as a side effect, this change also makes a context shared among threads within a cluster. note that this is a user-visible api/abi breaking change. before this change, wasi-nn "handles" like wasi_ephemeral_nn_graph were thread-local. after this change, they are shared among threads within a cluster, similarly to wasi file descriptors. spec-wise, either behavior should be ok simply because wasi officially doesn't have threads yet. althogh i feel the latter semantics is more intuitive, if your application depends on the thread-local behavior, this change breaks your application. tested with wamr-wasi-extensions/samples/nn-cli, modified to call each wasi-nn operations on different threads. (if you are interested, you can find the modification at https://github.com/yamt/wasm-micro-runtime/tree/yamt-nn-wip-20250619.) cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/4313 https://github.com/bytecodealliance/wasm-micro-runtime/issues/2430 * runtime_lib.cmake: enable WAMR_BUILD_MODULE_INST_CONTEXT for wasi-nn as we do for wasi (WAMR_BUILD_LIBC_WASI) * wasi_nn_tensorflowlite.cpp: fix get_output return size (#4390) it should be byte size, not the number of (fp32) values. i'm ambivalent about how to deal with the compatibility for the legacy wamr-specific "wasi_nn". for now, i avoided changing it. (so that existing tests using the legacy abi, namely test_tensorflow.c and test_tensorflow_quantized.c, passes as they are.) if we have any users who still want to use the legacy abi, i suppose they consider the compatibility is more important than the consistency with other backends. cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/4376 * Refactor copy callstack feature (#4401) - Change `WAMR_ENABLE_COPY_CALLSTACK` to `WAMR_BUILD_COPY_CALL_STACK`, as `WAMR_BUILD` is the prefix for a command line option. - Change `WAMR_ENABLE_COPY_CALLSTACK` to `WASM_ENABLE_COPY_CALL_STACK`, as `WASM_ENABLE` is the prefix for a macro in the source code. - Change `CALLSTACK` to `CALL_STACK` to align with the existing `DUMP_CALL_STACK` feature. - Continue using `WASMCApiFrame` instead of `wasm_frame_t` outside of *wasm_c_api.xxx* to avoid a typedef redefinition warning, which is identified by Clang. * loader: add type index checking (#4402) * Fix handling of non-nullable global_type during global import (#4408) * wasi_nn_llamacpp.c: make this compilable (#4403) * fix bug in bh_vector when extending (#4414) * Collective fix (#4413) * Fix vector growth check and typos in core (#9) * Fix resource cleanup in memory and running modes tests (#10) * Add end of file empty line in wasm_running_modes_test.cc * wasi-nn: make the host use the wasi_ephemeral_nn version of tensor_data (#4411) the motivations: * make the actual input size available to the backends. (currently the backends have to make a guess from shape/type.) * make the host logic look a bit similar to wasi_ephemeral_nn. this is a backend api/abi change. * wasi_nn_llamacpp.c: fix buffer overruns in set_input (#4420) note: for some reasons, wasmedge seems to ignore type/dimensions for the input of ggml. some user code relies on it. cf. https://github.com/second-state/WasmEdge-WASINN-examples/issues/196 note: despite the comment in our code, the input doesn't seem nul-terminated. * wasi_nn_llamacpp.c: remove an unused variable (#4415) * Fix few shadow warnings (#4409) - declaration of ‘memidx’ shadows a previous local - declaration of ‘count’ shadows a previous local * CI: build wamr-wasi-extensions (#4394) * wamr-wasi-extensions: separate test scripts also, allow to specify the prefix directory. for the convenience of the CI. * CI: build wamr-wasi-extensions fragments are copied from compilation_on_macos.yml. (thus intel copyright notice) * wasi_nn_openvino.c: fix a debug build (#4416) after "wasi_nn_openvino.c: implement multiple models per instance" change. (https://github.com/bytecodealliance/wasm-micro-runtime/pull/4380) * loader: fix a potential overflow issue (#4427) * CI: revert SGX retry attempts (#4421) * Revert "Improve spec test execution by adding retry logic for transient errors (#4393)" This reverts commit64cafaff1e. * Revert "Add error handling for sgx ci (#4222)" This reverts commit8ad47897d1. * implement extended const expr (#4318) * add a toggle to enable extended const on wamrc (#4412) --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Su Yihan <yihan.su@intel.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: YAMAMOTO Takashi <yamamoto@midokura.com> Co-authored-by: TianlongLiang <111852609+TianlongLiang@users.noreply.github.com> Co-authored-by: Liu Jia <jia3.liu@intel.com> Co-authored-by: liang.he <liang.he@intel.com> Co-authored-by: Su Yihan <yihan.su@intel.com>
901 lines
25 KiB
C
901 lines
25 KiB
C
/*
|
|
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
|
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
*/
|
|
|
|
#ifndef _AOT_RUNTIME_H_
|
|
#define _AOT_RUNTIME_H_
|
|
|
|
#include "bh_platform.h"
|
|
#include "../common/wasm_runtime_common.h"
|
|
#include "../interpreter/wasm_runtime.h"
|
|
#include "../compilation/aot.h"
|
|
#if WASM_ENABLE_GC != 0
|
|
#include "gc_export.h"
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* Wasm feature supported, mainly used by AOTTargetInfo now */
|
|
#define WASM_FEATURE_SIMD_128BIT (1 << 0)
|
|
#define WASM_FEATURE_BULK_MEMORY (1 << 1)
|
|
#define WASM_FEATURE_MULTI_THREAD (1 << 2)
|
|
#define WASM_FEATURE_REF_TYPES (1 << 3)
|
|
#define WASM_FEATURE_GARBAGE_COLLECTION (1 << 4)
|
|
#define WASM_FEATURE_EXCEPTION_HANDLING (1 << 5)
|
|
#define WASM_FEATURE_TINY_STACK_FRAME (1 << 6)
|
|
#define WASM_FEATURE_MULTI_MEMORY (1 << 7)
|
|
#define WASM_FEATURE_DYNAMIC_LINKING (1 << 8)
|
|
#define WASM_FEATURE_COMPONENT_MODEL (1 << 9)
|
|
#define WASM_FEATURE_RELAXED_SIMD (1 << 10)
|
|
#define WASM_FEATURE_FLEXIBLE_VECTORS (1 << 11)
|
|
/* Stack frame is created at the beginning of the function,
|
|
* and not at the beginning of each function call */
|
|
#define WASM_FEATURE_FRAME_PER_FUNCTION (1 << 12)
|
|
#define WASM_FEATURE_FRAME_NO_FUNC_IDX (1 << 13)
|
|
|
|
typedef enum AOTSectionType {
|
|
AOT_SECTION_TYPE_TARGET_INFO = 0,
|
|
AOT_SECTION_TYPE_INIT_DATA = 1,
|
|
AOT_SECTION_TYPE_TEXT = 2,
|
|
AOT_SECTION_TYPE_FUNCTION = 3,
|
|
AOT_SECTION_TYPE_EXPORT = 4,
|
|
AOT_SECTION_TYPE_RELOCATION = 5,
|
|
/*
|
|
* Note: We haven't had anything to use AOT_SECTION_TYPE_SIGNATURE.
|
|
* It's just reserved for possible module signing features.
|
|
*/
|
|
AOT_SECTION_TYPE_SIGNATURE = 6,
|
|
AOT_SECTION_TYPE_CUSTOM = 100,
|
|
} AOTSectionType;
|
|
|
|
typedef enum AOTCustomSectionType {
|
|
AOT_CUSTOM_SECTION_RAW = 0,
|
|
AOT_CUSTOM_SECTION_NATIVE_SYMBOL = 1,
|
|
AOT_CUSTOM_SECTION_ACCESS_CONTROL = 2,
|
|
AOT_CUSTOM_SECTION_NAME = 3,
|
|
AOT_CUSTOM_SECTION_STRING_LITERAL = 4,
|
|
} AOTCustomSectionType;
|
|
|
|
typedef struct AOTObjectDataSection {
|
|
char *name;
|
|
uint8 *data;
|
|
uint32 size;
|
|
#if WASM_ENABLE_WAMR_COMPILER != 0 || WASM_ENABLE_JIT != 0
|
|
bool is_name_allocated;
|
|
bool is_data_allocated;
|
|
#endif
|
|
} AOTObjectDataSection;
|
|
|
|
/* Relocation info */
|
|
typedef struct AOTRelocation {
|
|
uint64 relocation_offset;
|
|
int64 relocation_addend;
|
|
uint32 relocation_type;
|
|
char *symbol_name;
|
|
/* index in the symbol offset field */
|
|
uint32 symbol_index;
|
|
#if WASM_ENABLE_WAMR_COMPILER != 0 || WASM_ENABLE_JIT != 0
|
|
bool is_symbol_name_allocated;
|
|
#endif
|
|
} AOTRelocation;
|
|
|
|
/* Relocation Group */
|
|
typedef struct AOTRelocationGroup {
|
|
char *section_name;
|
|
/* index in the symbol offset field */
|
|
uint32 name_index;
|
|
uint32 relocation_count;
|
|
AOTRelocation *relocations;
|
|
#if WASM_ENABLE_WAMR_COMPILER != 0 || WASM_ENABLE_JIT != 0
|
|
bool is_section_name_allocated;
|
|
#endif
|
|
} AOTRelocationGroup;
|
|
|
|
/* AOT function instance */
|
|
typedef struct AOTFunctionInstance {
|
|
char *func_name;
|
|
uint32 func_index;
|
|
bool is_import_func;
|
|
union {
|
|
struct {
|
|
AOTFuncType *func_type;
|
|
/* function pointer linked */
|
|
void *func_ptr;
|
|
} func;
|
|
AOTImportFunc *func_import;
|
|
} u;
|
|
} AOTFunctionInstance;
|
|
|
|
/* Map of a function index to the element ith in
|
|
the export functions array */
|
|
typedef struct ExportFuncMap {
|
|
uint32 func_idx;
|
|
uint32 export_idx;
|
|
} ExportFuncMap;
|
|
|
|
typedef struct AOTModuleInstanceExtra {
|
|
DefPointer(const uint32 *, stack_sizes);
|
|
/*
|
|
* Adjusted shared heap based addr to simple the calculation
|
|
* in the aot code. The value is:
|
|
* shared_heap->base_addr - shared_heap->start_off
|
|
*/
|
|
DefPointer(uint8 *, shared_heap_base_addr_adj);
|
|
MemBound shared_heap_start_off;
|
|
|
|
WASMModuleInstanceExtraCommon common;
|
|
|
|
/**
|
|
* maps of func indexes to export func indexes, which
|
|
* is sorted by func index for a quick lookup and is
|
|
* created only when first time used.
|
|
*/
|
|
ExportFuncMap *export_func_maps;
|
|
AOTFunctionInstance **functions;
|
|
uint32 function_count;
|
|
#if WASM_ENABLE_MULTI_MODULE != 0
|
|
bh_list sub_module_inst_list_head;
|
|
bh_list *sub_module_inst_list;
|
|
WASMModuleInstanceCommon **import_func_module_insts;
|
|
#endif
|
|
|
|
#if WASM_ENABLE_SHARED_HEAP != 0
|
|
WASMSharedHeap *shared_heap;
|
|
#endif
|
|
} AOTModuleInstanceExtra;
|
|
|
|
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64)
|
|
typedef struct GOTItem {
|
|
uint32 func_idx;
|
|
struct GOTItem *next;
|
|
} GOTItem, *GOTItemList;
|
|
#endif
|
|
|
|
#if WASM_ENABLE_GC != 0
|
|
typedef struct LocalRefFlag {
|
|
uint32 local_ref_flag_cell_num;
|
|
uint8 *local_ref_flags;
|
|
} LocalRefFlag;
|
|
#endif
|
|
|
|
typedef struct AOTModule {
|
|
uint32 module_type;
|
|
|
|
/* the package version read from the AOT file */
|
|
uint32 package_version;
|
|
|
|
/* import memories */
|
|
uint32 import_memory_count;
|
|
AOTImportMemory *import_memories;
|
|
|
|
/* memory info */
|
|
uint32 memory_count;
|
|
AOTMemory *memories;
|
|
|
|
/* init data */
|
|
uint32 mem_init_data_count;
|
|
AOTMemInitData **mem_init_data_list;
|
|
|
|
/* native symbol */
|
|
void **native_symbol_list;
|
|
|
|
/* import tables */
|
|
uint32 import_table_count;
|
|
AOTImportTable *import_tables;
|
|
|
|
/* tables */
|
|
uint32 table_count;
|
|
AOTTable *tables;
|
|
|
|
/* table init data info */
|
|
uint32 table_init_data_count;
|
|
AOTTableInitData **table_init_data_list;
|
|
|
|
/* type info */
|
|
uint32 type_count;
|
|
AOTType **types;
|
|
|
|
/* import global variable info */
|
|
uint32 import_global_count;
|
|
AOTImportGlobal *import_globals;
|
|
|
|
/* global variable info */
|
|
uint32 global_count;
|
|
AOTGlobal *globals;
|
|
|
|
/* total global variable size */
|
|
uint32 global_data_size;
|
|
|
|
/* import function info */
|
|
uint32 import_func_count;
|
|
AOTImportFunc *import_funcs;
|
|
|
|
/* function info */
|
|
uint32 func_count;
|
|
/* func pointers of AOTed (un-imported) functions */
|
|
void **func_ptrs;
|
|
/* func type indexes of AOTed (un-imported) functions */
|
|
uint32 *func_type_indexes;
|
|
#if WASM_ENABLE_AOT_STACK_FRAME != 0
|
|
/* max local cell nums of AOTed (un-imported) functions */
|
|
uint32 *max_local_cell_nums;
|
|
/* max stack cell nums of AOTed (un-imported) functions */
|
|
uint32 *max_stack_cell_nums;
|
|
#endif
|
|
|
|
#if WASM_ENABLE_GC != 0
|
|
/* params + locals ref flags of (both import and AOTed) functions */
|
|
LocalRefFlag *func_local_ref_flags;
|
|
#endif
|
|
|
|
/* export info */
|
|
uint32 export_count;
|
|
AOTExport *exports;
|
|
|
|
/* start function index, -1 denotes no start function */
|
|
uint32 start_func_index;
|
|
/* start function, point to AOTed function */
|
|
void *start_function;
|
|
|
|
uint32 malloc_func_index;
|
|
uint32 free_func_index;
|
|
uint32 retain_func_index;
|
|
|
|
/* AOTed code */
|
|
void *code;
|
|
uint32 code_size;
|
|
|
|
/* literal for AOTed code */
|
|
uint8 *literal;
|
|
uint32 literal_size;
|
|
|
|
#if defined(BH_PLATFORM_WINDOWS)
|
|
/* extra plt data area for __ymm, __xmm and __real constants
|
|
in Windows platform */
|
|
uint8 *extra_plt_data;
|
|
uint32 extra_plt_data_size;
|
|
uint32 ymm_plt_count;
|
|
uint32 xmm_plt_count;
|
|
uint32 real_plt_count;
|
|
uint32 float_plt_count;
|
|
#endif
|
|
|
|
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64)
|
|
uint32 got_item_count;
|
|
GOTItemList got_item_list;
|
|
GOTItemList got_item_list_end;
|
|
void **got_func_ptrs;
|
|
#endif
|
|
|
|
/* data sections in AOT object file, including .data, .rodata
|
|
and .rodata.cstN. */
|
|
AOTObjectDataSection *data_sections;
|
|
uint32 data_section_count;
|
|
|
|
/* constant string set */
|
|
HashMap *const_str_set;
|
|
|
|
/* the index of auxiliary __data_end global,
|
|
-1 means unexported */
|
|
uint32 aux_data_end_global_index;
|
|
/* auxiliary __data_end exported by wasm app */
|
|
uint64 aux_data_end;
|
|
|
|
/* the index of auxiliary __heap_base global,
|
|
-1 means unexported */
|
|
uint32 aux_heap_base_global_index;
|
|
/* auxiliary __heap_base exported by wasm app */
|
|
uint64 aux_heap_base;
|
|
|
|
/* the index of auxiliary stack top global,
|
|
-1 means unexported */
|
|
uint32 aux_stack_top_global_index;
|
|
/* auxiliary stack bottom resolved */
|
|
uint64 aux_stack_bottom;
|
|
/* auxiliary stack size resolved */
|
|
uint32 aux_stack_size;
|
|
|
|
/* is indirect mode or not */
|
|
bool is_indirect_mode;
|
|
|
|
#if WASM_ENABLE_LIBC_WASI != 0
|
|
WASIArguments wasi_args;
|
|
bool import_wasi_api;
|
|
#endif
|
|
|
|
#if WASM_ENABLE_MULTI_MODULE != 0
|
|
/* TODO: add mutex for mutli-thread? */
|
|
bh_list import_module_list_head;
|
|
bh_list *import_module_list;
|
|
#endif
|
|
|
|
#if WASM_ENABLE_GC != 0
|
|
/* Ref types hash set */
|
|
HashMap *ref_type_set;
|
|
struct WASMRttType **rtt_types;
|
|
korp_mutex rtt_type_lock;
|
|
#if WASM_ENABLE_STRINGREF != 0
|
|
/* special rtts for stringref types
|
|
- stringref
|
|
- stringview_wtf8
|
|
- stringview_wtf16
|
|
- stringview_iter
|
|
*/
|
|
struct WASMRttType *stringref_rtts[4];
|
|
uint32 string_literal_count;
|
|
uint32 *string_literal_lengths;
|
|
const uint8 **string_literal_ptrs;
|
|
#endif
|
|
#endif
|
|
|
|
#if WASM_ENABLE_DEBUG_AOT != 0
|
|
void *elf_hdr;
|
|
uint32 elf_size;
|
|
#endif
|
|
#if WASM_ENABLE_CUSTOM_NAME_SECTION != 0
|
|
const char **aux_func_names;
|
|
uint32 *aux_func_indexes;
|
|
uint32 aux_func_name_count;
|
|
#endif
|
|
#if WASM_ENABLE_LOAD_CUSTOM_SECTION != 0
|
|
WASMCustomSection *custom_section_list;
|
|
#endif
|
|
|
|
/* user defined name */
|
|
char *name;
|
|
|
|
/* Whether the underlying wasm binary buffer can be freed */
|
|
bool is_binary_freeable;
|
|
|
|
/* `.data` sections merged into one mmaped to reduce the tlb cache miss */
|
|
uint8 *merged_data_sections;
|
|
uint32 merged_data_sections_size;
|
|
/* `.data` and `.text` sections merged into one large mmaped section */
|
|
uint8 *merged_data_text_sections;
|
|
uint32 merged_data_text_sections_size;
|
|
|
|
#if WASM_ENABLE_AOT_STACK_FRAME != 0
|
|
uint32 feature_flags;
|
|
#endif
|
|
} AOTModule;
|
|
|
|
#define AOTMemoryInstance WASMMemoryInstance
|
|
#define AOTTableInstance WASMTableInstance
|
|
#define AOTModuleInstance WASMModuleInstance
|
|
|
|
#if WASM_ENABLE_MULTI_MODULE != 0
|
|
#define AOTSubModInstNode WASMSubModInstNode
|
|
#endif
|
|
|
|
/* Target info, read from ELF header of object file */
|
|
typedef struct AOTTargetInfo {
|
|
/* Binary type, elf32l/elf32b/elf64l/elf64b */
|
|
uint16 bin_type;
|
|
/* ABI type */
|
|
uint16 abi_type;
|
|
/* Object file type */
|
|
uint16 e_type;
|
|
/* Architecture */
|
|
uint16 e_machine;
|
|
/* Object file version */
|
|
uint32 e_version;
|
|
/* Processor-specific flags */
|
|
uint32 e_flags;
|
|
/* Specify wasm features supported */
|
|
uint64 feature_flags;
|
|
/* Reserved */
|
|
uint64 reserved;
|
|
/* Arch name */
|
|
char arch[16];
|
|
} AOTTargetInfo;
|
|
|
|
typedef struct AOTFuncPerfProfInfo {
|
|
/* total execution time */
|
|
uint64 total_exec_time;
|
|
/* total execution count */
|
|
uint32 total_exec_cnt;
|
|
/* children execution time */
|
|
uint64 children_exec_time;
|
|
} AOTFuncPerfProfInfo;
|
|
|
|
/* AOT auxiliary call stack */
|
|
typedef struct AOTFrame {
|
|
/* The frame of the caller which is calling current function */
|
|
struct AOTFrame *prev_frame;
|
|
|
|
/* The non-imported function index of current function */
|
|
uintptr_t func_index;
|
|
|
|
/* Used when performance profiling is enabled */
|
|
uintptr_t time_started;
|
|
|
|
/* Used when performance profiling is enabled */
|
|
AOTFuncPerfProfInfo *func_perf_prof_info;
|
|
|
|
/* Instruction pointer: offset to the bytecode array */
|
|
uintptr_t ip_offset;
|
|
|
|
/* Operand stack top pointer of the current frame */
|
|
uint32 *sp;
|
|
|
|
/* Frame ref flags (GC only) */
|
|
uint8 *frame_ref;
|
|
|
|
/**
|
|
* Frame data, the layout is:
|
|
* local area: parameters and local variables
|
|
* stack area: wasm operand stack
|
|
* frame ref flags (GC only):
|
|
* whether each cell in local and stack area is a GC obj
|
|
* currently local's ref flags are stored in AOTModule,
|
|
* here we only reserve the padding bytes
|
|
*/
|
|
uint32 lp[1];
|
|
} AOTFrame;
|
|
|
|
#if WASM_ENABLE_STATIC_PGO != 0
|
|
/* The bitmaps fields in LLVMProfileRawHeader, LLVMProfileData,
|
|
* LLVMProfileData_64 all dummy fields, it's used in MC/DC code coverage
|
|
* instead of PGO. See https://llvm.org/docs/InstrProfileFormat.html#bitmap */
|
|
typedef struct LLVMProfileRawHeader {
|
|
uint64 magic;
|
|
uint64 version;
|
|
uint64 binary_ids_size;
|
|
uint64 num_prof_data;
|
|
uint64 padding_bytes_before_counters;
|
|
uint64 num_prof_counters;
|
|
uint64 padding_bytes_after_counters;
|
|
uint64 num_prof_bitmaps;
|
|
uint64 padding_bytes_after_bitmaps;
|
|
uint64 names_size;
|
|
uint64 counters_delta;
|
|
uint64 bitmap_delta;
|
|
uint64 names_delta;
|
|
uint64 value_kind_last;
|
|
} LLVMProfileRawHeader;
|
|
|
|
typedef struct ValueProfNode {
|
|
uint64 value;
|
|
uint64 count;
|
|
struct ValueProfNode *next;
|
|
} ValueProfNode;
|
|
|
|
/* The profiling data of data sections created by aot compiler and
|
|
used when profiling, the width of pointer can be 8 bytes (64-bit)
|
|
or 4 bytes (32-bit) */
|
|
typedef struct LLVMProfileData {
|
|
uint64 func_md5;
|
|
uint64 func_hash;
|
|
uint64 offset_counters;
|
|
uint64 offset_bitmaps;
|
|
uintptr_t func_ptr;
|
|
ValueProfNode **values;
|
|
uint32 num_counters;
|
|
uint16 num_value_sites[2];
|
|
uint32 num_bitmaps;
|
|
} LLVMProfileData;
|
|
|
|
/* The profiling data for writing to the output file, the width of
|
|
pointer is 8 bytes suppose we always use wamrc and llvm-profdata
|
|
with 64-bit mode */
|
|
typedef struct LLVMProfileData_64 {
|
|
uint64 func_md5;
|
|
uint64 func_hash;
|
|
uint64 offset_counters;
|
|
uint64 offset_bitmaps;
|
|
uint64 func_ptr;
|
|
uint64 values;
|
|
uint32 num_counters;
|
|
uint16 num_value_sites[2];
|
|
uint32 num_bitmaps;
|
|
} LLVMProfileData_64;
|
|
#endif /* end of WASM_ENABLE_STATIC_PGO != 0 */
|
|
|
|
/**
|
|
* Load a AOT module from aot file buffer
|
|
* @param buf the byte buffer which contains the AOT file data
|
|
* @param size the size of the buffer
|
|
* @param error_buf output of the error info
|
|
* @param error_buf_size the size of the error string
|
|
*
|
|
* @return return AOT module loaded, NULL if failed
|
|
*/
|
|
AOTModule *
|
|
aot_load_from_aot_file(const uint8 *buf, uint32 size, const LoadArgs *args,
|
|
char *error_buf, uint32 error_buf_size);
|
|
|
|
/**
|
|
* Load a AOT module from a specified AOT section list.
|
|
*
|
|
* @param section_list the section list which contains each section data
|
|
* @param error_buf output of the error info
|
|
* @param error_buf_size the size of the error string
|
|
*
|
|
* @return return AOT module loaded, NULL if failed
|
|
*/
|
|
AOTModule *
|
|
aot_load_from_sections(AOTSection *section_list, char *error_buf,
|
|
uint32 error_buf_size);
|
|
|
|
/**
|
|
* Unload a AOT module.
|
|
*
|
|
* @param module the module to be unloaded
|
|
*/
|
|
void
|
|
aot_unload(AOTModule *module);
|
|
|
|
/**
|
|
* Resolve symbols for an AOT module
|
|
*/
|
|
bool
|
|
aot_resolve_symbols(AOTModule *module);
|
|
|
|
/**
|
|
* Helper function to resolve a single function
|
|
*/
|
|
bool
|
|
aot_resolve_import_func(AOTModule *module, AOTImportFunc *import_func);
|
|
|
|
/**
|
|
* Instantiate a AOT module.
|
|
*
|
|
* @param module the AOT module to instantiate
|
|
* @param parent the parent module instance
|
|
* @param heap_size the default heap size of the module instance, a heap will
|
|
* be created besides the app memory space. Both wasm app and native
|
|
* function can allocate memory from the heap. If heap_size is 0, the
|
|
* default heap size will be used.
|
|
* @param error_buf buffer to output the error info if failed
|
|
* @param error_buf_size the size of the error buffer
|
|
*
|
|
* @return return the instantiated AOT module instance, NULL if failed
|
|
*/
|
|
AOTModuleInstance *
|
|
aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
|
|
WASMExecEnv *exec_env_main, uint32 stack_size, uint32 heap_size,
|
|
uint32 max_memory_pages, char *error_buf,
|
|
uint32 error_buf_size);
|
|
|
|
/**
|
|
* Deinstantiate a AOT module instance, destroy the resources.
|
|
*
|
|
* @param module_inst the AOT module instance to destroy
|
|
* @param is_sub_inst the flag of sub instance
|
|
*/
|
|
void
|
|
aot_deinstantiate(AOTModuleInstance *module_inst, bool is_sub_inst);
|
|
|
|
/**
|
|
* Lookup an exported function in the AOT module instance.
|
|
*
|
|
* @param module_inst the module instance
|
|
* @param name the name of the function
|
|
*
|
|
* @return the function instance found
|
|
*/
|
|
AOTFunctionInstance *
|
|
aot_lookup_function(const AOTModuleInstance *module_inst, const char *name);
|
|
|
|
/**
|
|
* Lookup an exported function in the AOT module instance with
|
|
* the function index.
|
|
*/
|
|
AOTFunctionInstance *
|
|
aot_lookup_function_with_idx(AOTModuleInstance *module_inst, uint32 func_idx);
|
|
|
|
AOTMemoryInstance *
|
|
aot_lookup_memory(AOTModuleInstance *module_inst, char const *name);
|
|
|
|
AOTMemoryInstance *
|
|
aot_get_default_memory(AOTModuleInstance *module_inst);
|
|
|
|
AOTMemoryInstance *
|
|
aot_get_memory_with_idx(AOTModuleInstance *module_inst, uint32 mem_idx);
|
|
|
|
/**
|
|
* Get a function in the AOT module instance.
|
|
*
|
|
* @param module_inst the module instance
|
|
* @param func_idx the index of the function
|
|
*
|
|
* @return the function instance found
|
|
*/
|
|
AOTFunctionInstance *
|
|
aot_get_function_instance(AOTModuleInstance *module_inst, uint32 func_idx);
|
|
|
|
/**
|
|
* Call the given AOT function of a AOT module instance with
|
|
* arguments.
|
|
*
|
|
* @param exec_env the execution environment
|
|
* @param function the function to be called
|
|
* @param argc the number of arguments
|
|
* @param argv the arguments. If the function method has return value,
|
|
* the first (or first two in case 64-bit return value) element of
|
|
* argv stores the return value of the called AOT function after this
|
|
* function returns.
|
|
*
|
|
* @return true if success, false otherwise and exception will be thrown,
|
|
* the caller can call aot_get_exception to get exception info.
|
|
*/
|
|
bool
|
|
aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
|
|
unsigned argc, uint32 argv[]);
|
|
|
|
/**
|
|
* Set AOT module instance exception with exception string
|
|
*
|
|
* @param module the AOT module instance
|
|
*
|
|
* @param exception current exception string
|
|
*/
|
|
void
|
|
aot_set_exception(AOTModuleInstance *module_inst, const char *exception);
|
|
|
|
void
|
|
aot_set_exception_with_id(AOTModuleInstance *module_inst, uint32 id);
|
|
|
|
/**
|
|
* Get exception info of the AOT module instance.
|
|
*
|
|
* @param module_inst the AOT module instance
|
|
*
|
|
* @return the exception string
|
|
*/
|
|
const char *
|
|
aot_get_exception(AOTModuleInstance *module_inst);
|
|
|
|
/**
|
|
* @brief Copy exception in buffer passed as parameter. Thread-safe version of
|
|
* `aot_get_exception()`
|
|
* @note Buffer size must be no smaller than EXCEPTION_BUF_LEN
|
|
* @return true if exception found, false otherwise
|
|
*/
|
|
bool
|
|
aot_copy_exception(AOTModuleInstance *module_inst, char *exception_buf);
|
|
|
|
uint64
|
|
aot_module_malloc_internal(AOTModuleInstance *module_inst, WASMExecEnv *env,
|
|
uint64 size, void **p_native_addr);
|
|
|
|
uint64
|
|
aot_module_realloc_internal(AOTModuleInstance *module_inst, WASMExecEnv *env,
|
|
uint64 ptr, uint64 size, void **p_native_addr);
|
|
|
|
void
|
|
aot_module_free_internal(AOTModuleInstance *module_inst, WASMExecEnv *env,
|
|
uint64 ptr);
|
|
|
|
uint64
|
|
aot_module_malloc(AOTModuleInstance *module_inst, uint64 size,
|
|
void **p_native_addr);
|
|
|
|
uint64
|
|
aot_module_realloc(AOTModuleInstance *module_inst, uint64 ptr, uint64 size,
|
|
void **p_native_addr);
|
|
|
|
void
|
|
aot_module_free(AOTModuleInstance *module_inst, uint64 ptr);
|
|
|
|
uint64
|
|
aot_module_dup_data(AOTModuleInstance *module_inst, const char *src,
|
|
uint64 size);
|
|
|
|
bool
|
|
aot_enlarge_memory(AOTModuleInstance *module_inst, uint32 inc_page_count);
|
|
|
|
bool
|
|
aot_enlarge_memory_with_idx(AOTModuleInstance *module_inst,
|
|
uint32 inc_page_count, uint32 memidx);
|
|
|
|
/**
|
|
* Invoke native function from aot code
|
|
*/
|
|
bool
|
|
aot_invoke_native(WASMExecEnv *exec_env, uint32 func_idx, uint32 argc,
|
|
uint32 *argv);
|
|
|
|
bool
|
|
aot_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 table_elem_idx,
|
|
uint32 argc, uint32 *argv);
|
|
|
|
/**
|
|
* Check whether the app address and the buf is inside the linear memory,
|
|
* and convert the app address into native address
|
|
*/
|
|
bool
|
|
aot_check_app_addr_and_convert(AOTModuleInstance *module_inst, bool is_str,
|
|
uint64 app_buf_addr, uint64 app_buf_size,
|
|
void **p_native_addr);
|
|
|
|
uint32
|
|
aot_get_plt_table_size(void);
|
|
|
|
void *
|
|
aot_memmove(void *dest, const void *src, size_t n);
|
|
|
|
void *
|
|
aot_memset(void *s, int c, size_t n);
|
|
|
|
double
|
|
aot_sqrt(double x);
|
|
|
|
float
|
|
aot_sqrtf(float x);
|
|
|
|
#if WASM_ENABLE_BULK_MEMORY != 0
|
|
bool
|
|
aot_memory_init(AOTModuleInstance *module_inst, uint32 seg_index, uint32 offset,
|
|
uint32 len, size_t dst);
|
|
|
|
bool
|
|
aot_data_drop(AOTModuleInstance *module_inst, uint32 seg_index);
|
|
#endif
|
|
|
|
#if WASM_ENABLE_THREAD_MGR != 0
|
|
bool
|
|
aot_set_aux_stack(WASMExecEnv *exec_env, uint64 start_offset, uint32 size);
|
|
|
|
bool
|
|
aot_get_aux_stack(WASMExecEnv *exec_env, uint64 *start_offset, uint32 *size);
|
|
#endif
|
|
|
|
void
|
|
aot_get_module_mem_consumption(const AOTModule *module,
|
|
WASMModuleMemConsumption *mem_conspn);
|
|
|
|
void
|
|
aot_get_module_inst_mem_consumption(const AOTModuleInstance *module_inst,
|
|
WASMModuleInstMemConsumption *mem_conspn);
|
|
|
|
#if WASM_ENABLE_REF_TYPES != 0 || WASM_ENABLE_GC != 0
|
|
void
|
|
aot_drop_table_seg(AOTModuleInstance *module_inst, uint32 tbl_seg_idx);
|
|
|
|
void
|
|
aot_table_init(AOTModuleInstance *module_inst, uint32 tbl_idx,
|
|
uint32 tbl_seg_idx, uint32 length, uint32 src_offset,
|
|
uint32 dst_offset);
|
|
|
|
void
|
|
aot_table_copy(AOTModuleInstance *module_inst, uint32 src_tbl_idx,
|
|
uint32 dst_tbl_idx, uint32 length, uint32 src_offset,
|
|
uint32 dst_offset);
|
|
|
|
void
|
|
aot_table_fill(AOTModuleInstance *module_inst, uint32 tbl_idx, uint32 length,
|
|
table_elem_type_t val, uint32 data_offset);
|
|
|
|
uint32
|
|
aot_table_grow(AOTModuleInstance *module_inst, uint32 tbl_idx,
|
|
uint32 inc_entries, table_elem_type_t init_val);
|
|
#endif
|
|
|
|
bool
|
|
aot_alloc_frame(WASMExecEnv *exec_env, uint32 func_index);
|
|
|
|
void
|
|
aot_free_frame(WASMExecEnv *exec_env);
|
|
|
|
void
|
|
aot_frame_update_profile_info(WASMExecEnv *exec_env, bool alloc_frame);
|
|
|
|
bool
|
|
aot_create_call_stack(struct WASMExecEnv *exec_env);
|
|
|
|
#if WASM_ENABLE_COPY_CALL_STACK != 0
|
|
uint32
|
|
aot_copy_callstack(WASMExecEnv *exec_env, WASMCApiFrame *buffer,
|
|
const uint32 length, const uint32 skip_n, char *error_buf,
|
|
uint32_t error_buf_size);
|
|
#endif // WASM_ENABLE_COPY_CALL_STACK
|
|
|
|
/**
|
|
* @brief Dump wasm call stack or get the size
|
|
*
|
|
* @param exec_env the execution environment
|
|
* @param print whether to print to stdout or not
|
|
* @param buf buffer to store the dumped content
|
|
* @param len length of the buffer
|
|
*
|
|
* @return when print is true, return the bytes printed out to stdout; when
|
|
* print is false and buf is NULL, return the size required to store the
|
|
* callstack content; when print is false and buf is not NULL, return the size
|
|
* dumped to the buffer, 0 means error and data in buf may be invalid
|
|
*/
|
|
uint32
|
|
aot_dump_call_stack(WASMExecEnv *exec_env, bool print, char *buf, uint32 len);
|
|
|
|
void
|
|
aot_dump_perf_profiling(const AOTModuleInstance *module_inst);
|
|
|
|
double
|
|
aot_summarize_wasm_execute_time(const AOTModuleInstance *inst);
|
|
|
|
double
|
|
aot_get_wasm_func_exec_time(const AOTModuleInstance *inst,
|
|
const char *func_name);
|
|
|
|
const uint8 *
|
|
aot_get_custom_section(const AOTModule *module, const char *name, uint32 *len);
|
|
|
|
const void *
|
|
aot_get_data_section_addr(AOTModule *module, const char *section_name,
|
|
uint32 *p_data_size);
|
|
|
|
#if WASM_ENABLE_STATIC_PGO != 0
|
|
void
|
|
llvm_profile_instrument_target(uint64 target_value, void *data,
|
|
uint32 counter_idx);
|
|
|
|
void
|
|
llvm_profile_instrument_memop(uint64 target_value, void *data,
|
|
uint32 counter_idx);
|
|
|
|
uint32
|
|
aot_get_pgo_prof_data_size(AOTModuleInstance *module_inst);
|
|
|
|
uint32
|
|
aot_dump_pgo_prof_data_to_buf(AOTModuleInstance *module_inst, char *buf,
|
|
uint32 len);
|
|
|
|
void
|
|
aot_exchange_uint16(uint8 *p_data);
|
|
|
|
void
|
|
aot_exchange_uint32(uint8 *p_data);
|
|
|
|
void
|
|
aot_exchange_uint64(uint8 *p_data);
|
|
#endif /* end of WASM_ENABLE_STATIC_PGO != 0 */
|
|
|
|
#if WASM_ENABLE_GC != 0
|
|
void *
|
|
aot_create_func_obj(AOTModuleInstance *module_inst, uint32 func_idx,
|
|
bool throw_exce, char *error_buf, uint32 error_buf_size);
|
|
|
|
bool
|
|
aot_obj_is_instance_of(AOTModuleInstance *module_inst, WASMObjectRef gc_obj,
|
|
uint32 type_index);
|
|
|
|
/* Whether func type1 is one of super types of func type2 */
|
|
bool
|
|
aot_func_type_is_super_of(AOTModuleInstance *module_inst, uint32 type_idx1,
|
|
uint32 type_idx2);
|
|
|
|
WASMRttTypeRef
|
|
aot_rtt_type_new(AOTModuleInstance *module_inst, uint32 type_index);
|
|
|
|
bool
|
|
aot_array_init_with_data(AOTModuleInstance *module_inst, uint32 seg_index,
|
|
uint32 data_seg_offset, WASMArrayObjectRef array_obj,
|
|
uint32 elem_size, uint32 array_len);
|
|
|
|
bool
|
|
aot_traverse_gc_rootset(WASMExecEnv *exec_env, void *heap);
|
|
#endif /* end of WASM_ENABLE_GC != 0 */
|
|
|
|
char *
|
|
aot_const_str_set_insert(const uint8 *str, int32 len, AOTModule *module,
|
|
#if (WASM_ENABLE_WORD_ALIGN_READ != 0)
|
|
bool is_vram_word_align,
|
|
#endif
|
|
char *error_buf, uint32 error_buf_size);
|
|
|
|
bool
|
|
aot_set_module_name(AOTModule *module, const char *name, char *error_buf,
|
|
uint32_t error_buf_size);
|
|
|
|
const char *
|
|
aot_get_module_name(AOTModule *module);
|
|
|
|
#ifdef __cplusplus
|
|
} /* end of extern "C" */
|
|
#endif
|
|
|
|
#endif /* end of _AOT_RUNTIME_H_ */
|