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>
728 lines
19 KiB
C
728 lines
19 KiB
C
/*
|
|
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
|
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
*/
|
|
|
|
#ifndef _CONFIG_H_
|
|
#define _CONFIG_H_
|
|
|
|
/* clang-format off */
|
|
#if !defined(BUILD_TARGET_X86_64) \
|
|
&& !defined(BUILD_TARGET_AMD_64) \
|
|
&& !defined(BUILD_TARGET_AARCH64) \
|
|
&& !defined(BUILD_TARGET_X86_32) \
|
|
&& !defined(BUILD_TARGET_ARM) \
|
|
&& !defined(BUILD_TARGET_ARM_VFP) \
|
|
&& !defined(BUILD_TARGET_THUMB) \
|
|
&& !defined(BUILD_TARGET_THUMB_VFP) \
|
|
&& !defined(BUILD_TARGET_MIPS) \
|
|
&& !defined(BUILD_TARGET_XTENSA) \
|
|
&& !defined(BUILD_TARGET_RISCV64_LP64D) \
|
|
&& !defined(BUILD_TARGET_RISCV64_LP64) \
|
|
&& !defined(BUILD_TARGET_RISCV32_ILP32D) \
|
|
&& !defined(BUILD_TARGET_RISCV32_ILP32F) \
|
|
&& !defined(BUILD_TARGET_RISCV32_ILP32) \
|
|
&& !defined(BUILD_TARGET_ARC)
|
|
/* clang-format on */
|
|
#if defined(__x86_64__) || defined(__x86_64)
|
|
#define BUILD_TARGET_X86_64
|
|
#elif defined(__amd64__) || defined(__amd64)
|
|
#define BUILD_TARGET_AMD_64
|
|
#elif defined(__aarch64__)
|
|
#define BUILD_TARGET_AARCH64
|
|
#elif defined(__i386__) || defined(__i386) || defined(i386)
|
|
#define BUILD_TARGET_X86_32
|
|
#elif defined(__thumb__)
|
|
#define BUILD_TARGET_THUMB
|
|
#define BUILD_TARGET "THUMBV4T"
|
|
#elif defined(__arm__)
|
|
#define BUILD_TARGET_ARM
|
|
#define BUILD_TARGET "ARMV4T"
|
|
#elif defined(__mips__) || defined(__mips) || defined(mips)
|
|
#define BUILD_TARGET_MIPS
|
|
#elif defined(__XTENSA__)
|
|
#define BUILD_TARGET_XTENSA
|
|
#elif defined(__riscv) && (__riscv_xlen == 64)
|
|
#define BUILD_TARGET_RISCV64_LP64D
|
|
#elif defined(__riscv) && (__riscv_xlen == 32) && !defined(__riscv_flen)
|
|
#define BUILD_TARGET_RISCV32_ILP32
|
|
#elif defined(__riscv) && (__riscv_xlen == 32) && (__riscv_flen == 32)
|
|
#define BUILD_TARGET_RISCV32_ILP32F
|
|
#elif defined(__riscv) && (__riscv_xlen == 32) && (__riscv_flen == 64)
|
|
#define BUILD_TARGET_RISCV32_ILP32D
|
|
#elif defined(__arc__)
|
|
#define BUILD_TARGET_ARC
|
|
#else
|
|
#error "Build target isn't set"
|
|
#endif
|
|
#endif
|
|
|
|
#ifndef BH_DEBUG
|
|
#define BH_DEBUG 0
|
|
#endif
|
|
|
|
#define MEM_ALLOCATOR_EMS 0
|
|
#define MEM_ALLOCATOR_TLSF 1
|
|
|
|
/* Default memory allocator */
|
|
#define DEFAULT_MEM_ALLOCATOR MEM_ALLOCATOR_EMS
|
|
|
|
#ifndef WASM_ENABLE_INTERP
|
|
#define WASM_ENABLE_INTERP 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_AOT
|
|
#define WASM_ENABLE_AOT 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_DYNAMIC_AOT_DEBUG
|
|
#define WASM_ENABLE_DYNAMIC_AOT_DEBUG 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_WORD_ALIGN_READ
|
|
#define WASM_ENABLE_WORD_ALIGN_READ 0
|
|
#endif
|
|
|
|
#define AOT_MAGIC_NUMBER 0x746f6100
|
|
#define AOT_CURRENT_VERSION 4
|
|
|
|
#ifndef WASM_ENABLE_JIT
|
|
#define WASM_ENABLE_JIT 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_LAZY_JIT
|
|
#define WASM_ENABLE_LAZY_JIT 0
|
|
#endif
|
|
|
|
#ifndef WASM_ORC_JIT_BACKEND_THREAD_NUM
|
|
/* The number of backend threads created by runtime */
|
|
#define WASM_ORC_JIT_BACKEND_THREAD_NUM 4
|
|
#endif
|
|
|
|
#if WASM_ORC_JIT_BACKEND_THREAD_NUM < 1
|
|
#error "WASM_ORC_JIT_BACKEND_THREAD_NUM must be greater than 0"
|
|
#endif
|
|
|
|
#ifndef WASM_ORC_JIT_COMPILE_THREAD_NUM
|
|
/* The number of compilation threads created by LLVM JIT */
|
|
#define WASM_ORC_JIT_COMPILE_THREAD_NUM 4
|
|
#endif
|
|
|
|
#if WASM_ORC_JIT_COMPILE_THREAD_NUM < 1
|
|
#error "WASM_ORC_JIT_COMPILE_THREAD_NUM must be greater than 0"
|
|
#endif
|
|
|
|
#if (WASM_ENABLE_AOT == 0) && (WASM_ENABLE_JIT != 0)
|
|
/* LLVM JIT can only be enabled when AOT is enabled */
|
|
#undef WASM_ENABLE_JIT
|
|
#define WASM_ENABLE_JIT 0
|
|
|
|
#undef WASM_ENABLE_LAZY_JIT
|
|
#define WASM_ENABLE_LAZY_JIT 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_FAST_JIT
|
|
#define WASM_ENABLE_FAST_JIT 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_FAST_JIT_DUMP
|
|
#define WASM_ENABLE_FAST_JIT_DUMP 0
|
|
#endif
|
|
|
|
#ifndef FAST_JIT_DEFAULT_CODE_CACHE_SIZE
|
|
#define FAST_JIT_DEFAULT_CODE_CACHE_SIZE 10 * 1024 * 1024
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_WAMR_COMPILER
|
|
#define WASM_ENABLE_WAMR_COMPILER 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_LIBC_BUILTIN
|
|
#define WASM_ENABLE_LIBC_BUILTIN 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_LIBC_WASI
|
|
#define WASM_ENABLE_LIBC_WASI 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_UVWASI
|
|
#define WASM_ENABLE_UVWASI 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_WASI_NN
|
|
#define WASM_ENABLE_WASI_NN 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_WASI_NN_GPU
|
|
#define WASM_ENABLE_WASI_NN_GPU 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_WASI_NN_EXTERNAL_DELEGATE
|
|
#define WASM_ENABLE_WASI_NN_EXTERNAL_DELEGATE 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_WASI_EPHEMERAL_NN
|
|
#define WASM_ENABLE_WASI_EPHEMERAL_NN 0
|
|
#endif
|
|
|
|
/* Default disable libc emcc */
|
|
#ifndef WASM_ENABLE_LIBC_EMCC
|
|
#define WASM_ENABLE_LIBC_EMCC 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_LIB_RATS
|
|
#define WASM_ENABLE_LIB_RATS 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_LIB_PTHREAD
|
|
#define WASM_ENABLE_LIB_PTHREAD 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_LIB_PTHREAD_SEMAPHORE
|
|
#define WASM_ENABLE_LIB_PTHREAD_SEMAPHORE 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_LIB_WASI_THREADS
|
|
#define WASM_ENABLE_LIB_WASI_THREADS 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_HEAP_AUX_STACK_ALLOCATION
|
|
#define WASM_ENABLE_HEAP_AUX_STACK_ALLOCATION WASM_ENABLE_LIB_WASI_THREADS
|
|
#elif WASM_ENABLE_HEAP_AUX_STACK_ALLOCATION == 0 \
|
|
&& WASM_ENABLE_LIB_WASI_THREADS == 1
|
|
#error "Heap aux stack allocation must be enabled for WASI threads"
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_COPY_CALL_STACK
|
|
#define WASM_ENABLE_COPY_CALL_STACK 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_BASE_LIB
|
|
#define WASM_ENABLE_BASE_LIB 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_APP_FRAMEWORK
|
|
#define WASM_ENABLE_APP_FRAMEWORK 0
|
|
#endif
|
|
|
|
#ifndef WASM_HAVE_MREMAP
|
|
#define WASM_HAVE_MREMAP 0
|
|
#endif
|
|
|
|
/* Bulk memory operation */
|
|
#ifndef WASM_ENABLE_BULK_MEMORY
|
|
#define WASM_ENABLE_BULK_MEMORY 0
|
|
#endif
|
|
|
|
/* Shared memory */
|
|
#ifndef WASM_ENABLE_SHARED_MEMORY
|
|
#define WASM_ENABLE_SHARED_MEMORY 0
|
|
#endif
|
|
|
|
/* Thread manager */
|
|
#ifndef WASM_ENABLE_THREAD_MGR
|
|
#define WASM_ENABLE_THREAD_MGR 0
|
|
#endif
|
|
|
|
/* Source debugging */
|
|
#ifndef WASM_ENABLE_DEBUG_INTERP
|
|
#define WASM_ENABLE_DEBUG_INTERP 0
|
|
#endif
|
|
|
|
#if WASM_ENABLE_DEBUG_INTERP != 0
|
|
#ifndef DEBUG_EXECUTION_MEMORY_SIZE
|
|
/* 0x85000 is the size required by lldb, if this is changed to a smaller value,
|
|
* then the debugger will not be able to evaluate user expressions, other
|
|
* functionality such as breakpoint and stepping are not influenced by this */
|
|
#define DEBUG_EXECUTION_MEMORY_SIZE 0x85000
|
|
#endif
|
|
#endif /* end of WASM_ENABLE_DEBUG_INTERP != 0 */
|
|
|
|
#ifndef WASM_ENABLE_DEBUG_AOT
|
|
#define WASM_ENABLE_DEBUG_AOT 0
|
|
#endif
|
|
|
|
/* Custom sections */
|
|
#ifndef WASM_ENABLE_LOAD_CUSTOM_SECTION
|
|
#define WASM_ENABLE_LOAD_CUSTOM_SECTION 0
|
|
#endif
|
|
|
|
/* WASM log system */
|
|
#ifndef WASM_ENABLE_LOG
|
|
#define WASM_ENABLE_LOG 1
|
|
#endif
|
|
|
|
/* When this flag is set, WAMR will not automatically
|
|
* initialize sockets on Windows platforms. The host
|
|
* application is responsible for calling WSAStartup()
|
|
* before executing WAMR code that uses sockets, and
|
|
* calling WSACleanup() after.
|
|
* This flag passes control of socket initialization from
|
|
* WAMR to the host application. */
|
|
#ifndef WASM_ENABLE_HOST_SOCKET_INIT
|
|
#define WASM_ENABLE_HOST_SOCKET_INIT 0
|
|
#endif
|
|
|
|
#ifndef WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS
|
|
#if defined(BUILD_TARGET_X86_32) || defined(BUILD_TARGET_X86_64) \
|
|
|| defined(BUILD_TARGET_AARCH64)
|
|
#define WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS 1
|
|
#else
|
|
#define WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS 0
|
|
#endif
|
|
#endif
|
|
|
|
/* WASM Interpreter labels-as-values feature */
|
|
#ifndef WASM_ENABLE_LABELS_AS_VALUES
|
|
#ifdef __GNUC__
|
|
#define WASM_ENABLE_LABELS_AS_VALUES 1
|
|
#else
|
|
#define WASM_ENABLE_LABELS_AS_VALUES 0
|
|
#endif
|
|
#endif
|
|
|
|
/* Enable fast interpreter or not */
|
|
#ifndef WASM_ENABLE_FAST_INTERP
|
|
#define WASM_ENABLE_FAST_INTERP 0
|
|
#endif
|
|
|
|
#if WASM_ENABLE_FAST_INTERP != 0
|
|
#define WASM_DEBUG_PREPROCESSOR 0
|
|
#endif
|
|
|
|
/* Enable opcode counter or not */
|
|
#ifndef WASM_ENABLE_OPCODE_COUNTER
|
|
#define WASM_ENABLE_OPCODE_COUNTER 0
|
|
#endif
|
|
|
|
/* Support a module with dependency, other modules */
|
|
#ifndef WASM_ENABLE_MULTI_MODULE
|
|
#define WASM_ENABLE_MULTI_MODULE 0
|
|
#endif
|
|
|
|
/* Enable wasm mini loader or not */
|
|
#ifndef WASM_ENABLE_MINI_LOADER
|
|
#define WASM_ENABLE_MINI_LOADER 0
|
|
#endif
|
|
|
|
/* Disable boundary check with hardware trap or not,
|
|
* enable it by default if it is supported */
|
|
#ifndef WASM_DISABLE_HW_BOUND_CHECK
|
|
#define WASM_DISABLE_HW_BOUND_CHECK 0
|
|
#endif
|
|
|
|
/* Disable native stack access boundary check with hardware
|
|
* trap or not, enable it by default if it is supported */
|
|
#ifndef WASM_DISABLE_STACK_HW_BOUND_CHECK
|
|
#define WASM_DISABLE_STACK_HW_BOUND_CHECK 0
|
|
#endif
|
|
|
|
/* Disable SIMD unless it is manually enabled somewhere */
|
|
#ifndef WASM_ENABLE_SIMD
|
|
#define WASM_ENABLE_SIMD 0
|
|
#endif
|
|
|
|
/* Disable SIMDe (used in the fast interpreter for SIMD opcodes)
|
|
unless used elsewhere */
|
|
#ifndef WASM_ENABLE_SIMDE
|
|
#define WASM_ENABLE_SIMDE 0
|
|
#endif
|
|
|
|
/* GC performance profiling */
|
|
#ifndef WASM_ENABLE_GC_PERF_PROFILING
|
|
#define WASM_ENABLE_GC_PERF_PROFILING 0
|
|
#endif
|
|
|
|
/* Memory profiling */
|
|
#ifndef WASM_ENABLE_MEMORY_PROFILING
|
|
#define WASM_ENABLE_MEMORY_PROFILING 0
|
|
#endif
|
|
|
|
/* Memory tracing */
|
|
#ifndef WASM_ENABLE_MEMORY_TRACING
|
|
#define WASM_ENABLE_MEMORY_TRACING 0
|
|
#endif
|
|
|
|
/* Performance profiling */
|
|
#ifndef WASM_ENABLE_PERF_PROFILING
|
|
#define WASM_ENABLE_PERF_PROFILING 0
|
|
#endif
|
|
|
|
/* Dump call stack */
|
|
#ifndef WASM_ENABLE_DUMP_CALL_STACK
|
|
#define WASM_ENABLE_DUMP_CALL_STACK 0
|
|
#endif
|
|
|
|
/* AOT stack frame */
|
|
#ifndef WASM_ENABLE_AOT_STACK_FRAME
|
|
#define WASM_ENABLE_AOT_STACK_FRAME 0
|
|
#endif
|
|
|
|
/* Heap verification */
|
|
#ifndef BH_ENABLE_GC_VERIFY
|
|
#define BH_ENABLE_GC_VERIFY 0
|
|
#endif
|
|
|
|
/* Heap corruption check, enabled by default */
|
|
#ifndef BH_ENABLE_GC_CORRUPTION_CHECK
|
|
#define BH_ENABLE_GC_CORRUPTION_CHECK 1
|
|
#endif
|
|
|
|
/* Enable global heap pool if heap verification is enabled */
|
|
#if BH_ENABLE_GC_VERIFY != 0
|
|
#define WASM_ENABLE_GLOBAL_HEAP_POOL 1
|
|
#endif
|
|
|
|
/* Global heap pool */
|
|
#ifndef WASM_ENABLE_GLOBAL_HEAP_POOL
|
|
#define WASM_ENABLE_GLOBAL_HEAP_POOL 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_SPEC_TEST
|
|
#define WASM_ENABLE_SPEC_TEST 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_WASI_TEST
|
|
#define WASM_ENABLE_WASI_TEST 0
|
|
#endif
|
|
|
|
/* Global heap pool size in bytes */
|
|
#ifndef WASM_GLOBAL_HEAP_SIZE
|
|
#define WASM_GLOBAL_HEAP_SIZE (10 * 1024 * 1024)
|
|
#endif
|
|
|
|
/* Default length of queue */
|
|
#ifndef DEFAULT_QUEUE_LENGTH
|
|
#define DEFAULT_QUEUE_LENGTH 50
|
|
#endif
|
|
|
|
/* The max percentage of global heap that app memory space can grow */
|
|
#ifndef APP_MEMORY_MAX_GLOBAL_HEAP_PERCENT
|
|
#define APP_MEMORY_MAX_GLOBAL_HEAP_PERCENT 1 / 3
|
|
#endif
|
|
|
|
/* Default min/max heap size of each app */
|
|
#ifndef APP_HEAP_SIZE_DEFAULT
|
|
#define APP_HEAP_SIZE_DEFAULT (8 * 1024)
|
|
#endif
|
|
#define APP_HEAP_SIZE_MIN (256)
|
|
/* The ems memory allocator supports maximal heap size 1GB,
|
|
see ems_gc_internal.h */
|
|
#define APP_HEAP_SIZE_MAX (1024 * 1024 * 1024)
|
|
|
|
/* Default min/max gc heap size of each app */
|
|
#ifndef GC_HEAP_SIZE_DEFAULT
|
|
#define GC_HEAP_SIZE_DEFAULT (128 * 1024)
|
|
#endif
|
|
#define GC_HEAP_SIZE_MIN (4 * 1024)
|
|
#define GC_HEAP_SIZE_MAX (1024 * 1024 * 1024)
|
|
|
|
/* Default wasm stack size of each app */
|
|
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64)
|
|
#define DEFAULT_WASM_STACK_SIZE (16 * 1024)
|
|
#else
|
|
#define DEFAULT_WASM_STACK_SIZE (12 * 1024)
|
|
#endif
|
|
/* Min auxiliary stack size of each wasm thread */
|
|
#define WASM_THREAD_AUX_STACK_SIZE_MIN (256)
|
|
|
|
/* Default/min native stack size of each app thread */
|
|
#if !(defined(APP_THREAD_STACK_SIZE_DEFAULT) \
|
|
&& defined(APP_THREAD_STACK_SIZE_MIN))
|
|
#if defined(BH_PLATFORM_ZEPHYR) || defined(BH_PLATFORM_ALIOS_THINGS) \
|
|
|| defined(BH_PLATFORM_ESP_IDF) || defined(BH_PLATFORM_OPENRTOS)
|
|
#define APP_THREAD_STACK_SIZE_DEFAULT (6 * 1024)
|
|
#define APP_THREAD_STACK_SIZE_MIN (4 * 1024)
|
|
#elif defined(PTHREAD_STACK_DEFAULT) && defined(PTHREAD_STACK_MIN)
|
|
#define APP_THREAD_STACK_SIZE_DEFAULT PTHREAD_STACK_DEFAULT
|
|
#define APP_THREAD_STACK_SIZE_MIN PTHREAD_STACK_MIN
|
|
#elif WASM_ENABLE_UVWASI != 0
|
|
/* UVWASI requires larger native stack */
|
|
#define APP_THREAD_STACK_SIZE_DEFAULT (64 * 1024)
|
|
#define APP_THREAD_STACK_SIZE_MIN (48 * 1024)
|
|
#else
|
|
#define APP_THREAD_STACK_SIZE_DEFAULT (128 * 1024)
|
|
#define APP_THREAD_STACK_SIZE_MIN (24 * 1024)
|
|
#endif
|
|
#endif /* end of !(defined(APP_THREAD_STACK_SIZE_DEFAULT) \
|
|
&& defined(APP_THREAD_STACK_SIZE_MIN)) */
|
|
|
|
/* Max native stack size of each app thread */
|
|
#if !defined(APP_THREAD_STACK_SIZE_MAX)
|
|
#define APP_THREAD_STACK_SIZE_MAX (8 * 1024 * 1024)
|
|
#endif
|
|
|
|
/* Reserved bytes to the native thread stack boundary, throw native
|
|
* stack overflow exception if the guard boundary is reached
|
|
*
|
|
* WASM_STACK_GUARD_SIZE needs to be large enough for:
|
|
*
|
|
* - native functions
|
|
*
|
|
* w/o hw bound check, the overhead (aot_call_function etc) + the native
|
|
* function itself. as of writing this, the former is about 1000 bytes
|
|
* on macOS amd64.
|
|
*
|
|
* with hw bound check, theoretically, only needs to cover the logic to
|
|
* set up the jmp_buf stack.
|
|
*
|
|
* - aot runtime functions
|
|
* eg. aot_enlarge_memory.
|
|
*
|
|
* - w/o hw bound check, the interpreter loop
|
|
*
|
|
* the stack consumption heavily depends on compiler settings,
|
|
* especially for huge functions like the classic interpreter's
|
|
* wasm_interp_call_func_bytecode:
|
|
*
|
|
* 200 bytes (release build, macOS/amd64)
|
|
* 2600 bytes (debug build, macOS/amd64)
|
|
*
|
|
* - platform-provided functions (eg. libc)
|
|
*
|
|
* the following are examples of the stack consumptions observed for
|
|
* host APIs.
|
|
*
|
|
* snprintf: (used by eg. wasm_runtime_set_exception)
|
|
* - about 1600 bytes on macOS/amd64
|
|
* - about 2000 bytes on Ubuntu amd64 20.04
|
|
*
|
|
* gethostbyname:
|
|
* - 3KB-6KB on macOS/amd64
|
|
* - 10KB on Ubuntu amd64 20.04
|
|
*
|
|
* getaddrinfo:
|
|
* - 4KB-17KB on macOS/amd64
|
|
* - 12KB on Ubuntu amd64 20.04
|
|
* - 0.3-1.5KB on NuttX/esp32s3
|
|
*
|
|
* - stack check wrapper functions generated by the aot compiler
|
|
* (--stack-bounds-checks=1)
|
|
*
|
|
* wamrc issues a warning
|
|
* "precheck functions themselves consume relatively large amount of stack"
|
|
* when it detects wrapper functions requiring more than 1KB.
|
|
*
|
|
* - the ABI-defined red zone. eg. 128 bytes for SYSV x86-64 ABI.
|
|
* cf. https://en.wikipedia.org/wiki/Red_zone_(computing)
|
|
*
|
|
* Note: on platforms with lazy function binding, don't forget to consider
|
|
* the symbol resolution overhead on the first call. For example,
|
|
* on Ubuntu amd64 20.04, it seems to consume about 1500 bytes.
|
|
* For some reasons, macOS amd64 12.7.4 seems to resolve symbols eagerly.
|
|
* (Observed with a binary with traditional non-chained fixups.)
|
|
* The latest macOS seems to apply chained fixups in kernel on page-in time.
|
|
* (thus it wouldn't consume userland stack.)
|
|
*/
|
|
#ifndef WASM_STACK_GUARD_SIZE
|
|
#if WASM_ENABLE_UVWASI != 0
|
|
/* UVWASI requires larger native stack */
|
|
#define WASM_STACK_GUARD_SIZE (4096 * 6)
|
|
#else
|
|
/*
|
|
* Use a larger default for platforms like macOS/Linux.
|
|
*
|
|
* For example, the classic interpreter loop which ended up with a trap
|
|
* (wasm_runtime_set_exception) would consume about 2KB stack on x86-64
|
|
* macOS. On Ubuntu amd64 20.04, it seems to consume a bit more.
|
|
*
|
|
* Although product-mini/platforms/nuttx always overrides
|
|
* WASM_STACK_GUARD_SIZE, exclude NuttX here just in case.
|
|
*/
|
|
#if defined(__APPLE__) || (defined(__unix__) && !defined(__NuttX__))
|
|
#if BH_DEBUG != 0 /* assumption: BH_DEBUG matches CMAKE_BUILD_TYPE=Debug */
|
|
#define WASM_STACK_GUARD_SIZE (1024 * 5)
|
|
#else
|
|
#define WASM_STACK_GUARD_SIZE (1024 * 3)
|
|
#endif
|
|
#else
|
|
/*
|
|
* Otherwise, assume very small requirement for now.
|
|
*
|
|
* Embedders for very small devices likely fine-tune WASM_STACK_GUARD_SIZE
|
|
* for their specific applications anyway.
|
|
*/
|
|
#define WASM_STACK_GUARD_SIZE 1024
|
|
#endif
|
|
#endif
|
|
#endif
|
|
|
|
/* Guard page count for stack overflow check with hardware trap */
|
|
#ifndef STACK_OVERFLOW_CHECK_GUARD_PAGE_COUNT
|
|
#if defined(__APPLE__) && defined(__aarch64__)
|
|
/* Note: on macOS/iOS arm64, the user page size is 16KB */
|
|
#define STACK_OVERFLOW_CHECK_GUARD_PAGE_COUNT 1
|
|
#else
|
|
#define STACK_OVERFLOW_CHECK_GUARD_PAGE_COUNT 3
|
|
#endif
|
|
#endif
|
|
|
|
/* Default wasm block address cache size and conflict list size */
|
|
#ifndef BLOCK_ADDR_CACHE_SIZE
|
|
#define BLOCK_ADDR_CACHE_SIZE 64
|
|
#endif
|
|
#define BLOCK_ADDR_CONFLICT_SIZE 2
|
|
|
|
/* Default max thread num per cluster. Can be overwrite by
|
|
wasm_runtime_set_max_thread_num */
|
|
#define CLUSTER_MAX_THREAD_NUM 4
|
|
|
|
#ifndef WASM_ENABLE_TAIL_CALL
|
|
#define WASM_ENABLE_TAIL_CALL 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_CUSTOM_NAME_SECTION
|
|
#define WASM_ENABLE_CUSTOM_NAME_SECTION 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_REF_TYPES
|
|
#define WASM_ENABLE_REF_TYPES 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_GC
|
|
#define WASM_ENABLE_GC 0
|
|
#endif
|
|
|
|
#ifndef WASM_CONST_EXPR_STACK_SIZE
|
|
#if WASM_ENABLE_GC != 0
|
|
#define WASM_CONST_EXPR_STACK_SIZE 8
|
|
#else
|
|
#define WASM_CONST_EXPR_STACK_SIZE 4
|
|
#endif
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_STRINGREF
|
|
#define WASM_ENABLE_STRINGREF 0
|
|
#endif
|
|
|
|
#ifndef GC_REFTYPE_MAP_SIZE_DEFAULT
|
|
#define GC_REFTYPE_MAP_SIZE_DEFAULT 64
|
|
#endif
|
|
|
|
#ifndef GC_RTTOBJ_MAP_SIZE_DEFAULT
|
|
#define GC_RTTOBJ_MAP_SIZE_DEFAULT 64
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_EXCE_HANDLING
|
|
#define WASM_ENABLE_EXCE_HANDLING 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_TAGS
|
|
#define WASM_ENABLE_TAGS 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_SGX_IPFS
|
|
#define WASM_ENABLE_SGX_IPFS 0
|
|
#endif
|
|
|
|
#ifndef WASM_MEM_ALLOC_WITH_USER_DATA
|
|
#define WASM_MEM_ALLOC_WITH_USER_DATA 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_WASM_CACHE
|
|
#define WASM_ENABLE_WASM_CACHE 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_STATIC_PGO
|
|
#define WASM_ENABLE_STATIC_PGO 0
|
|
#endif
|
|
|
|
/* Disable writing linear memory base address to GS segment register,
|
|
by default only in linux x86-64, linear memory base addr is written
|
|
to GS segment register before calling wasm/aot function. */
|
|
#ifndef WASM_DISABLE_WRITE_GS_BASE
|
|
#define WASM_DISABLE_WRITE_GS_BASE 0
|
|
#endif
|
|
|
|
/* Configurable bounds checks */
|
|
#ifndef WASM_CONFIGURABLE_BOUNDS_CHECKS
|
|
#define WASM_CONFIGURABLE_BOUNDS_CHECKS 0
|
|
#endif
|
|
|
|
/* Some chip cannot support external ram with rwx attr at the same time,
|
|
it has to map it into 2 spaces of idbus and dbus, code in dbus can be
|
|
read/written and read/executed in ibus. so there are 2 steps to execute
|
|
the code, first, copy & do relocation in dbus space, and second execute
|
|
it in ibus space, since in the 2 spaces the contents are the same,
|
|
so we call it bus mirror.
|
|
*/
|
|
#ifndef WASM_MEM_DUAL_BUS_MIRROR
|
|
#define WASM_MEM_DUAL_BUS_MIRROR 0
|
|
#endif
|
|
|
|
/* The max number of module instance contexts. */
|
|
#ifndef WASM_MAX_INSTANCE_CONTEXTS
|
|
#define WASM_MAX_INSTANCE_CONTEXTS 8
|
|
#endif
|
|
|
|
/* linux perf support */
|
|
#ifndef WASM_ENABLE_LINUX_PERF
|
|
#define WASM_ENABLE_LINUX_PERF 0
|
|
#endif
|
|
|
|
/* Support registering quick AOT/JIT function entries of some func types
|
|
to speed up the calling process of invoking the AOT/JIT functions of
|
|
these types from the host embedder */
|
|
#ifndef WASM_ENABLE_QUICK_AOT_ENTRY
|
|
#define WASM_ENABLE_QUICK_AOT_ENTRY 1
|
|
#endif
|
|
|
|
/* Support AOT intrinsic functions which can be called from the AOT code
|
|
when `--disable-llvm-intrinsics` flag or
|
|
`--enable-builtin-intrinsics=<intr1,intr2,...>` is used by wamrc to
|
|
generate the AOT file */
|
|
#ifndef WASM_ENABLE_AOT_INTRINSICS
|
|
#define WASM_ENABLE_AOT_INTRINSICS 1
|
|
#endif
|
|
|
|
/* Disable memory64 by default */
|
|
#ifndef WASM_ENABLE_MEMORY64
|
|
#define WASM_ENABLE_MEMORY64 0
|
|
#endif
|
|
|
|
/* Disable multi-memory by default */
|
|
#ifndef WASM_ENABLE_MULTI_MEMORY
|
|
#define WASM_ENABLE_MULTI_MEMORY 0
|
|
#endif
|
|
|
|
#ifndef WASM_TABLE_MAX_SIZE
|
|
#define WASM_TABLE_MAX_SIZE 1024
|
|
#endif
|
|
|
|
#ifndef WASM_MEM_ALLOC_WITH_USAGE
|
|
#define WASM_MEM_ALLOC_WITH_USAGE 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_FUZZ_TEST
|
|
#define WASM_ENABLE_FUZZ_TEST 0
|
|
#endif
|
|
|
|
#if WASM_ENABLE_FUZZ_TEST != 0
|
|
#ifndef WASM_MEM_ALLOC_MAX_SIZE
|
|
/* In oss-fuzz, the maximum RAM is ~2.5G */
|
|
#define WASM_MEM_ALLOC_MAX_SIZE (2U * 1024 * 1024 * 1024)
|
|
#endif
|
|
#endif /* WASM_ENABLE_FUZZ_TEST != 0 */
|
|
|
|
#ifndef WASM_ENABLE_SHARED_HEAP
|
|
#define WASM_ENABLE_SHARED_HEAP 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_SHRUNK_MEMORY
|
|
#define WASM_ENABLE_SHRUNK_MEMORY 1
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_AOT_VALIDATOR
|
|
#define WASM_ENABLE_AOT_VALIDATOR 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_INSTRUCTION_METERING
|
|
#define WASM_ENABLE_INSTRUCTION_METERING 0
|
|
#endif
|
|
|
|
#ifndef WASM_ENABLE_EXTENDED_CONST_EXPR
|
|
#define WASM_ENABLE_EXTENDED_CONST_EXPR 0
|
|
#endif
|
|
|
|
#endif /* end of _CONFIG_H_ */
|