Просмотр исходного кода

Sync with main branch (#4872)

* fix: improve test case handling in test_wamr.sh (#4708)

Correct the error introduced by de4b950.

* wamr/arm: Add CFI directives to Thumb VFP assembly for better debugging (#4697)

Add Call Frame Information (CFI) directives to invokeNative_thumb_vfp.s
to improve stack unwinding and debugging capabilities on ARM platforms.
This enables better backtrace generation and crash analysis.

Changes include:
- Add .cfi_startproc/.cfi_endproc directives for proper frame tracking
- Add .cfi_def_cfa_offset and .cfi_def_cfa to track stack pointer changes
- Add .cfi_offset directives to track saved register locations
- Convert local labels to use .L prefix following assembly conventions

These CFI directives allow debuggers and exception handlers to properly
unwind the stack through native function calls, improving the debugging
experience for WAMR applications on ARM targets.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>

* build(deps): Bump actions/upload-artifact from 4.6.2 to 5.0.0 (#4711)

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.6.2 to 5.0.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4.6.2...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): Bump actions/checkout from 3 to 5 (#4710)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v3...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): Bump github/codeql-action from 3.29.1 to 4.31.3 (#4709)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.1 to 4.31.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v3.29.1...v4.31.3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.31.3
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Adding additional text around the resr requirement for code contributions to make supplying a test mandatory, except in exceptional situations. (#4713)

* Merge commit from fork

* Merge commit from fork

* fix: remove SIMD prefix handling from interpreter and update opcode definitions

* test: add case for classic interpreter handling of unsupported SIMD opcodes

* Fast-interp should report unsupported opcode (#4723)

when meeting simd opcode on non-posix platforms

* refactor: Improve debug experience with CFI directives and proper label naming in Thumb invokeNative (#4719)

This change enhances debugging support and improves assembly code quality:

1. Add CFI (Call Frame Information) directives (.cfi_startproc, .cfi_def_cfa_offset, .cfi_offset, .cfi_endproc) to provide proper call frame information for debuggers
2. Improve label naming by using dot-prefixed conventions (.Lreturn, .Lcall_func, etc.) following assembly best practices

These improvements enhance debugging capabilities and code maintainability while preserving functionality.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>

* chore: update NuttX version to 12.11 in CI workflows (#4720)

The NuttX project released version 12.11 with improvements and bug fixes.
Updating the CI workflows to use the latest stable version ensures that
WAMR testing and compilation verification runs against the most current
NuttX release.

Updated 4 repository references total across 2 workflow files to point to
the new release branch.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>

* ci: add raspberrypi-pico-2 to nuttx build matrix (#4721)

Add Raspberry Pi Pico 2 (Cortex-M33) board configuration to the NuttX CI build matrix to ensure WAMR compatibility testing covers the Cortex-M33 platform. The board configuration path "boards/arm/rp23xx/raspberrypi-pico-2/configs/nsh" is inserted after the cortex-m7 configuration to maintain logical architecture ordering.

* add a set of apis to configure wasi via InstantiationArgs2 (#4707)

* track if WASIArguments is configured by user

i plan to use this to decide which wasi arguments
(the one from module or the one from InstantiationArgs2)
to use.

* add WASIArguments to InstantiationArgs2

* use wasi configuration from InstantiationArgs2 if any

fallback to the via-module configuration for now.

* add a few api to configure wasi via InstantiationArgs2

* configure wasi via InstantiationArgs2 for platforms using libc_wasi.c

* rt-thread: migrate to libc_wasi_set_init_args

* common/libc_wasi.c: retire libc_wasi_init

* fix build without wasi

* Namespace generated headers with zephyr/ (#4670)

* Namespace generated headers with zephyr/

---------

Signed-off-by: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com>

* build(deps): Bump github/codeql-action from 4.31.3 to 4.31.5 (#4727)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.31.3 to 4.31.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v4.31.3...v4.31.5)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.31.5
  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>

* Add support for esp32s2 target to idf_component.yml (#4728)

* build(deps): Bump actions/checkout from 5 to 6 (#4726)

Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Remove local fuzzing server (#4729)

The local fuzzing server is a feature that has not been used for a long
time and is currently unmaintained. Temporarily remove it from the
codebase, and restore it when needed.

* Update link to WASI Proposals.md (#4734)

* fix double promotion warning (#4731)

* chore: narrow CI workflow trigger scope for Zephyr compilation

Optimize GitHub Actions workflow execution by limiting triggers to only
changes in the compilation_on_zephyr.yml workflow file itself, reducing
unnecessary workflow runs when other .github files are modified.
* Update pull_request trigger paths to target specific workflow file
* Update push trigger paths to target specific workflow file
* Eliminates redundant CI runs for documentation and script changes

* build: disable CONFIG_RP23XX_UF2_BINARY in NuttX CI

Disable UF2 binary support for RP23XX boards in the compilation
workflow to resolve build issues and maintain consistency with
RP2040 board configuration.

* Added kconfig-tweak --disable CONFIG_RP23XX_UF2_BINARY
* Follows existing pattern for RP2040 boards
* Ensures successful compilation for rp23xx target

* Add missing functions from thumb arch (#4718)

Signed-off-by: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com>

* ci: update nuttx and nuttx-apps commits to fix CI build (#4736)

Update NuttX and nuttx-apps repository references from release tags to
specific commit hashes to resolve CI build failures.

* Updated nuttx from releases/12.11 to 09a71ec7c16c43398d5acbdcbeee7b08736c3170
* Updated nuttx-apps from releases/12.11 to 6bd593459c4af3cef325c3d22bccd5537a8ed755
* Preserved xtensa-specific commit logic in spec_test_on_nuttx.yml
* Applied changes to both compilation and spec test workflows

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>

* fix: enhance test case execution handling in test_wamr.sh (#4712)

* feat: add support for checking unsupported build configurations (#4690)

* feat: add support for checking unsupported build configurations
* docs: improve clarity and formatting in build_wamr.md
* feat: add check for unsupported SHARED_HEAP + FAST_JIT configuration and update documentation warning
* feat: disable default SIMD setting for 64-bit platform in CMake configuration
* feat: update Android and macOS workflows to handle SIMD support in classic interp mode
* feat: update SGX compilation workflow to handle unsupported FAST_JIT and classic interp mode without SIMD support
* feat: enhance check for unsupported CLASSIC_INTERP configurations
* feat: disable fast interpreter for shared heap tests and update unsupported features test library
* feat: enhance unsupported combination checks and update build configurations for JIT and SIMD
* In regression tests, use llvm-jit and fast-jit to replace multi-tier-jit + running mode. Multi-tier-jit contains both fast-jit and llvm-jit. Fast-jit doesn't support SIMD, but llvm-jit does. So, should multi-tier-jit support SIMD? My answer is NO.
  - The regular form of multi-tier-jit uses fast-jit as tier1 and llvm-jit as
    tier2. Therefore, if fast-jit doesn't support SIMD, the entire multi-tier
    doesn't support SIMD either.
  - `--fast-jit` and `--llvm-jit` of multi-tier-jit  should adhere to the global
    limitations of multi-tier-jit.
* Explicitly specify SIMD, MULTI_MODULE, and their unsupported running modes.
- SIMD and Ref. types are enabled by default on linux and darwin. So remove duplicate feature testing from CI
- Apply new configuration for wasm-c-api compilation commands

* build(deps): Bump actions/checkout from 5.0.1 to 6.0.0 (#4738)

Bumps [actions/checkout](https://github.com/actions/checkout) from 5.0.1 to 6.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v5.0.1...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): Bump github/codeql-action from 4.31.5 to 4.31.6 (#4739)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.31.5 to 4.31.6.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v4.31.5...v4.31.6)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.31.6
  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>

* build(deps): Bump actions/checkout from 6.0.0 to 6.0.1 (#4747)

Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.0 to 6.0.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v6...v6.0.1)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.1
  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>

* build(deps): Bump github/codeql-action from 4.31.6 to 4.31.7 (#4746)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.31.6 to 4.31.7.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v4.31.6...v4.31.7)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.31.7
  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>

* enable WAMR_BUILD_MULTI_MODULE to apply all wasm-vm unit tests (#4745)

Signed-off-by: zhenweijin <zhenwei.jin@intel.com>

* Add a runtime API for reset shared heap(chain) (#4740)

* add new runtime api for reset shared heap(chain)
* add new unit test case

* build(deps): Bump github/codeql-action from 4.31.7 to 4.31.8 (#4757)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.31.7 to 4.31.8.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v4.31.7...v4.31.8)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.31.8
  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>

* build(deps): Bump actions/cache from 4 to 5 (#4755)

Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): Bump actions/upload-artifact from 5.0.0 to 6.0.0 (#4756)

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5.0.0 to 6.0.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* add more unit test cases for interpreter (#4716)

Co-authored-by: ai-assistant

* feat: add documentation for the shared heap feature in WAMR (#4751)

* Ensure --addr-pool mask accepts numbers only (#4619)

* Ensure --addr-pool mask accepts numbers only
* Add mask validation
* Replace mask assignment position
* Use a thread-safe function and free allocated memory

Co-authored-by: liang.he <liang.he@intel.com>

* Fix nightly workflow matrix include duplication (#4761)

* build(deps): Bump github/codeql-action from 4.31.8 to 4.31.9 (#4767)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.31.8 to 4.31.9.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v4.31.8...v4.31.9)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.31.9
  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>

* Upgrade macos runner of CIs to 15 (#4770)

* fix: update macOS workflow configurations to use macos-15 and macos-15-intel
* fix: remove unsupported build options for macOS workflows

* Implicitly disable the SIMD flag for classic-interp and fast-jit (#4768)

* aot: avoid forcing mmap low addresses on NuttX (#4776)

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>

* fix: update CODEOWNERS to refine reviewer assignments (#4754)

* update wasm-tool smith generation parameters for improved testing (#4779)

* fix: Wrong compiler parameter on MSVC (#4778)

* fix: Wrong compiler parameter on MSVC
* refactor: Move gcc flags to common build script.
* refactor: Add both C/CXX flags

* update Dockerfile and devcontainer configuration (#4773)

The goal is to keep the devcontainer image minimal and its build time as fast as possible.
- Remove all rarely used tools.
- Change the base image to the latest template.
- Synchronize the WASI-SDK and WABT versions with those used by the CI.

Add libzstd for LLVM linking

* Improve tiered support system and compilation flags introduction. (#4750)

* docs: update tiered support documentation with detailed tier definitions and feature classifications and improved compilation flags and links for clarity
* update tiered support documentation to clarify feature support levels and enhance readability
  - Revised descriptions for Tier A to specify that features have been used in products.
  - Reformatted notes on testing, maintenance, and support definitions for better clarity.
  - Added a new section for privileged features with detailed explanations.
  - Updated tables for Tier A, Tier B, and Tier C to include additional targets and compilation flags.

* fix: clear exec_env_tls when destroying exec_env (#4774)

* fix: clear exec_env_tls when destroying exec_env

When an exec_env is destroyed, check if it matches the current thread's
exec_env_tls and clear it to avoid dangling pointer issues.

Without this fix, in daemon-style execution where the same thread runs
multiple WASM modules sequentially (like Cloudflare Workers), the
exec_env_tls can point to freed memory after an exec_env is destroyed,
causing crashes on subsequent executions when the signal handler tries
to access it.

This is critical for AOT mode with hardware bounds checking enabled,
where signal handlers rely on exec_env_tls to handle SIGSEGV properly.

* test(exec_env): add reproducer for exec_env_tls dangling pointer bug

Add test case that reproduces the bug where exec_env_tls is not cleared
on early return paths in invoke_native_with_hw_bound_check.

The test triggers native stack overflow check failure, which causes
wasm_runtime_call_wasm to return early after setting exec_env_tls but
without clearing it. This leaves exec_env_tls pointing to a destroyed
exec_env, causing subsequent calls to fail with "invalid exec env".

Test confirms the fix in wasm_exec_env_destroy correctly clears
exec_env_tls when destroying the exec_env it points to.

* fix(runtime): clear exec_env_tls on early return from stack overflow check

Move the fix to clear exec_env_tls at the source - in the early return
path of invoke_native_with_hw_bound_check when native stack overflow
check fails.

* fix(aot): reserve x18 register on macOS ARM64 (#4775)

* fix(aot): reserve x18 register on macOS ARM64

Apple reserves CPU register x18 for TLS on ARM64. When generating AOT
code for aarch64 on macOS, LLVM may use x18, causing crashes when the
AOT code runs on macOS ARM64 (M1/M2/M3).

This patch:
1. Detects darwin/macho ABI and sets correct vendor string
2. Detects darwin/apple in default triple for platform detection
3. Adds +reserve-x18 to LLVM target features for aarch64 on macOS

The fix only applies when compiling on macOS ARM64 hosts, ensuring
generated AOT code is compatible with Apple's platform requirements.

* test(aot): add x18 register reservation test for macOS ARM64

Add a standalone test to verify that the +reserve-x18 LLVM flag is
correctly applied when compiling AOT for macOS ARM64.

On macOS ARM64, x18 is reserved by Apple for TLS (Thread Local Storage).
Without the +reserve-x18 flag, LLVM may generate code that uses x18,
causing random SIGSEGV crashes (~80% crash rate in testing).

The test:
- Creates a WASM module with 24 local variables to stress register allocation
- Compiles to AOT with -O3 optimization (which would use x18 without the fix)
- Runs 1000 iterations to verify no crashes occur
- Only runs on macOS ARM64 (skipped on other platforms)

Test results:
- Without fix: 82/100 crash rate
- With fix: 0/100 crash rate (1000 iterations verified)

* fix: correct boundary check in dynamic_offset check (#4788)

correct boundary check in check_dynamic_offset_pop when dynamic_offset is 0. When dynamic_offset = 0, check_dynamic_offset_pop will always return true, which may wrongly update dynamic_offset.
also include a typo fix in SET_OPERAND_REF

Signed-off-by: zhenweijin <zhenwei.jin@intel.com>

* Add bh_strtok_r function (#4790)

* Fix alignment calculation for large offsets (#4791)

Signed-off-by: zhenweijin <zhenwei.jin@intel.com>

* build(deps): Bump github/codeql-action from 4.31.9 to 4.31.10 (#4794)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.31.9 to 4.31.10.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v4.31.9...v4.31.10)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.31.10
  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>

* Fix potential memory leak  when discarding FreeMachineFunction (#4796)

Signed-off-by: zhenweijin <zhenwei.jin@intel.com>

* fix: disable unsigned integer overflow sanitization (#4785)

* fix: disable unsigned integer overflow sanitization in build configurations

FYI: from https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html

`-fsanitize=unsigned-integer-overflow`: Unsigned integer overflow, where the result of an unsigned integer computation cannot be represented in its type. Unlike signed integer overflow, this is not undefined behavior, but it is often unintentional. This sanitizer does not check for lossy implicit conversions performed before such a computation.

It brings a more common question: which is better, pre-additional-check or post-additional-check to fix a potential unsigned integer overflow? A pre-additional-check involves using a check to prevent integer overflow from the very beginning. A post-additional-check involves using a check after addition to see if there is an overflow.

In this project, post-additional-checking is widely used. let's follow the routine.

for performance sensitive logic, use __builtin_add_overflow etc. provide something like https://github.com/yamt/toywasm/blob/9a5622791e99395e26e6e96cef830af3d91a1685/lib/platform.h#L176-L191 and encourage the use of them.

ref. https://github.com/bytecodealliance/wasm-micro-runtime/pull/4549#issuecomment-3218687294

* fix: ensure proper definition checks for build options in CMakeLists of wasm-mutator
* optimize how to involve sanitizer flags
* fix: update LLVM branch and refine sanitizer flags in CMake configurations
* fix: add requests package to development requirements

* [devcontainer] install ocmal stuff (#4798)

For gc proposal spec test

* Fix memory leak in GC when rootset enumeration fails (#4793)

Signed-off-by: zhenweijin <zhenwei.jin@intel.com>

* Fix memcpy overlap issue in RECOVER_BR_INFO for i64/v128 copy (#4797)

When copying single i64 or V128 values in RECOVER_BR_INFO, source and
destination memory regions may overlap, causing memcpy-param-overlap errors

Use temporary variables to separate read and write operations, preventing
the overlap issue.

This fix references the approach used in the other path (when arity != 1), which calls copy_stack_values, that function explicitly handles memcpy overlap.

Signed-off-by: zhenweijin <zhenwei.jin@intel.com>

* language-bindings/go: upgrade yaml.v3 (#4799)

Upgrade github.com/stretchr/testify from v1.7.0 to v1.11.1,
and upgrade gopkg.in/yaml.v3 to v3.0.1

This fixes CVE-2022-28948 in yaml v3.0.0

Signed-off-by: Haitao Huang <haitaohuang@microsoft.com>

* fix code and comment typo (#4802)

* Correct some error handling path in libc_emcc (#4803)

* build(deps): Bump github/codeql-action from 4.31.10 to 4.31.11 (#4810)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.31.10 to 4.31.11.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v4.31.10...v4.31.11)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.31.11
  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>

* build(deps): Bump actions/checkout from 6.0.1 to 6.0.2 (#4809)

Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v6.0.1...v6.0.2)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.2
  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>

* gc: complete common heap type coverage in wasm_is_refheaptype_common() (#4801)

Signed-off-by: zhenweijin <zhenwei.jin@intel.com>

* refactor: update clang-tidy configuration for improved checks and error handling (#4811)

* Collective fix (#4808)

* fix a bug in zephyr platform file api
* fix a bug in bh queue
* fix a bug in shared heap malloc when it's memory64

* fix some typo in wamrc (#4807)

* build(deps): Bump github/codeql-action from 4.31.11 to 4.32.0 (#4823)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.31.11 to 4.32.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v4.31.11...v4.32.0)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.32.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>

* ci: allow .clang-tidy and fix exception type in guidelines check (#4818)

Signed-off-by: zhenweijin <zhenwei.jin@intel.com>

* Fix a compilation error about calling os_atomic_cmpxchg (#4822)

```
/workspaces/wasm-micro-runtime/core/iwasm/aot/aot_runtime.c:4701:30: error: expected expression
return os_atomic_cmpxchg(_Atomic(void *)ptr, &old_val, new_val);
^
/workspaces/wasm-micro-runtime/core/shared/utils/../platform/include/platform_api_extension.h:135:27: note: expanded from macro 'os_atomic_cmpxchg'
```

* disable the misc-no-recursion checker (#4821)

* Fixed build of Go language bindings (#4825)

* Reduce warnings relevant to Zephyr platform (#4658)

This PR is intended to remove following warnings, when build in Zephyr application:

wasm-micro-runtime/core/shared/platform/zephyr/platform_internal.h:293: warning: "CLOCK_MONOTONIC" redefined
  293 | #define CLOCK_MONOTONIC 4
wasm-micro-runtime/core/shared/platform/zephyr/zephyr_file.c: In function 'zephyr_fs_alloc_obj':
wasm-micro-runtime/core/shared/platform/zephyr/zephyr_file.c:123:25: warning: implicit declaration of function 'bh_strdup' [-Wimplicit-function-declaration]
  123 |             ptr->path = bh_strdup(path);
      |                         ^~~~~~~~~
wasm-micro-runtime/core/shared/platform/zephyr/zephyr_file.c:123:23: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  123 |             ptr->path = bh_strdup(path);
      |                       ^
wasm-micro-runtime/core/shared/platform/zephyr/zephyr_file.c: In function 'os_renameat':
wasm-micro-runtime/core/shared/platform/zephyr/zephyr_file.c:853:35: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  853 |             char *new_path_copy = bh_strdup(new_path);
      |                                   ^~~~~~~~~
[45/462] Building C object CMakeFiles/app.dir/wasm-micro-runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c.obj
wasm-micro-runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c: In function 'wasmtime_ssp_poll_oneoff':
wasm-micro-runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c:2216:42: warning: initialization of 'os_file_handle' {aka 'struct zephyr_handle *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
 2216 |                     os_file_handle tfd = fos[i]->file_handle->fd;
      |                                          ^~~
wasm-micro-runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c:2222:31: warning: initialization of 'int' from 'os_file_handle' {aka 'struct zephyr_handle *'} makes integer from pointer without a cast [-Wint-conversion]
 2222 |                         .fd = tfd,
      |                               ^~~
wasm-micro-runtime/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c:2222:31: note: (near initialization for '(anonymous).fd')

---------

Signed-off-by: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com>

* Fix compilation error when MSVC is not set to C11 standard (#4588)

* Fix compilation error when MSVC is not set to C11 standard

* align quick_aot_entry invoke_* signatures with call sites (#4829)

Signed-off-by: zhenweijin <zhenwei.jin@intel.com>

* build(deps): Bump github/codeql-action from 4.32.0 to 4.32.2 (#4831)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.32.0 to 4.32.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v4.32.0...v4.32.2)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.32.2
  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>

* Fix off-by-one in AOT func_index bounds checks (#4836)

The AOT relocation loader validates func_index using:
  (func_index = (uint32)atoi(p)) > module->func_count

Since func_ptrs is an array of func_count elements (indices 0 to
func_count-1), func_index == func_count is out of bounds. The check
must use >= instead of > to reject this boundary case.

Fix all 4 affected locations in aot_loader.c.

* Improve shared_heap test cases. (#4834)

Aligned allocation size can be significantly greater than the original size,
and page size varies across platforms.

> macOS on M1 (Apple Silicon) uses a memory page size of 16,384 bytes (16 KB).
> This differs from the traditional 4 KB page size used on Intel Macs and many
> other ARM64 systems, and is designed to improve performance by reducing page
> table overhead and allowing for better cache utilization.

* build(deps): Bump github/codeql-action from 4.32.2 to 4.32.3 (#4838)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.32.2 to 4.32.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v4.32.2...v4.32.3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.32.3
  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>

* Fix typo in README from WARM to WAMR (#4843)

Guessing this was supposed to WAMR not WARM

* build(deps): Bump github/codeql-action from 4.32.3 to 4.32.4 (#4840)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.32.3 to 4.32.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v4.32.3...v4.32.4)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.32.4
  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>

* Improve zephyr's networking code (#4839)

* fix: zephyr sockets: fix get/set sockopt usages.

In multiple places, setsockopt is used when getsockopt shall be used, and vice-versa.
Additionally, pointer isn't checked correctly in two places, this commit fixes those as well.
Per man(7), most socket-level options utilize an int argument for optval. Use those for ttl.

Signed-off-by: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com>

* feat: zephyr sockets: implement missing networking functions

Some of the optvals are implemented by zephyr, some are missing.
Call the appropriate function and let set the retval based on that.

Signed-off-by: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com>

* fix: WASM_API_EXTERN should get visibility("default") on gcc and clang (#4851)

This allows the wasm_c_api to work in shared libraries on non-Windows
platforms.

* Fix sock_connect using wrong rights constant (#4849)

wasi_ssp_sock_connect checks __WASI_RIGHT_SOCK_BIND instead of
__WASI_RIGHT_SOCK_CONNECT when validating file descriptor rights.
This was a copy-paste error from wasi_ssp_sock_bind. As a result,
connect operations check the wrong capability.

* windows: fix vectored exception handler lifecycle for repeated thread env init/destroy (#4842)

* Fix Windows VEH registration/removal lifecycle
* Remove redundant OS_THREAD_MUTEX_INITIALIZER guards

Since the code is already inside #ifdef BH_PLATFORM_WINDOWS,
the macro is always defined. Use NULL directly for clarity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* build(deps): Bump actions/upload-artifact from 6.0.0 to 7.0.0 (#4859)

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6.0.0 to 7.0.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): Bump github/codeql-action from 4.32.4 to 4.32.5 (#4858)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.32.4 to 4.32.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v4.32.4...v4.32.5)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.32.5
  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>

* Add bounds checking for output tensor buffer in wasi-nn llama.cpp (#4847)

* Add bounds checking for output tensor buffer in wasi-nn llama.cpp

The get_output function copies LLM output into output_tensor->buf
without checking against output_tensor->size, allowing writes
past the buffer when the model generates output longer than the
caller-provided buffer. Add size checks for both the metadata
path and the token output loop.

Instead of silently truncating output when the buffer is too small,
return the too_large error with a diagnostic message. This makes the
behavior consistent with the OpenVINO backend's get_output and allows
callers to distinguish between successful completion and insufficient
buffer size.

* Fix a compilation error by clang-17 (#4812)

* Fix a compilation error by clang-17

```
variable-sized object may not be initialized
```

clang-17 is the default version on MacOS Tahoe(26.2) on AppleM1

* fix: update shared_heap_test to use os_getpagesize for memory size calculations (#4852)

* workaround: prevent usage of anyref in struct fields and array elements (#4819)

Disable corresponding cases in spec test

* Fix off-by-one in aot_alloc_tiny_frame overflow check (#4845)

* Fix off-by-one in aot_alloc_tiny_frame overflow check

The boundary check in aot_alloc_tiny_frame only verifies that
new_frame itself doesn't exceed top_boundary, but doesn't account
for the sizeof(AOTTinyFrame) bytes that are about to be written.
When new_frame equals top_boundary exactly, the check passes but
the subsequent write to new_frame->func_index goes past the
boundary. This matches the correct pattern used in
aot_alloc_frame (line 4086) which includes the frame size.

* clean(zephyr): reduce warnings on zephyr platform (#4860)

* clean(warnings): fix [-Wsign-compare] in zephyr_file

buf_len is a long unsigned int, while bytes_* can be negative due to error values.
We don't need to check bytes_* for negative value, as it was done during read/write op.

* clean(warnings): fix "MIN" redefined warning

Some platforms, like Zephyr, already define MIN and definition in WAMR cause
`warning: "MIN" redefined` warning.
Check if it was defined before, and do not redefine it.

Signed-off-by: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com>

* fix(ems): avoid abort in gc_migrate when heap metadata is corrupted (#4862)

Signed-off-by: zhenweijin <zhenwei.jin@intel.com>

* Refactoring enclave sample (#4828)

* refactor(ci): production-ready SGX install script with logging and idempotency

- Add comprehensive logging infrastructure to /tmp/install_sgx.log
- Implement idempotency checks for SGX packages and SDK
- Modularize into functions: platform_detect, install_packages, validate_installation, cleanup
- Add strict error handling with set -euo pipefail and error traps
- Replace FIXME with proper environment sourcing documentation
- Add dynamic platform detection for Ubuntu 20+/Debian 11/12
- Ensure minimal console output (final status only) with all details in log
- Verify all acceptance scenarios pass with comprehensive testing

* Refactoring enclave-sample aligning sgx BKM.

- Buffer interface redesign to separate input and output
- prevent untrusted pointer
- add module and instance handle release functions for better resource management

* fuzz: remove unnecessary internal headers from wasm_mutator_fuzz (#4865)

Remove `wasm_runtime_common.h` and `bh_read_file.h` includes from the
wasm_mutator_fuzz harness. All runtime APIs used by this fuzzer
(wasm_runtime_init, wasm_runtime_load, wasm_runtime_instantiate,
wasm_runtime_call_wasm_a, wasm_runtime_get_export_count, etc.) are
declared in the public `wasm_export.h` header.

- `wasm_runtime_common.h` (core/iwasm/common/) is an internal
  implementation header not intended for external use.
- `bh_read_file.h` (core/shared/utils/uncommon/) is an internal
  utility header whose functions are never called in this fuzzer.

Verified that the modified harness compiles and runs correctly for all
three build targets (classic-interp, fast-interp, llvm-jit) with
identical code coverage.

* Fix missing IS_INVALID_TAGINDEX check in RETHROW handler (#4837)

* Fix RETHROW handler missing IS_INVALID_TAGINDEX check

Add validation for exception_tag_index in the RETHROW opcode handler
to prevent out-of-bounds access to module->module->tags[] when the
tag index is INVALID_TAGINDEX (0xFFFFFFFF). This matches the existing
check in the THROW handler.

When CATCH_ALL catches a cross-module exception with an unknown tag,
it pushes INVALID_TAGINDEX onto the stack. Without this check, a
subsequent RETHROW would access tags[0xFFFFFFFF].

* Fix incorrect code section byte counts in exception handling test

The hand-crafted WASM binary in load_module_with_exception_handling had
an off-by-one in the code section: body size was declared as 7 but the
actual body (local count + try/catch_all/end/end) is only 6 bytes.
This caused the WASM loader to fail with "unexpected end" when it tried
to read past the available bytes.

Fix the body size from 7 to 6 and the code section size from 9 to 8.

* Fix relocation addend sign extension on 32-bit platforms (#4846)

* Fix relocation addend sign extension on 32-bit platforms

When loading relocations on 32-bit platforms, the addend is read
as uint32 and zero-extended to uint64, which corrupts negative
addends. For example, -4 (0xFFFFFFFC) becomes 4294967292 instead
of remaining -4. Use int32 with sign extension to int64, matching
the Windows code path which already handles this correctly.

* Fix mismatch of enum sizes between WASM and host (#4676)

- refactor(wasi_types): deprecate enums in platform_wasi_types.h.
- Use macros instead.

Signed-off-by: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com>
Signed-off-by: Dan Kouba <dan@atym.io>

* build(deps): Bump github/codeql-action from 4.32.5 to 4.32.6 (#4868)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.32.5 to 4.32.6.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v4.32.5...v4.32.6)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.32.6
  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>

* fuzzing: reject non-wasm files quickly and execute aot after compilation (#4780)

* fix: disable unsigned integer overflow sanitization in build configurations

FYI: from https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html

`-fsanitize=unsigned-integer-overflow`: Unsigned integer overflow, where the result of an unsigned integer computation cannot be represented in its type. Unlike signed integer overflow, this is not undefined behavior, but it is often unintentional. This sanitizer does not check for lossy implicit conversions performed before such a computation.

It brings a more common question: which is better, pre-additional-check or post-additional-check to fix a potential unsigned integer overflow? A pre-additional-check involves using a check to prevent integer overflow from the very beginning. A post-additional-check involves using a check after addition to see if there is an overflow.

In this project, post-additional-checking is widely used. let's follow the routine.

for performance sensitive logic, use __builtin_add_overflow etc. provide something like https://github.com/yamt/toywasm/blob/9a5622791e99395e26e6e96cef830af3d91a1685/lib/platform.h#L176-L191 and encourage the use of them.

ref. https://github.com/bytecodealliance/wasm-micro-runtime/pull/4549#issuecomment-3218687294

* fix: update AOT compiler configuration and enhance error handling in fuzz tests

* Fix: initialize record_frame in aot_copy_callstack (#4861)

* Fix: Fix null pointer dereference in wasm_c_api.c (#4863)

* Enable Unit test on Mac(m1) (#4841)

- detecting host arch. and platform instead of hard-coding
- fix few compilation errors because of stricter rules involve by appleclang
- refactor: modernize wasm-apps CMakeLists.txt to target-specific options and install commands
- refactor: modernize memory64 CMakeLists.txt to target-specific options and install commands
- Update running-modes CMakeLists.txt: enable AOT and INTERP; JIT/FAST_JIT gating for x86_64. Fix typo in JIT section.
- fix: replace deprecated get_binary_path function with get_test_binary_dir for improved portability
- fix: adjust size_level test cases for aarch64 architecture compatibility

* Move exception lock to ModuleInstance data. (#4772)

* Move exception lock to ModuleInstance data.

This lock acquired on each native function call. This cause performance impact
on programs, containing many native function calls, and running in multithreaded environment.

Update AOT_CURRENT_VERSION constant.

* fix: use copy of input for wasm_runtime_load to fix overwrites-const-input in fuzz (#4869)

Signed-off-by: zhenweijin <zhenwei.jin@intel.com>

---------

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com>
Signed-off-by: zhenweijin <zhenwei.jin@intel.com>
Signed-off-by: Haitao Huang <haitaohuang@microsoft.com>
Signed-off-by: Dan Kouba <dan@atym.io>
Co-authored-by: liang.he <liang.he@intel.com>
Co-authored-by: Huang Qi <huangqi3@xiaomi.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chris Woods <6069113+woodsmc@users.noreply.github.com>
Co-authored-by: Zhenwei Jin <109658203+kylo5aby@users.noreply.github.com>
Co-authored-by: YAMAMOTO Takashi <yamamoto@midokura.com>
Co-authored-by: Krisztian <34309983+kr-t@users.noreply.github.com>
Co-authored-by: Kakhaber <kaxabernet@gmail.com>
Co-authored-by: Yosh <2467194+yoshuawuyts@users.noreply.github.com>
Co-authored-by: TianlongLiang <111852609+TianlongLiang@users.noreply.github.com>
Co-authored-by: linear0211 <144136043+linear0211@users.noreply.github.com>
Co-authored-by: 石博文 <sbw@sbw.so>
Co-authored-by: Steven <25894545+teamchong@users.noreply.github.com>
Co-authored-by: Haitao Huang <4699115+haitaohuang@users.noreply.github.com>
Co-authored-by: Alex <ph1048@gmail.com>
Co-authored-by: vkensou <boyplaydota@hotmail.com>
Co-authored-by: Yi Liu <yi@quantstamp.com>
Co-authored-by: Robert Ismo <robertismo@protonmail.com>
Co-authored-by: Taylor C. Richberger <taylor.richberger@procern.com>
Co-authored-by: kogum4 <112237015+kogum4@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Ze Sheng <108382772+OwenSanzas@users.noreply.github.com>
Co-authored-by: Dan Kouba <dan@atym.io>
Co-authored-by: Vyacheslav Chigrin <vyacheslav.chigrin@yandex.ru>
santon1972 13 часов назад
Родитель
Сommit
88d22df35e
100 измененных файлов с 2648 добавлено и 1193 удалено
  1. 46 13
      .clang-tidy
  2. 24 132
      .devcontainer/Dockerfile
  3. 3 24
      .devcontainer/devcontainer.json
  4. 18 0
      .devcontainer/finalize.sh
  5. 5 0
      .devcontainer/requirements.txt
  6. 10 10
      .github/actions/install-wasi-sdk-wabt/action.yml
  7. 11 7
      .github/scripts/codeql_buildscript.sh
  8. 1 1
      .github/workflows/build_docker_images.yml
  9. 2 2
      .github/workflows/build_iwasm_release.yml
  10. 9 9
      .github/workflows/build_llvm_libraries.yml
  11. 2 2
      .github/workflows/build_wamr_lldb.yml
  12. 1 1
      .github/workflows/build_wamr_sdk.yml
  13. 1 1
      .github/workflows/build_wamr_vscode_ext.yml
  14. 1 1
      .github/workflows/build_wamr_wasi_extensions.yml
  15. 2 2
      .github/workflows/build_wamrc.yml
  16. 1 1
      .github/workflows/check_version_h.yml
  17. 7 8
      .github/workflows/codeql.yml
  18. 1 1
      .github/workflows/coding_guidelines.yml
  19. 52 60
      .github/workflows/compilation_on_android_ubuntu.yml
  20. 51 31
      .github/workflows/compilation_on_macos.yml
  21. 10 6
      .github/workflows/compilation_on_nuttx.yml
  22. 12 5
      .github/workflows/compilation_on_sgx.yml
  23. 4 5
      .github/workflows/compilation_on_windows.yml
  24. 3 5
      .github/workflows/compilation_on_zephyr.yml
  25. 1 1
      .github/workflows/create_tag.yml
  26. 1 1
      .github/workflows/hadolint_dockerfiles.yml
  27. 45 23
      .github/workflows/nightly_run.yml
  28. 11 6
      .github/workflows/release_process.yml
  29. 1 1
      .github/workflows/reuse_latest_release_binaries.yml
  30. 7 7
      .github/workflows/spec_test_on_nuttx.yml
  31. 3 3
      .github/workflows/supply_chain.yml
  32. 5 4
      .github/workflows/wamr_wasi_extensions.yml
  33. 7 3
      .gitignore
  34. 0 6
      CMakeLists.txt
  35. 14 1
      CODEOWNERS
  36. 6 2
      CONTRIBUTING.md
  37. 1 1
      build-scripts/build_llvm.py
  38. 13 1
      build-scripts/config_common.cmake
  39. 101 0
      build-scripts/unsupported_combination.cmake
  40. 3 1
      ci/coding_guidelines_check.py
  41. 400 0
      ci/install_sgx_for_applicaiton_developer.sh
  42. 1 1
      core/config.h
  43. 8 7
      core/iwasm/aot/aot_loader.c
  44. 34 12
      core/iwasm/aot/aot_runtime.c
  45. 8 0
      core/iwasm/aot/arch/aot_reloc_thumb.c
  46. 20 12
      core/iwasm/common/arch/invokeNative_thumb.s
  47. 16 8
      core/iwasm/common/arch/invokeNative_thumb_vfp.s
  48. 9 1
      core/iwasm/common/gc/gc_common.c
  49. 8 6
      core/iwasm/common/gc/gc_type.h
  50. 13 4
      core/iwasm/common/wasm_c_api.c
  51. 108 41
      core/iwasm/common/wasm_memory.c
  52. 3 0
      core/iwasm/common/wasm_memory.h
  53. 132 97
      core/iwasm/common/wasm_native.c
  54. 162 7
      core/iwasm/common/wasm_runtime_common.c
  55. 43 0
      core/iwasm/common/wasm_runtime_common.h
  56. 1 1
      core/iwasm/compilation/aot_emit_memory.c
  57. 36 0
      core/iwasm/compilation/aot_llvm.c
  58. 1 0
      core/iwasm/compilation/aot_orc_extra2.cpp
  59. 11 6
      core/iwasm/include/gc_export.h
  60. 2 0
      core/iwasm/include/wasm_c_api.h
  61. 43 0
      core/iwasm/include/wasm_export.h
  62. 1 0
      core/iwasm/interpreter/wasm.h
  63. 18 7
      core/iwasm/interpreter/wasm_interp_classic.c
  64. 16 13
      core/iwasm/interpreter/wasm_interp_fast.c
  65. 31 6
      core/iwasm/interpreter/wasm_loader.c
  66. 3 4
      core/iwasm/interpreter/wasm_mini_loader.c
  67. 1 8
      core/iwasm/interpreter/wasm_opcode.h
  68. 28 10
      core/iwasm/interpreter/wasm_runtime.c
  69. 3 0
      core/iwasm/interpreter/wasm_runtime.h
  70. 3 0
      core/iwasm/libraries/lib-wasi-threads/tid_allocator.c
  71. 3 2
      core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c
  72. 10 3
      core/iwasm/libraries/libc-emcc/libc_emcc_wrapper.c
  73. 12 3
      core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c
  74. 2 15
      core/iwasm/libraries/thread-mgr/thread_manager.c
  75. 0 6
      core/iwasm/libraries/wasi-nn/cmake/iwasm_helper.cmake
  76. 18 4
      core/iwasm/libraries/wasi-nn/src/wasi_nn_llamacpp.c
  77. 5 1
      core/shared/mem-alloc/ems/ems_gc.c
  78. 4 6
      core/shared/mem-alloc/ems/ems_kfc.c
  79. 32 14
      core/shared/platform/include/platform_wasi_types.h
  80. 16 0
      core/shared/platform/zephyr/platform_internal.h
  81. 24 11
      core/shared/platform/zephyr/zephyr_file.c
  82. 58 34
      core/shared/platform/zephyr/zephyr_socket.c
  83. 10 0
      core/shared/utils/bh_common.c
  84. 3 0
      core/shared/utils/bh_common.h
  85. 5 2
      core/shared/utils/bh_queue.c
  86. 533 211
      doc/build_wamr.md
  87. 38 0
      doc/shared_heap.md
  88. 1 1
      doc/stability_wasm_proposals.md
  89. 183 196
      doc/tiered_support.md
  90. 1 1
      gitbook/tutorial/README.md
  91. 2 1
      idf_component.yml
  92. 1 1
      language-bindings/go/build.sh
  93. 1 1
      language-bindings/go/go.mod
  94. 12 4
      language-bindings/go/go.sum
  95. 1 1
      language-bindings/go/wamr/cgo.go
  96. 0 6
      product-mini/platforms/android/CMakeLists.txt
  97. 13 11
      product-mini/platforms/common/libc_wasi.c
  98. 0 8
      product-mini/platforms/cosmopolitan/CMakeLists.txt
  99. 0 6
      product-mini/platforms/ios/CMakeLists.txt
  100. 1 5
      product-mini/platforms/linux-sgx/CMakeLists.txt

+ 46 - 13
.clang-tidy

@@ -1,16 +1,49 @@
 # refer to https://clang.llvm.org/extra/clang-tidy/checks/list.html
+#
+# Configure clang-tidy for this project.
+
+# Here is an explanation for why some of the checks are disabled:
+#
+
+Checks: >
+  -*,
+  bugprone-*,
+  cert-*,
+  clang-analyzer-*,
+  concurrency-*,
+  misc-*,
+  modernize-*,
+  performance-*,
+  portability-*,
+  readability-*,
+  -bugprone-easily-swappable-parameters,
+  -bugprone-macro-parentheses,
+  -misc-no-recursion,
+  -misc-unused-parameters,
+  -readability-braces-around-statements,
+  -readability-else-after-return,
+  -readability-function-cognitive-complexity,
+  -readability-identifier-length,
+  -readability-isolate-declaration,
+  -readability-magic-numbers,
+  -readability-named-parameter,
+  -readability-non-const-parameter,
+  -readability-redundant-preprocessor,
+  -readability-suspicious-call-argument,
+  -readability-uppercase-literal-suffix
+
+
+# Turn all the warnings from the checks above into errors.
+WarningsAsErrors: "*"
+
+# headers in the following directories will be checked:
+#   - core/iwasm/
+#   - core/shared/
+HeaderFilterRegex: '(core/iwasm/|core/shared/).*\\.h$'
+
+# goto .clang-format at root directory to see the format style
+FormatStyle: file
 
-Checks:  '-*, readability-identifier-naming, clang-analyzer-core.*,'
-WarningsAsErrors:    '-*'
-HeaderFilterRegex:   ''
-FormatStyle:         file
-InheritParentConfig: false
-AnalyzeTemporaryDtors: false
-User:                wamr
 CheckOptions:
-  - key:             readability-identifier-naming.VariableCase
-    value:           lower_case
-  - key:             readability-identifier-naming.ParameterCase
-    value:           lower_case
-  - key:             readability-identifier-naming.MacroDefinitionCase
-    value:           UPPER_CASE
+  - { key: readability-identifier-naming.NamespaceCase, value: lower_case }
+  - { key: readability-function-cognitive-complexity.Threshold, value: 100 }

+ 24 - 132
.devcontainer/Dockerfile

@@ -1,150 +1,42 @@
 # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/cpp/.devcontainer/base.Dockerfile
-# [Choice] Debian / Ubuntu version (use Debian 12/11/9, Ubuntu 18.04/21.04 on local arm64/Apple Silicon): debian-12, debian-11, debian-10, debian-9, ubuntu-21.04, ubuntu-20.04, ubuntu-18.04
+# hadolint global ignore=DL3008,DL3009
+
 ARG VARIANT=debian-12
-FROM mcr.microsoft.com/vscode/devcontainers/cpp:${VARIANT}
+FROM mcr.microsoft.com/devcontainers/cpp:${VARIANT}
 
 ARG DEBIAN_FRONTEND=noninteractive
-ENV TZ=Asian/Shanghai
+ENV TZ=Asia/Shanghai
 
-# hadolint ignore=DL3008
 RUN apt-get update \
-  && apt-get upgrade -y \
-  && apt-get install -y apt-transport-https apt-utils build-essential \
-  ca-certificates ccache cmake curl g++-multilib git gnupg \
-  libgcc-12-dev lib32gcc-12-dev lsb-release \
-  ninja-build ocaml ocamlbuild \
-  software-properties-common tree tzdata \
-  unzip valgrind vim wget zip --no-install-recommends \
-  && apt-get clean -y \
-  && rm -rf /var/lib/apt/lists/*
-
-#
-# binaryen
-ARG BINARYEN_VER=114
-WORKDIR /opt
-RUN wget -c --progress=dot:giga https://github.com/WebAssembly/binaryen/releases/download/version_${BINARYEN_VER}/binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz \
-  && tar xf binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz \
-  && ln -sf /opt/binaryen-version_${BINARYEN_VER} /opt/binaryen \
-  && rm binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz
-
-#
-# CMAKE (https://apt.kitware.com/)
-SHELL ["/bin/bash", "-o", "pipefail", "-c"]
-# hadolint ignore=DL3008
-ARG CMAKE_VER=3.27.0
-RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-Linux-x86_64.sh \
-      -q -O /tmp/cmake-install.sh \
-      && chmod u+x /tmp/cmake-install.sh \
-      && mkdir /opt/cmake-${CMAKE_VER} \
-      && /tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-${CMAKE_VER} \
-      && rm /tmp/cmake-install.sh \
-      && ln -s /opt/cmake-${CMAKE_VER}/bin/* /usr/local/bin
-
-#
-# install emsdk
-WORKDIR /opt
-RUN git clone https://github.com/emscripten-core/emsdk.git
-
-ARG EMSDK_VER=3.1.43
-WORKDIR /opt/emsdk
-RUN  git pull \
-  && ./emsdk install ${EMSDK_VER} \
-  && ./emsdk activate ${EMSDK_VER} \
-  && echo "source /opt/emsdk/emsdk_env.sh" >> /root/.bashrc
-
-#
-# install wasi-sdk
-ARG WASI_SDK_VER=20
-RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VER}/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -P /opt \
-  && tar xf /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -C /opt \
-  && ln -sf /opt/wasi-sdk-${WASI_SDK_VER}.0 /opt/wasi-sdk \
-  && rm /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz
-
-#
-#install wabt
-ARG WABT_VER=1.0.33
-RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu.tar.gz -P /opt \
-  && tar xf /opt/wabt-${WABT_VER}-ubuntu.tar.gz -C /opt \
-  && ln -sf /opt/wabt-${WABT_VER} /opt/wabt \
-  && rm /opt/wabt-${WABT_VER}-ubuntu.tar.gz
+  && apt-get upgrade -y
 
-#
-# install bazelisk
-ARG BAZELISK_VER=1.17.0
-RUN mkdir /opt/bazelisk \
-  && wget -c --progress=dot:giga https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VER}/bazelisk-linux-amd64 -P /opt/bazelisk \
-  && chmod a+x /opt/bazelisk/bazelisk-linux-amd64 \
-  && ln -fs /opt/bazelisk/bazelisk-linux-amd64 /opt/bazelisk/bazel
-
-#
-# install clang+llvm
-ARG LLVM_VER=16
-RUN apt-get purge -y clang-14 llvm-14 && apt-get autoremove -y
-WORKDIR /etc/apt/apt.conf.d
-RUN touch 99verfiy-peer.conf \
-  && echo "Acquire { https::Verify-Peer false }" > 99verfiy-peer.conf
-
-WORKDIR /tmp
-#RUN wget --progress=dot:giga https://apt.llvm.org/llvm.sh \
-#  && chmod a+x ./llvm.sh \
-#  && ./llvm.sh ${LLVM_VER} all
-
-# Workaround due to https://github.com/llvm/llvm-project/issues/62475
-# hadolint ignore=DL3008
-RUN set -ex \
-    && echo "deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-${LLVM_VER} main" > /etc/apt/sources.list.d/apt.llvm.org.list \
-    && wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc \
-    && apt-get update \
-    && apt-get install -y \
-    clang-${LLVM_VER} lldb-${LLVM_VER} lld-${LLVM_VER} clangd-${LLVM_VER} clang-tidy-${LLVM_VER} clang-format-${LLVM_VER} clang-tools-${LLVM_VER} \
-    llvm-${LLVM_VER}-dev lld-${LLVM_VER} lldb-${LLVM_VER} llvm-${LLVM_VER}-tools libomp-${LLVM_VER}-dev libc++-${LLVM_VER}-dev libc++abi-${LLVM_VER}-dev \
-    libclang-common-${LLVM_VER}-dev libclang-${LLVM_VER}-dev libclang-cpp${LLVM_VER}-dev libunwind-${LLVM_VER}-dev \
-    libclang-rt-${LLVM_VER}-dev libpolly-${LLVM_VER}-dev --no-install-recommends \
-    && apt-get clean -y \
-    && rm -rf /var/lib/apt/lists/*
-
-#
-# [Optional]
-
-#
-# Install pip
-# hadolint ignore=DL3008
 RUN apt-get update \
-  && apt-get install -y --reinstall python3-venv python3-pip --no-install-recommends \
-  && apt-get clean -y \
-  && rm -rf /var/lib/apt/lists/*
+  && apt-get install -y apt-transport-https apt-utils build-essential \
+      ca-certificates ccache clang-format-14 curl file g++-multilib git gnupg \
+      libgcc-12-dev lib32gcc-12-dev libzstd-dev lsb-release \
+      ninja-build ocaml ocamlbuild opam \
+      python3-venv python3-pip \
+      software-properties-common tree tzdata \
+      unzip valgrind vim wget zip --no-install-recommends
 
-#
-# Install required python packages
-# hadolint ignore=DL3013
-RUN python3 -m pip install --no-cache-dir --break-system-packages --upgrade pip \
-  && pip3 install --no-cache-dir --break-system-packages black nose pycparser pylint
+WORKDIR /opt
 
-#
-# Install github-cli. It doens't work as a feature of devcontainer.json
-ARG GH_CLI_VER=2.32.0
-WORKDIR /tmp
-RUN wget -q https://github.com/cli/cli/releases/download/v${GH_CLI_VER}/gh_${GH_CLI_VER}_linux_amd64.deb \
-  && dpkg -i gh_${GH_CLI_VER}_linux_amd64.deb
+ARG WASI_SDK_VER=25
+RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VER}/wasi-sdk-${WASI_SDK_VER}.0-x86_64-linux.tar.gz -P /tmp \
+  && tar xf /tmp/wasi-sdk-${WASI_SDK_VER}.0-x86_64-linux.tar.gz -C /opt \
+  && ln -sf /opt/wasi-sdk-${WASI_SDK_VER}.0-x86_64-linux /opt/wasi-sdk
 
-#
-# Install NodeJS
-RUN wget -qO- https://deb.nodesource.com/setup_20.x | bash -
-# hadolint ignore=DL3008
-RUN apt-get install -y nodejs --no-install-recommends
+ARG WABT_VER=1.0.37
+RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu-20.04.tar.gz -P /tmp \
+  && tar xf /tmp/wabt-${WABT_VER}-ubuntu-20.04.tar.gz -C /opt \
+  && ln -sf /opt/wabt-${WABT_VER} /opt/wabt
 
 # set path
-ENV PATH="/opt/bazelisk:/usr/lib/llvm-${LLVM_VER}/bin:${PATH}"
-ENV CC=/usr/lib/llvm-${LLVM_VER}/bin/clang CXX=/usr/lib/llvm-${LLVM_VER}/bin/clang++
-RUN printf "%s\n" "PS1='\n[ \u@wamr-dev-docker \W ]\n$ '" >> /root/.bashrc \
-  && apt-get autoremove -y \
+
+# clean up
+RUN apt-get autoremove -y \
   && apt-get clean -y \
   && rm -rf /var/lib/apt/lists/* \
   && rm -rf /tmp/*
-
-# set workdir when container run
-VOLUME /workspaces
-WORKDIR /workspaces

+ 3 - 24
.devcontainer/devcontainer.json

@@ -1,23 +1,11 @@
-// Copyright (C) 2019 Intel Corporation.  All rights reserved.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
-// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/cpp
 {
   "name": "WAMR-Dev",
   "build": {
     "dockerfile": "Dockerfile",
-    // Update 'VARIANT' to pick an Debian / Ubuntu OS version: debian-12, debian-11, debian-10, debian-9, ubuntu-21.04, ubuntu-20.04, ubuntu-18.04
-    // Use Debian 12, Debian 11, Debian 9, Ubuntu 18.04 or Ubuntu 21.04 on local arm64/Apple Silicon
     "args": {
-      "BINARYEN_VER": "114",
-      "BAZELISK_VER": "1.17.0",
-      "CMAKE_VER": "3.27.0",
-      "EMSDK_VER": "3.1.43",
-      "GH_CLI_VER": "2.32.0",
-      "LLVM_VER": "16",
       "VARIANT": "debian-12",
-      "WASI_SDK_VER": "20",
-      "WABT_VER": "1.0.33"
+      "WASI_SDK_VER": "25",
+      "WABT_VER": "1.0.37"
     }
   },
   "runArgs": [
@@ -25,26 +13,17 @@
     "--security-opt",
     "seccomp=unconfined"
   ],
-  // Configure tool-specific properties.
   "customizations": {
-    // Configure properties specific to VS Code.
     "vscode": {
-      // Set *default* container specific settings.json values on container create.
       "settings": {},
-      // Add the IDs of extensions you want installed when the container is created.
       "extensions": [
         "dtsvet.vscode-wasm",
-        "llvm-vs-code-extensions.vscode-clangd",
         "ms-python.python",
         "ms-python.vscode-pylance",
         "ms-vscode.cmake-tools"
       ]
     }
   },
-  // Use 'forwardPorts' to make a list of ports inside the container available locally.
-  // "forwardPorts": [],
-  // Use 'postCreateCommand' to run commands after the container is created.
-  "postCreateCommand": "curl https://sh.rustup.rs -sSf | bash -s -- -y",
-  // Comment out this line to run as root instead.
+  "postCreateCommand": "bash .devcontainer/finalize.sh",
   "remoteUser": "vscode"
 }

+ 18 - 0
.devcontainer/finalize.sh

@@ -0,0 +1,18 @@
+echo "Running finalize script..."
+
+#
+# Python Package Installation
+#
+echo "--- Installing Python Dependencies\n"
+
+# Upgrade pip first
+python3 -m pip install --no-cache-dir --break-system-packages --upgrade pip
+# Install required packages
+pip3 install --no-cache-dir --break-system-packages -r .devcontainer/requirements.txt
+
+echo "--- Installing Ocaml stuff\n"
+opam init --yes --shell-setup
+eval $(opam env --switch=default)
+opam install --yes dune menhir
+
+echo "Finalize script completed. ✅"

+ 5 - 0
.devcontainer/requirements.txt

@@ -0,0 +1,5 @@
+black
+nose
+pycparser
+pylint
+requests

+ 10 - 10
.github/actions/install-wasi-sdk-wabt/action.yml

@@ -50,18 +50,18 @@ runs:
         echo "::notice::wasi-sdk-25 and wabt-1.0.37 installed on ubuntu"
       working-directory: /opt
 
-    - name: Set up wasi-sdk and wabt on macOS-13 (intel)
-      if: ${{ inputs.os == 'macos-13' }}
+    - name: Set up wasi-sdk and wabt on macOS on Intel
+      if: ${{ inputs.os == 'macos-15-intel' }}
       shell: bash
       run: |
-        echo "Downloading wasi-sdk for macOS-13..."
+        echo "Downloading wasi-sdk for macOS on Intel..."
         sudo wget -O wasi-sdk.tar.gz --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-macos.tar.gz
 
         echo "Extracting wasi-sdk..."
         sudo tar -xf wasi-sdk.tar.gz
         sudo ln -sf  wasi-sdk-25.0-x86_64-macos wasi-sdk
 
-        echo "Downloading wabt for macOS-13..."
+        echo "Downloading wabt for macOS on Intel..."
         sudo wget -O wabt.tar.gz     --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/1.0.36/wabt-1.0.36-macos-12.tar.gz
 
         echo "Extracting wabt..."
@@ -71,21 +71,21 @@ runs:
         /opt/wasi-sdk/bin/clang --version
         /opt/wabt/bin/wasm-interp --version
 
-        echo "::notice::wasi-sdk-25 and wabt-1.0.36 installed on macos-13"
+        echo "::notice::wasi-sdk-25 and wabt-1.0.36 installed on ${{ inputs.os }}"
       working-directory: /opt
 
-    - name: Set up wasi-sdk and wabt on macOS-14 (arm64)
-      if: ${{ inputs.os == 'macos-14' }}
+    - name: Set up wasi-sdk and wabt on macOS on ARM
+      if: ${{ inputs.os == 'macos-15' }}
       shell: bash
       run: |
-        echo "Downloading wasi-sdk for macOS-14..."
+        echo "Downloading wasi-sdk for macOS on ARM..."
         sudo wget -O wasi-sdk.tar.gz --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-arm64-macos.tar.gz
 
         echo "Extracting wasi-sdk..."
         sudo tar -xf wasi-sdk.tar.gz
         sudo ln -sf  wasi-sdk-25.0-arm64-macos wasi-sdk
 
-        echo "Downloading wabt for macOS-14..."
+        echo "Downloading wabt for macOS on ARM..."
         sudo wget -O wabt.tar.gz     --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/1.0.37/wabt-1.0.37-macos-14.tar.gz
 
         echo "Extracting wabt..."
@@ -95,7 +95,7 @@ runs:
         /opt/wasi-sdk/bin/clang --version
         /opt/wabt/bin/wasm-interp --version
 
-        echo "::notice::wasi-sdk-25 and wabt-1.0.37 installed on macos-14"
+        echo "::notice::wasi-sdk-25 and wabt-1.0.37 installed on ${{ inputs.os }}"
       working-directory: /opt
 
     - name: Set up wasi-sdk and wabt on Windows

+ 11 - 7
.github/scripts/codeql_buildscript.sh

@@ -78,26 +78,30 @@ iwasm_options_list=(
     #default
     ""
     # +classic interp
-    "-DWAMR_BUILD_FAST_INTERP=0"
-    # +llvm jit + fast jit
-    "-DWAMR_BUILD_JIT=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_FAST_JIT_DUMP=1"
+    "-DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_SIMD=0"
+    # fast jit
+    "-DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_FAST_JIT_DUMP=1 -DWAMR_BUILD_SIMD=0"
+    # +llvm jit
+    "-DWAMR_BUILD_JIT=1"
     #
     "-DWAMR_BUILD_TARGET=X86_32"
     #
     # libraries
     "-DWAMR_BUILD_LIBC_BUILTIN=0 -DWAMR_BUILD_LIBC_UVWASI=1 -DWAMR_BUILD_LIBC_EMCC=1"
-    "-DWAMR_BUILD_THREAD_MGR=1 -DWAMR_BUILD_LIB_PTHREAD=1      -DWAMR_BUILD_SHARED_MEMORY=1 -DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1"
-    "-DWAMR_BUILD_THREAD_MGR=1 -DWAMR_BUILD_LIB_WASI_THREADS=1 -DWAMR_BUILD_SHARED_MEMORY=1 -DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1"
+    "-DWAMR_BUILD_THREAD_MGR=1 -DWAMR_BUILD_LIB_PTHREAD=1      -DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1"
+    "-DWAMR_BUILD_THREAD_MGR=1 -DWAMR_BUILD_LIB_WASI_THREADS=1 -DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1"
     "-DWAMR_BUILD_WASI_NN=1 -DWAMR_BUILD_WASI_NN_LLAMACPP=1"
     #
     # Wasm specs
-    "-DWAMR_BUILD_GC=1 -DWAMR_BUILD_EXCE_HANDLING=1 -DWAMR_BUILD_STRINGREF=1 -DWAMR_STRINGREF_IMPL_SOURCE=STUB"
-    "-DWAMR_BUILD_MEMORY64=1 -DWAMR_BUILD_MULTI_MEMORY=1"
+    "-DWAMR_BUILD_GC=1 -DWAMR_BUILD_STRINGREF=1 -DWAMR_STRINGREF_IMPL_SOURCE=STUB"
+    "-DWAMR_BUILD_EXCE_HANDLING=1 -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_SIMD=0"
+    "-DWAMR_BUILD_MEMORY64=1 -DWAMR_BUILD_MULTI_MEMORY=1 -DWAMR_BUILD_SHARED_MEMORY=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_AOT=0"
     #
     # WARM features
     "-DWAMR_BUILD_MULTI_MODULE=1 -DWAMR_BUILD_MINI_LOADER=1 -DWAMR_BUILD_SHARED_HEAP=1"
     "-DWAMR_DISABLE_HW_BOUND_CHECK=1"
     "-DWAMR_CONFIGURABLE_BOUNDS_CHECKS=1"
+    "-DWAMR_BUILD_EXTENDED_CONST_EXPR=1"
     # - Debug
     "-DWAMR_BUILD_DEBUG_INTERP=1 -DWAMR_BUILD_DEBUG_AOT=1 -DWAMR_BUILD_DYNAMIC_AOT_DEBUG=1"
     # - developer options

+ 1 - 1
.github/workflows/build_docker_images.yml

@@ -26,7 +26,7 @@ jobs:
 
     steps:
       - name: Checkout repository
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: Build and save Docker image(wasm-debug-server:${{ inputs.ver_num }}) to tar file
         run: |

+ 2 - 2
.github/workflows/build_iwasm_release.yml

@@ -104,11 +104,11 @@ jobs:
       contents: write # for uploading release artifacts
 
     steps:
-      - uses: actions/checkout@v5
+      - uses: actions/checkout@v6.0.2
 
       - name: get cached LLVM libraries
         id: retrieve_llvm_libs
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin

+ 9 - 9
.github/workflows/build_llvm_libraries.yml

@@ -45,16 +45,16 @@ jobs:
 
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
-      - name: install dependencies for non macos-14
-        if: inputs.os != 'macos-14'
+      - name: install dependencies for non macos
+        if: ${{ !startsWith(inputs.os, 'macos') }}
         shell: bash
         run: /usr/bin/env python3 -m pip install -r requirements.txt
         working-directory: build-scripts
 
-      - name: install dependencies for macos-14
-        if: inputs.os == 'macos-14'
+      - name: install dependencies for macos
+        if: startsWith(inputs.os, 'macos')
         run: /usr/bin/env python3 -m pip install -r requirements.txt --break-system-packages
         working-directory: build-scripts
 
@@ -79,7 +79,7 @@ jobs:
 
       - name: Cache LLVM libraries
         id: retrieve_llvm_libs
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -89,7 +89,7 @@ jobs:
             ./core/deps/llvm/build/share
           key: ${{ steps.create_lib_cache_key.outputs.key}}
 
-      - uses: actions/cache@v4
+      - uses: actions/cache@v5
         with:
           path: ~/.cache/ccache
           key: 0-ccache-${{ inputs.os }}-${{ steps.get_last_commit.outputs.last_commit }}
@@ -101,7 +101,7 @@ jobs:
       - run: sudo apt install -y ccache ninja-build
         if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && startsWith(inputs.os, 'ubuntu') && inputs.container_image == ''
 
-      - uses: actions/cache@v4
+      - uses: actions/cache@v5
         with:
           path: ~/Library/Caches/ccache
           key: 0-ccache-${{ inputs.os }}-${{ steps.get_last_commit.outputs.last_commit }}
@@ -112,7 +112,7 @@ jobs:
       - run: brew install ccache ninja
         if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && startsWith(inputs.os, 'macos')
 
-      - uses: actions/cache@v4
+      - uses: actions/cache@v5
         with:
           path: ~/.cache/ccache
           key: 0-ccache-${{ inputs.os }}-${{ steps.get_last_commit.outputs.last_commit }}

+ 2 - 2
.github/workflows/build_wamr_lldb.yml

@@ -55,7 +55,7 @@ jobs:
       contents: write # for uploading release artifacts
 
     steps:
-      - uses: actions/checkout@v5
+      - uses: actions/checkout@v6.0.2
 
       - name: download and install wasi-sdk
         run: |
@@ -68,7 +68,7 @@ jobs:
 
       - name: Cache build
         id: lldb_build_cache
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm-project/build/bin

+ 1 - 1
.github/workflows/build_wamr_sdk.yml

@@ -45,7 +45,7 @@ jobs:
       contents: write # for uploading release artifacts
 
     steps:
-      - uses: actions/checkout@v5
+      - uses: actions/checkout@v6.0.2
 
       - name: download wamr-app-framework
         run: |

+ 1 - 1
.github/workflows/build_wamr_vscode_ext.yml

@@ -24,7 +24,7 @@ jobs:
       contents: write # for uploading release artifacts
 
     steps:
-      - uses: actions/checkout@v5
+      - uses: actions/checkout@v6.0.2
 
       - name: Use Node.js 18.x
         uses: actions/setup-node@v6

+ 1 - 1
.github/workflows/build_wamr_wasi_extensions.yml

@@ -28,7 +28,7 @@ jobs:
         os: [ubuntu-22.04]
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: install-wasi-sdk-wabt
         uses: ./.github/actions/install-wasi-sdk-wabt

+ 2 - 2
.github/workflows/build_wamrc.yml

@@ -41,11 +41,11 @@ jobs:
       contents: write # for uploading release artifacts
 
     steps:
-      - uses: actions/checkout@v5
+      - uses: actions/checkout@v6.0.2
 
       - name: get cached LLVM libraries
         id: retrieve_llvm_libs
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin

+ 1 - 1
.github/workflows/check_version_h.yml

@@ -14,7 +14,7 @@ jobs:
 
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: cmake execute to generate version.h
         run: cmake -B build_version -S .

+ 7 - 8
.github/workflows/codeql.yml

@@ -43,13 +43,13 @@ jobs:
 
     steps:
       - name: Checkout repository
-        uses: actions/checkout@v3
+        uses: actions/checkout@v6.0.2
         with:
           submodules: recursive
 
       # Initializes the CodeQL tools for scanning.
       - name: Initialize CodeQL
-        uses: github/codeql-action/init@v4.31.2
+        uses: github/codeql-action/init@v4.32.6
         with:
           languages: ${{ matrix.language }}
           # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
@@ -58,10 +58,10 @@ jobs:
           config-file: ./.github/codeql/codeql_config.yml
 
       - run: |
-          ./.github/scripts/codeql_buildscript.sh
+          ./.github/scripts/codeql_buildscript.sh || exit 1
 
       - name: Perform CodeQL Analysis
-        uses: github/codeql-action/analyze@v3.29.1
+        uses: github/codeql-action/analyze@v4.32.6
         with:
           category: "/language:${{matrix.language}}"
           upload: false
@@ -102,7 +102,7 @@ jobs:
             -**:cpp/unused-local-variable
             -**:cpp/unused-static-function
             -**:cpp/unused-static-variable
-            -**:cpp/use-of-goto 
+            -**:cpp/use-of-goto
             ## Exclude rules 2. Related to special usage of APIs
             -**:cpp/alloca-in-loop
             -**:cpp/command-line-injection
@@ -114,14 +114,13 @@ jobs:
           output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
 
       - name: Upload CodeQL results to code scanning
-        uses: github/codeql-action/upload-sarif@v4.31.2
+        uses: github/codeql-action/upload-sarif@v4.32.6
         with:
           sarif_file: ${{ steps.step1.outputs.sarif-output }}
           category: "/language:${{matrix.language}}"
 
       - name: Upload CodeQL results as an artifact
-        if: success() || failure()
-        uses: actions/upload-artifact@v4.6.2
+        uses: actions/upload-artifact@v7.0.0
         with:
           name: codeql-results
           path: ${{ steps.step1.outputs.sarif-output }}

+ 1 - 1
.github/workflows/coding_guidelines.yml

@@ -22,7 +22,7 @@ jobs:
     runs-on: ubuntu-22.04
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
         with:
           fetch-depth: 0
 

+ 52 - 60
.github/workflows/compilation_on_android_ubuntu.yml

@@ -91,8 +91,7 @@ jobs:
       arch: "X86"
 
   build_wamrc:
-    needs:
-      [build_llvm_libraries_on_ubuntu_2204]
+    needs: [build_llvm_libraries_on_ubuntu_2204]
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
@@ -101,13 +100,13 @@ jobs:
             llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       # since jobs.id can't contain the dot character
       # it is hard to use `format` to assemble the cache key
       - name: Get LLVM libraries
         id: retrieve_llvm_libs
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -129,8 +128,7 @@ jobs:
         working-directory: wamr-compiler
 
   build_iwasm:
-    needs:
-      [build_llvm_libraries_on_ubuntu_2204]
+    needs: [build_llvm_libraries_on_ubuntu_2204]
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
@@ -157,8 +155,6 @@ jobs:
             "-DWAMR_BUILD_MEMORY_PROFILING=1",
             "-DWAMR_BUILD_MULTI_MODULE=1",
             "-DWAMR_BUILD_PERF_PROFILING=1",
-            "-DWAMR_BUILD_REF_TYPES=1",
-            "-DWAMR_BUILD_SIMD=1",
             "-DWAMR_BUILD_LIB_SIMDE=1",
             "-DWAMR_BUILD_TAIL_CALL=1",
             "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
@@ -171,8 +167,7 @@ jobs:
         os: [ubuntu-22.04]
         platform: [android, linux]
         exclude:
-          # incompatible feature and platform
-          # incompatible mode and feature
+          # incompatible feature and platform and mode
           # MULTI_MODULE only on INTERP mode and AOT mode
           - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
             make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
@@ -182,9 +177,6 @@ jobs:
             make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
           - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
             make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
-          # SIMD only on JIT/AOT/fast interpreter mode
-          - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
-            make_options_feature: "-DWAMR_BUILD_SIMD=1"
           # DEBUG_INTERP only on CLASSIC INTERP mode
           - make_options_run_mode: $AOT_BUILD_OPTIONS
             make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
@@ -268,15 +260,24 @@ jobs:
         include:
           - os: ubuntu-22.04
             llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
+          # classic interp doesn't support SIMD
+          - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_SIMD=0"
+          # fast jit doesn't support SIMD
+          - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_SIMD=0"
+          # multi-tier jit doesn't support SIMD
+          - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_SIMD=0"
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       # only download llvm cache when needed
       - name: Get LLVM libraries
         id: retrieve_llvm_libs
         if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -294,7 +295,7 @@ jobs:
         if: matrix.platform == 'linux'
         run: |
           mkdir build && cd build
-          cmake .. -DCMAKE_C_FLAGS="-Werror" ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
+          cmake .. -DCMAKE_C_FLAGS="-Werror" ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} ${{ matrix.extra_options}}
           cmake --build . --config Release --parallel 4
         working-directory: product-mini/platforms/${{ matrix.platform }}
 
@@ -308,31 +309,24 @@ jobs:
         working-directory: product-mini/platforms/${{ matrix.platform }}
 
   build_unit_tests:
-    needs:
-      [
-        build_llvm_libraries_on_ubuntu_2204,
-        build_wamrc
-      ]
+    needs: [build_llvm_libraries_on_ubuntu_2204, build_wamrc]
     runs-on: ${{ matrix.os }}
     strategy:
       fail-fast: false
       matrix:
         os: [ubuntu-22.04]
-        build_target: [
-          "X86_64",
-          "X86_32",
-        ]
+        build_target: ["X86_64", "X86_32"]
         include:
           - os: ubuntu-22.04
             llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
 
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: Get LLVM libraries
         id: retrieve_llvm_libs
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -350,7 +344,7 @@ jobs:
         uses: ./.github/actions/install-wasi-sdk-wabt
         with:
           os: ${{ matrix.os }}
-      
+
       - name: Build wamrc
         run: |
           mkdir build && cd build
@@ -374,8 +368,7 @@ jobs:
         working-directory: tests/unit
 
   build_regression_tests:
-    needs:
-      [build_llvm_libraries_on_ubuntu_2204]
+    needs: [build_llvm_libraries_on_ubuntu_2204]
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
@@ -383,14 +376,14 @@ jobs:
         include:
           - os: ubuntu-22.04
             llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
-    
+
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: Get LLVM libraries
         id: retrieve_llvm_libs
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -403,24 +396,19 @@ jobs:
       - name: Quit if cache miss
         if: (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
         run: echo "::error::can not get prebuilt llvm libraries" && exit 1
-      
+
       - name: Build wamrc and iwasm
         run: |
           ./build_wamr.sh
         working-directory: tests/regression/ba-issues
-      
+
       - name: Run regression tests
         run: |
           python run.py
         working-directory: tests/regression/ba-issues
 
   build_samples_wasm_c_api:
-    needs:
-      [
-        build_iwasm,
-        build_llvm_libraries_on_ubuntu_2204,
-        build_wamrc,
-      ]
+    needs: [build_iwasm, build_llvm_libraries_on_ubuntu_2204, build_wamrc]
     runs-on: ${{ matrix.os }}
     strategy:
       fail-fast: false
@@ -439,15 +427,29 @@ jobs:
         include:
           - os: ubuntu-22.04
             llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
+          # classic interp doesn't support SIMD
+          - make_options: $CLASSIC_INTERP_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_SIMD=0"
+          # fast jit doesn't support Multi-module and SIMD
+          - make_options: $FAST_JIT_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_MULTI_MODULE=0"
+          # multi-tier jit doesn't support Multi-module and SIMD
+          - make_options: $MULTI_TIER_JIT_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_MULTI_MODULE=0"
+          # LLVM JIT doesn't support Multi-module
+          - make_options: $LLVM_LAZY_JIT_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_MULTI_MODULE=0"
+          - make_options: $LLVM_EAGER_JIT_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_MULTI_MODULE=0"
 
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: Get LLVM libraries
         id: retrieve_llvm_libs
         if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -477,7 +479,7 @@ jobs:
       - name: Build Sample [wasm-c-api]
         run: |
           VERBOSE=1
-          cmake -S . -B build ${{ matrix.make_options }}
+          cmake -S . -B build ${{ matrix.make_options }} ${{ matrix.extra_options }}
           cmake --build build --config Debug --parallel 4
           ctest --test-dir build --output-on-failure
         working-directory: samples/wasm-c-api
@@ -488,12 +490,7 @@ jobs:
         working-directory: samples/printversion
 
   build_samples_others:
-    needs:
-      [
-        build_iwasm,
-        build_llvm_libraries_on_ubuntu_2204,
-        build_wamrc,
-      ]
+    needs: [build_iwasm, build_llvm_libraries_on_ubuntu_2204, build_wamrc]
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
@@ -504,11 +501,11 @@ jobs:
 
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: Get LLVM libraries
         id: retrieve_llvm_libs
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -632,12 +629,7 @@ jobs:
           ./import-func-callback
 
   test:
-    needs:
-      [
-        build_iwasm,
-        build_llvm_libraries_on_ubuntu_2204,
-        build_wamrc,
-      ]
+    needs: [build_iwasm, build_llvm_libraries_on_ubuntu_2204, build_wamrc]
     runs-on: ${{ matrix.os }}
     strategy:
       fail-fast: false
@@ -675,7 +667,7 @@ jobs:
 
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: Set-up OCaml
         uses: ocaml/setup-ocaml@v3
@@ -709,7 +701,7 @@ jobs:
       - name: Get LLVM libraries
         if: env.USE_LLVM == 'true'
         id: retrieve_llvm_libs
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin

+ 51 - 31
.github/workflows/compilation_on_macos.yml

@@ -65,7 +65,7 @@ jobs:
       actions: write
     uses: ./.github/workflows/build_llvm_libraries.yml
     with:
-      os: "macos-13"
+      os: "macos-15-intel"
       arch: "X86"
   build_llvm_libraries_on_arm_macos:
     permissions:
@@ -73,24 +73,27 @@ jobs:
       actions: write
     uses: ./.github/workflows/build_llvm_libraries.yml
     with:
-      os: "macos-14"
+      os: "macos-15"
       arch: "AArch64 ARM"
 
   build_wamrc:
-    needs: [build_llvm_libraries_on_intel_macos]
+    needs: [build_llvm_libraries_on_intel_macos, build_llvm_libraries_on_arm_macos]
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
+        os: [macos-15, macos-15-intel]
         include:
-          - os: macos-13
+          - os: macos-15-intel
             llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}
+          - os: macos-15
+            llvm_cache_key: ${{ needs.build_llvm_libraries_on_arm_macos.outputs.cache_key }}
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: Get LLVM libraries
         id: retrieve_llvm_libs
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -112,7 +115,7 @@ jobs:
         working-directory: wamr-compiler
 
   build_iwasm:
-    needs: [build_llvm_libraries_on_intel_macos]
+    needs: [build_llvm_libraries_on_intel_macos, build_llvm_libraries_on_arm_macos]
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
@@ -138,13 +141,11 @@ jobs:
             "-DWAMR_BUILD_MEMORY_PROFILING=1",
             "-DWAMR_BUILD_MULTI_MODULE=1",
             "-DWAMR_BUILD_PERF_PROFILING=1",
-            "-DWAMR_BUILD_REF_TYPES=1",
-            "-DWAMR_BUILD_SIMD=1",
             "-DWAMR_BUILD_TAIL_CALL=1",
             "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
             "-DWAMR_BUILD_EXTENDED_CONST_EXPR=1",
           ]
-        os: [macos-13]
+        os: [macos-15, macos-15-intel]
         platform: [darwin]
         exclude:
           # incompatible feature and platform
@@ -154,11 +155,6 @@ jobs:
             make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
           - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
             make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
-          # SIMD only on JIT/AOT mode
-          - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
-            make_options_feature: "-DWAMR_BUILD_SIMD=1"
-          - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
-            make_options_feature: "-DWAMR_BUILD_SIMD=1"
           # DEBUG_INTERP only on CLASSIC INTERP mode
           - make_options_run_mode: $AOT_BUILD_OPTIONS
             make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
@@ -186,17 +182,22 @@ jobs:
           - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
             make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
         include:
-          - os: macos-13
+          - os: macos-15
+            llvm_cache_key: ${{ needs.build_llvm_libraries_on_arm_macos.outputs.cache_key }}
+          - os: macos-15-intel
             llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}
+          # classic interp doesn't support SIMD
+          - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_SIMD=0"
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       # only download llvm cache when needed
       - name: Get LLVM libraries
         id: retrieve_llvm_libs
         if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -213,7 +214,7 @@ jobs:
       - name: Build iwasm
         run: |
           mkdir build && cd build
-          cmake .. -DCMAKE_C_FLAGS="-Werror" ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
+          cmake .. -DCMAKE_C_FLAGS="-Werror" ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} ${{ matrix.extra_options }}
           cmake --build . --config Release --parallel 4
         working-directory: product-mini/platforms/${{ matrix.platform }}
 
@@ -222,6 +223,7 @@ jobs:
       [
         build_iwasm,
         build_llvm_libraries_on_intel_macos,
+        build_llvm_libraries_on_arm_macos,
         build_wamrc,
       ]
     runs-on: ${{ matrix.os }}
@@ -231,24 +233,32 @@ jobs:
             $AOT_BUILD_OPTIONS,
             $CLASSIC_INTERP_BUILD_OPTIONS,
             $FAST_INTERP_BUILD_OPTIONS,
-            $FAST_JIT_BUILD_OPTIONS,
             $LLVM_LAZY_JIT_BUILD_OPTIONS,
             $LLVM_EAGER_JIT_BUILD_OPTIONS,
-            $MULTI_TIER_JIT_BUILD_OPTIONS,
           ]
-        os: [macos-13]
+        os: [macos-15, macos-15-intel]
         include:
-          - os: macos-13
+          - os: macos-15
+            llvm_cache_key: ${{ needs.build_llvm_libraries_on_arm_macos.outputs.cache_key }}
+          - os: macos-15-intel
             llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}
+          # classic interp doesn't support SIMD
+          - make_options: $CLASSIC_INTERP_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_SIMD=0"
+          # LLVM JIT doesn't support Multi-module
+          - make_options: $LLVM_LAZY_JIT_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_MULTI_MODULE=0"
+          - make_options: $LLVM_EAGER_JIT_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_MULTI_MODULE=0"
 
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: Get LLVM libraries
         id: retrieve_llvm_libs
         if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -278,7 +288,7 @@ jobs:
       - name: Build Sample [wasm-c-api]
         run: |
           VERBOSE=1
-          cmake -S . -B build ${{ matrix.make_options }}
+          cmake -S . -B build ${{ matrix.make_options }} ${{ matrix.extra_options }}
           cmake --build build --config Debug --parallel 4
           ctest --test-dir build --output-on-failure
         working-directory: samples/wasm-c-api
@@ -293,15 +303,15 @@ jobs:
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-        os: [macos-13, macos-14]
+        os: [macos-15-intel, macos-15]
         include:
-          - os: macos-13
+          - os: macos-15-intel
             llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}
-          - os: macos-14
+          - os: macos-15
             llvm_cache_key: ${{ needs.build_llvm_libraries_on_arm_macos.outputs.cache_key }}
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: install-wasi-sdk-wabt
         uses: ./.github/actions/install-wasi-sdk-wabt
@@ -356,7 +366,7 @@ jobs:
 
       - name: Get LLVM libraries
         id: retrieve_llvm_libs
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -430,3 +440,13 @@ jobs:
           cmake ..
           cmake --build . --config Release --parallel 4
           ./import-func-callback
+
+      - name: Test x18 register reservation (macOS ARM64 only)
+        if: matrix.os == 'macos-15'
+        run: |
+          cd product-mini/platforms/darwin
+          mkdir -p build && cd build
+          cmake .. -DWAMR_BUILD_AOT=1
+          cmake --build . --config Release --parallel 4
+          cd ../../../../tests/standalone/test-aot-x18-reserve
+          ./run.sh --aot

+ 10 - 6
.github/workflows/compilation_on_nuttx.yml

@@ -64,6 +64,8 @@ jobs:
           "boards/arm/rp2040/raspberrypi-pico/configs/nsh",
           # cortex-m7
           "boards/arm/stm32h7/nucleo-h743zi/configs/nsh",
+          # cortex-m33
+          "boards/arm/rp23xx/raspberrypi-pico-2/configs/nsh",
           # riscv32gc
           "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
           # riscv64gc
@@ -85,21 +87,21 @@ jobs:
 
     steps:
       - name: Checkout NuttX
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
         with:
           repository: apache/nuttx
-          ref: releases/12.9
+          ref: 09a71ec7c16c43398d5acbdcbeee7b08736c3170
           path: nuttx
 
       - name: Checkout NuttX Apps
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
         with:
           repository: apache/nuttx-apps
-          ref: releases/12.9
+          ref: 6bd593459c4af3cef325c3d22bccd5537a8ed755
           path: apps
 
       - name: Checkout WAMR
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
         with:
           repository: ${{ github.repository }}
           path: apps/interpreters/wamr/wamr
@@ -108,6 +110,8 @@ jobs:
         working-directory: nuttx
         run: |
           tools/configure.sh ${{ matrix.nuttx_board_config }}
+          kconfig-tweak --disable CONFIG_RP2040_UF2_BINARY
+          kconfig-tweak --disable CONFIG_RP23XX_UF2_BINARY
           kconfig-tweak --enable CONFIG_PSEUDOFS_SOFTLINKS
           kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR
           kconfig-tweak --enable CONFIG_INTERPRETERS_IWASM_TASK
@@ -122,7 +126,7 @@ jobs:
         run: make -j$(nproc) EXTRAFLAGS=-Werror
 
       - name: Checkout Bloaty
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
         with:
           repository: google/bloaty
           submodules: recursive

+ 12 - 5
.github/workflows/compilation_on_sgx.yml

@@ -114,9 +114,16 @@ jobs:
           # MINI_LOADER only on INTERP mode
           - make_options_run_mode: $AOT_BUILD_OPTIONS
             make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
+          # FAST_JIT doesn't support MULTI_MODULE
+          - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
+        include:
+          # classic interp mode doesn't support SIMD
+          - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
+            make_options_feature: "-DWAMR_BUILD_SIMD=0"
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: install SGX SDK and necessary libraries
         uses: ./.github/actions/install-linux-sgx
@@ -159,7 +166,7 @@ jobs:
 
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: install-wasi-sdk-wabt
         uses: ./.github/actions/install-wasi-sdk-wabt
@@ -183,7 +190,7 @@ jobs:
       - name: Get LLVM libraries
         if: matrix.iwasm_make_options_run_mode == '$AOT_BUILD_OPTIONS'
         id: retrieve_llvm_libs
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -255,12 +262,12 @@ jobs:
 
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: Get LLVM libraries
         if: matrix.running_mode == 'aot'
         id: retrieve_llvm_libs
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin

+ 4 - 5
.github/workflows/compilation_on_windows.yml

@@ -78,14 +78,13 @@ jobs:
             "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
             "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
             "-DWAMR_BUILD_REF_TYPES=1",
-            "-DWAMR_BUILD_SIMD=1",
             "-DWAMR_BUILD_DEBUG_INTERP=1",
             "-DWAMR_BUILD_LIB_PTHREAD=1",
             "-DWAMR_BUILD_LIB_WASI_THREADS=1",
             "-DWAMR_BUILD_LIBC_UVWASI=0 -DWAMR_BUILD_LIBC_WASI=1",
           ]
     steps:
-      - uses: actions/checkout@v5
+      - uses: actions/checkout@v6.0.2
 
       - name: clone uvwasi library
         if: ${{ !contains(matrix.build_options, '-DWAMR_BUILD_LIBC_UVWASI=0') }}
@@ -109,13 +108,13 @@ jobs:
             llvm_cache_key: ${{ needs.build_llvm_libraries_on_windows.outputs.cache_key }}
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       # since jobs.id can't contain the dot character
       # it is hard to use `format` to assemble the cache key
       - name: Get LLVM libraries
         id: retrieve_llvm_libs
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -151,7 +150,7 @@ jobs:
           ]
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: download and install wasi-sdk
         if: matrix.test_option == '$WASI_TEST_OPTIONS'

+ 3 - 5
.github/workflows/compilation_on_zephyr.yml

@@ -10,8 +10,7 @@ on:
       - opened
       - synchronize
     paths:
-      - ".github/**"
-      - "!.github/ISSUE_TEMPLATE/**"
+      - ".github/workflows/compilation_on_zephyr.yml"
       - "build-scripts/**"
       - "core/**"
       - "!core/deps/**"
@@ -27,8 +26,7 @@ on:
       - main
       - "dev/**"
     paths:
-      - ".github/**"
-      - "!.github/ISSUE_TEMPLATE/**"
+      - ".github/workflows/compilation_on_zephyr.yml"
       - "build-scripts/**"
       - "core/**"
       - "!core/deps/**"
@@ -80,7 +78,7 @@ jobs:
       # └─── application/    --> DUMMY. keep west_lite.yml here
 
       - name: Checkout code
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
         with:
           path: modules/wasm-micro-runtime
 

+ 1 - 1
.github/workflows/create_tag.yml

@@ -29,7 +29,7 @@ jobs:
       contents: write # create and push tags
 
     steps:
-      - uses: actions/checkout@v5
+      - uses: actions/checkout@v6.0.2
         # Full git history is needed to get a proper list of commits and tags
         with:
           fetch-depth: 0

+ 1 - 1
.github/workflows/hadolint_dockerfiles.yml

@@ -37,7 +37,7 @@ jobs:
 
     steps:
       - name: Checkout repository
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       # on default, hadolint will fail on warnings and errors
       - name: Run hadolint on dockerfiles

+ 45 - 23
.github/workflows/nightly_run.yml

@@ -67,13 +67,13 @@ jobs:
             llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       # since jobs.id can't contain the dot character
       # it is hard to use `format` to assemble the cache key
       - name: Get LLVM libraries
         id: retrieve_llvm_libs
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -122,8 +122,6 @@ jobs:
             "-DWAMR_BUILD_MEMORY_PROFILING=1",
             "-DWAMR_BUILD_MULTI_MODULE=1",
             "-DWAMR_BUILD_PERF_PROFILING=1",
-            "-DWAMR_BUILD_REF_TYPES=1",
-            "-DWAMR_BUILD_SIMD=1",
             "-DWAMR_BUILD_TAIL_CALL=1",
             "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
             "-DWAMR_BUILD_MEMORY64=1",
@@ -145,11 +143,6 @@ jobs:
             make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
           - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
             make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
-          # SIMD only on JIT/AOT mode
-          - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
-            make_options_feature: "-DWAMR_BUILD_SIMD=1"
-          - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
-            make_options_feature: "-DWAMR_BUILD_SIMD=1"
           # DEBUG_INTERP only on CLASSIC INTERP mode
           - make_options_run_mode: $AOT_BUILD_OPTIONS
             make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
@@ -230,16 +223,25 @@ jobs:
         include:
           - os: ubuntu-22.04
             llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
+          # classic interp doesn't support SIMD
+          - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_SIMD=0"
+          # fast jit doesn't support SIMD
+          - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_SIMD=0"
+          # multi-tier jit doesn't support SIMD
+          - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_SIMD=0"
 
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       # only download llvm cache when needed
       - name: Get LLVM libraries
         id: retrieve_llvm_libs
         if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -257,7 +259,7 @@ jobs:
         if: matrix.platform == 'linux'
         run: |
           mkdir build && cd build
-          cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
+          cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} ${{ matrix.extra_options }}
           cmake --build . --config Release --parallel 4
         working-directory: product-mini/platforms/${{ matrix.platform }}
 
@@ -265,7 +267,7 @@ jobs:
         if: matrix.platform == 'android'
         run: |
           mkdir build && cd build
-          cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} \
+          cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} ${{ matrix.extra_options }} \
                 -DWAMR_BUILD_TARGET=X86_64
           cmake --build . --config Release --parallel 4
         working-directory: product-mini/platforms/${{ matrix.platform }}
@@ -295,8 +297,6 @@ jobs:
             "-DWAMR_BUILD_MEMORY_PROFILING=1",
             "-DWAMR_BUILD_MULTI_MODULE=1",
             "-DWAMR_BUILD_PERF_PROFILING=1",
-            "-DWAMR_BUILD_REF_TYPES=1",
-            "-DWAMR_BUILD_SIMD=1",
             "-DWAMR_BUILD_TAIL_CALL=1",
             "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
             "-DWAMR_BUILD_MEMORY64=1",
@@ -339,6 +339,13 @@ jobs:
             make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
           - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
             make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
+        include:
+          # classic interp doesn't support SIMD
+          - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_SIMD=0"
+          # fast jit doesn't support SIMD
+          - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_SIMD=0"
     steps:
       - name: Install dependencies
         run: |
@@ -357,7 +364,7 @@ jobs:
       - name: Build iwasm
         run: |
           mkdir build && cd build
-          cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8
+          cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} ${{ matrix.extra_options }} -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8
           cmake --build . --config Release --parallel 4
         working-directory: wamr/product-mini/platforms/linux
 
@@ -382,17 +389,32 @@ jobs:
         include:
           - os: ubuntu-22.04
             llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
+          # classic interp doesn't support SIMD
+          - make_options: $CLASSIC_INTERP_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_SIMD=0"
+          # fast jit doesn't support Multi-module and SIMD
+          - make_options: $FAST_JIT_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_MULTI_MODULE=0"
+          # multi-tier jit doesn't support Multi-module and SIMD
+          - make_options: $MULTI_TIER_JIT_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_MULTI_MODULE=0"
+          # LLVM JIT doesn't support Multi-module
+          - make_options: $LLVM_LAZY_JIT_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_MULTI_MODULE=0"
+          - make_options: $LLVM_EAGER_JIT_BUILD_OPTIONS
+            extra_options: "-DWAMR_BUILD_MULTI_MODULE=0"
         exclude:
           - make_options: $MULTI_TIER_JIT_BUILD_OPTIONS
             sanitizer: asan
+
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: Get LLVM libraries
         id: retrieve_llvm_libs
         if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -422,7 +444,7 @@ jobs:
       - name: Build Sample [wasm-c-api]
         run: |
           VERBOSE=1
-          cmake -S . -B build ${{ matrix.make_options }} \
+          cmake -S . -B build ${{ matrix.make_options }} ${{ matrix.extra_options }} \
                 -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}" \
                 -D WAMR_BUILD_QUICK_AOT_ENTRY=0
           cmake --build build --config Release --parallel 4
@@ -440,7 +462,7 @@ jobs:
             llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: install-wasi-sdk-wabt
         uses: ./.github/actions/install-wasi-sdk-wabt
@@ -449,7 +471,7 @@ jobs:
         
       - name: Get LLVM libraries
         id: retrieve_llvm_libs
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -634,7 +656,7 @@ jobs:
             sanitizer: ubsan
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: install-wasi-sdk-wabt
         if: matrix.test_option == '$WASI_TEST_OPTIONS'
@@ -663,7 +685,7 @@ jobs:
       - name: Get LLVM libraries
         if: env.USE_LLVM == 'true'
         id: retrieve_llvm_libs
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin

+ 11 - 6
.github/workflows/release_process.yml

@@ -55,7 +55,7 @@ jobs:
     outputs:
       upload_url: ${{ steps.create_release.outputs.upload_url }}
     steps:
-      - uses: actions/checkout@v5
+      - uses: actions/checkout@v6.0.2
 
       - name: prepare the release note
         run: |
@@ -88,6 +88,7 @@ jobs:
       os: "ubuntu-22.04"
       arch: "AArch64 ARM Mips RISCV X86"
 
+  #CLARIFY: Require to build LLVM libraries on ARM macOS?
   build_llvm_libraries_on_macos:
     permissions:
       contents: read
@@ -95,7 +96,7 @@ jobs:
     needs: [create_tag, create_release]
     uses: ./.github/workflows/build_llvm_libraries.yml
     with:
-      os: "macos-13"
+      os: "macos-15-intel"
       arch: "AArch64 ARM Mips RISCV X86"
 
   build_llvm_libraries_on_windows:
@@ -122,6 +123,7 @@ jobs:
       upload_url: ${{ needs.create_release.outputs.upload_url }}
       ver_num: ${{ needs.create_tag.outputs.new_ver }}
 
+  #CLARIFY: Require to release wamrc on ARM macOS?
   release_wamrc_on_ubuntu_macos:
     permissions:
       contents: write # upload release artifact
@@ -130,7 +132,7 @@ jobs:
     with:
       llvm_cache_key: ${{ needs.build_llvm_libraries_on_macos.outputs.cache_key }}
       release: true
-      runner: macos-13
+      runner: macos-15-intel
       upload_url: ${{ needs.create_release.outputs.upload_url }}
       ver_num: ${{ needs.create_tag.outputs.new_ver }}
 
@@ -160,6 +162,7 @@ jobs:
       upload_url: ${{ needs.create_release.outputs.upload_url }}
       ver_num: ${{ needs.create_tag.outputs.new_ver}}
 
+  #CLARIFY: Require to release iwasm on ARM macOS?
   release_iwasm_on_macos:
     permissions:
       contents: write # upload release artifact
@@ -168,7 +171,7 @@ jobs:
     with:
       cwd: product-mini/platforms/darwin
       llvm_cache_key: ${{ needs.build_llvm_libraries_on_macos.outputs.cache_key }}
-      runner: macos-13
+      runner: macos-15-intel
       upload_url: ${{ needs.create_release.outputs.upload_url }}
       ver_num: ${{ needs.create_tag.outputs.new_ver}}
 
@@ -200,6 +203,7 @@ jobs:
       wasi_sdk_url: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz
       wamr_app_framework_url: https://github.com/bytecodealliance/wamr-app-framework.git
 
+  #CLARIFY: Require to release WAMR SDK on ARM macOS?
   release_wamr_sdk_on_macos:
     permissions:
       contents: write # upload release artifact
@@ -208,7 +212,7 @@ jobs:
     uses: ./.github/workflows/build_wamr_sdk.yml
     with:
       config_file: wamr_config_macos_release.cmake
-      runner: macos-13
+      runner: macos-15-intel
       upload_url: ${{ needs.create_release.outputs.upload_url }}
       ver_num: ${{ needs.create_tag.outputs.new_ver}}
       wasi_sdk_url: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-macos.tar.gz
@@ -251,6 +255,7 @@ jobs:
       upload_url: ${{ needs.create_release.outputs.upload_url }}
       ver_num: ${{ needs.create_tag.outputs.new_ver}}
 
+  #CLARIFY: Require to release WAMR LLDB on ARM macOS?
   release_wamr_lldb_on_macos_universal:
     permissions:
       contents: write # upload release artifact
@@ -258,7 +263,7 @@ jobs:
     if: ${{ inputs.release_wamr_lldb }}
     uses: ./.github/workflows/build_wamr_lldb.yml
     with:
-      runner: macos-13
+      runner: macos-15-intel
       arch: universal
       upload_url: ${{ needs.create_release.outputs.upload_url }}
       ver_num: ${{ needs.create_tag.outputs.new_ver}}

+ 1 - 1
.github/workflows/reuse_latest_release_binaries.yml

@@ -34,7 +34,7 @@ jobs:
       contents: write # for creating realease and uploading release artifacts
 
     steps:
-      - uses: actions/checkout@v5
+      - uses: actions/checkout@v6.0.2
         # Full git history is needed to get a proper list of commits and tags
         with:
           fetch-depth: 0

+ 7 - 7
.github/workflows/spec_test_on_nuttx.yml

@@ -143,21 +143,21 @@ jobs:
       # Note: we use an unreleased version nuttx for xtensa because
       # 12.4 doesn't contain necessary esp32s3 changes.
       - name: Checkout NuttX
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
         with:
           repository: apache/nuttx
-          ref: ${{ matrix.target_config.target == 'xtensa' && '985d395b025cf2012b22f6bb4461959fa6d87645' || 'releases/12.9' }}
+          ref: ${{ matrix.target_config.target == 'xtensa' && '985d395b025cf2012b22f6bb4461959fa6d87645' || '09a71ec7c16c43398d5acbdcbeee7b08736c3170' }}
           path: nuttx
 
       - name: Checkout NuttX Apps
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
         with:
           repository: apache/nuttx-apps
-          ref: ${{ matrix.target_config.target == 'xtensa' && '2ef3eb25c0cec944b13792185f7e5d5a05990d5f' || 'releases/12.9' }}
+          ref: ${{ matrix.target_config.target == 'xtensa' && '2ef3eb25c0cec944b13792185f7e5d5a05990d5f' || '6bd593459c4af3cef325c3d22bccd5537a8ed755' }}
           path: apps
 
       - name: Checkout WAMR
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
         with:
           repository: ${{ github.repository }}
           path: apps/interpreters/wamr/wamr
@@ -165,7 +165,7 @@ jobs:
       - name: Get LLVM libraries
         if: contains(matrix.wamr_test_option.mode, 'aot')
         id: retrieve_llvm_libs
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: |
             ./core/deps/llvm/build/bin
@@ -329,7 +329,7 @@ jobs:
 
       - name: upload the log
         if: always()
-        uses: actions/upload-artifact@v5
+        uses: actions/upload-artifact@v7.0.0
         with:
           name: spec-test-log-${{ github.run_id }}-${{ strategy.job-index }}-${{ matrix.target_config.target }}
           path: log

+ 3 - 3
.github/workflows/supply_chain.yml

@@ -34,7 +34,7 @@ jobs:
 
     steps:
       - name: "Checkout code"
-        uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v3.1.0
+        uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v3.1.0
         with:
           persist-credentials: false
 
@@ -52,7 +52,7 @@ jobs:
       # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
       # format to the repository Actions tab.
       - name: "Upload artifact"
-        uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v3.1.0
+        uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v3.1.0
         with:
           name: SARIF file
           path: results.sarif
@@ -60,6 +60,6 @@ jobs:
 
       # Upload the results to GitHub's code scanning dashboard.
       - name: "Upload to code-scanning"
-        uses: github/codeql-action/upload-sarif@338146ca93283a2901a142d408241096146019b5 
+        uses: github/codeql-action/upload-sarif@d1a65275e8dac7b2cc72bb121bf58f0ee7b0f92d 
         with:
           sarif_file: results.sarif

+ 5 - 4
.github/workflows/wamr_wasi_extensions.yml

@@ -27,10 +27,10 @@ jobs:
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-        os: [ubuntu-22.04, macos-13, macos-14]
+        os: [ubuntu-22.04, macos-15-intel, macos-15]
     steps:
       - name: checkout
-        uses: actions/checkout@v5
+        uses: actions/checkout@v6.0.2
 
       - name: install-wasi-sdk-wabt
         uses: ./.github/actions/install-wasi-sdk-wabt
@@ -48,9 +48,10 @@ jobs:
           ./build_samples.sh $(pwd)/dist/wamr-wasi-extensions
         working-directory: wamr-wasi-extensions
 
+      #CLARIFY: Require to upload artifact on ARM macOS?
       - name: Upload artifacts
-        if: matrix.os == 'macos-14'
-        uses: actions/upload-artifact@v5
+        if: matrix.os == 'macos-15'
+        uses: actions/upload-artifact@v7.0.0
         with:
           name: wamr-wasi-extensions
           path: wamr-wasi-extensions/dist

+ 7 - 3
.gitignore

@@ -1,3 +1,4 @@
+
 .cache
 .clangd
 .vs
@@ -21,9 +22,9 @@ core/iwasm/libraries/lib-wasi-threads/test/*.wasm
 core/iwasm/libraries/lib-socket/test/*.wasm
 
 product-mini/app-samples/hello-world/test.wasm
-product-mini/platforms/linux-sgx/enclave-sample/App/
-product-mini/platforms/linux-sgx/enclave-sample/Enclave/
-product-mini/platforms/linux-sgx/enclave-sample/iwasm
+product-mini/platforms/linux-sgx/enclave-sample/
+!product-mini/platforms/linux-sgx/enclave-sample/App/App.*
+!product-mini/platforms/linux-sgx/enclave-sample/Enclave/Enclave.*
 
 build_out
 tests/wamr-test-suites/workspace
@@ -40,3 +41,6 @@ samples/workload/include/**
 !samples/workload/include/.gitkeep
 
 # core/iwasm/libraries/wasi-threads
+
+tests/unit/runtime-common/wasm-apps/main.aot
+tests/unit/aot-stack-frame/wasm-apps/test_aot.h

+ 0 - 6
CMakeLists.txt

@@ -131,12 +131,6 @@ if (NOT WIN32)
   string (REGEX REPLACE "  *" " " CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
 endif()
 
-if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
-  if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
-    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
-  endif ()
-endif ()
-
 # The following flags are to enhance security, but it may impact performance,
 # we disable them by default.
 #if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")

+ 14 - 1
CODEOWNERS

@@ -22,8 +22,21 @@
 # If none of the later patterns match, assign to anyone. This team is the
 # parent of all the other teams and automatically includes everyone on those
 # teams.
-* @loganek @lum1n0us @no1wudi @TianlongLiang @wenyongh @xujuntwt95329 @yamt
+* @lum1n0us @TianlongLiang @yamt
 
 # Some parts of the project require more specialized knowledge. In those areas
 # we designate smaller groups who are more likely to be aware of who's working
 # in specific areas.
+
+/core/iwasm/core                    @loganek @lum1n0us @no1wudi @TianlongLiang @yamt
+/core/iwasm/interpreter             @loganek @lum1n0us @no1wudi @TianlongLiang @yamt
+/core/iwasm/libraries/lib-socket    @loganek @srberard 
+/core/iwasm/libraries/wasi-nn       @lum1n0us @yamt
+/core/iwasm                         @lum1n0us @no1wudi @TianlongLiang @yamt 
+
+/docs/                              @loganek @lum1n0us @no1wudi @TianlongLiang @yamt
+
+/product-mini/platforms/darwin/     @yamt
+/product-mini/platforms/nuttx/      @no1wudi
+/product-mini/platforms/windows/    @loganek
+/product-mini/platforms/zephyr/     @srberard

+ 6 - 2
CONTRIBUTING.md

@@ -18,8 +18,12 @@ Code changes
 ===================
 We Use Github Flow, So All Code Changes Happen Through Pull Requests. Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests:
 
-- If you've added code that should be tested, add tests. Ensure the test suite passes.
-- Avoid use macros for different platforms. Use separate folder of source files to host different platform logic.
+ - If you've added / modified code:
+   - Please provide tests to the test suite to validate the operation of your code, or point to existing test cases which do the same. 
+   - Ensure that your new tests pass. This way we ensure that your contribution continues to work as you expected as future contributions are made by other contributors.
+   - Ensure all the existing tests in the test suite pass. This way we can verify that your contribution doesn’t accidentally impact other contributions.
+   - If your contribution is minor and you feel it does not need an additional test case, i.e. updating comments, formatting, simple refactoring, etc. then provide an explanation in your PR comment, i.e. “this is a minor change *explain the change*, and as such [ “is covered by” *list existing test cases* | “is except from addition test contribution”].
+- Avoid using macros for different platforms. Use separate folders for source files to collect together different host platform logic.
 - Put macro definitions inside share_lib/include/config.h if you have to use macro.
 - Make sure your code lints and compliant to our coding style.
 - Extend the application library is highly welcome.

+ 1 - 1
build-scripts/build_llvm.py

@@ -304,7 +304,7 @@ def main():
         "default": {
             "repo": "https://github.com/llvm/llvm-project.git",
             "repo_ssh": "git@github.com:llvm/llvm-project.git",
-            "branch": "release/18.x",
+            "branch": "llvmorg-18.1.8",
         },
     }
 

+ 13 - 1
build-scripts/config_common.cmake

@@ -79,8 +79,14 @@ if (WAMR_BUILD_TARGET MATCHES "ARM.*")
 elseif (WAMR_BUILD_TARGET MATCHES "THUMB.*")
   set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mthumb")
   set (CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,-mthumb")
+elseif (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
+    if (CMAKE_C_COMPILER_ID MATCHES ".*GNU")
+      set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
+      set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mindirect-branch-register")
+    endif ()
 endif ()
 
+
 include (${CMAKE_CURRENT_LIST_DIR}/warnings.cmake)
 
 if (NOT WAMR_BUILD_INTERP EQUAL 1)
@@ -190,7 +196,11 @@ if (NOT WAMR_BUILD_SANITIZER STREQUAL "")
     message(FATAL_ERROR "Unsupported sanitizers: ${INVALID_SANITIZERS}")
   endif()
   # common flags for all sanitizers
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fno-sanitize-recover=all")
+  # clang: warning: the object size sanitizer has no effect at -O0, but is explicitly enabled ... [-Winvalid-command-line-argument]
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O1 -fno-omit-frame-pointer -fno-sanitize-recover=all -fno-sanitize=alignment")
+  if(CMAKE_C_COMPILER_ID MATCHES ".*Clang")
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-sanitize=unsigned-integer-overflow")
+  endif()
   if(SANITIZER_FLAGS)
     string(REPLACE ";" "," SANITIZER_FLAGS_STR "${SANITIZER_FLAGS}")
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${SANITIZER_FLAGS_STR}")
@@ -282,6 +292,8 @@ if (WAMR_BUILD_REF_TYPES EQUAL 1)
   set (WAMR_BUILD_CALL_INDIRECT_OVERLONG 1)
 endif ()
 
+include(${CMAKE_CURRENT_LIST_DIR}/unsupported_combination.cmake)
+
 message ("-- Build Configurations:")
 message ("     Build as target ${WAMR_BUILD_TARGET}")
 message ("     Build for platform ${WAMR_BUILD_PLATFORM}")

+ 101 - 0
build-scripts/unsupported_combination.cmake

@@ -0,0 +1,101 @@
+# Copyright (C) 2019 Intel Corporation.  All rights reserved.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+include(CMakePrintHelpers)
+
+# Define a function to check for unsupported combinations
+function(check_aot_mode_error error_message)
+  if(WAMR_BUILD_AOT EQUAL 1)
+    message(FATAL_ERROR "${error_message}")
+  endif()
+endfunction()
+
+# Define a function to check for unsupported combinations with CLASSIC_INTERP
+function(check_classic_interp_error error_message)
+  # Usually, Enable INTERP to enable wasm loader for JIT
+  # WAMR_BUILD_JIT might be undefined, so check it first
+  if(WAMR_BUILD_JIT EQUAL 1)
+    return()
+  endif()
+
+  if(WAMR_BUILD_FAST_JIT EQUAL 1)
+    return()
+  endif()
+
+  if(WAMR_BUILD_INTERP EQUAL 1 AND WAMR_BUILD_FAST_INTERP EQUAL 0)
+    message(FATAL_ERROR "${error_message}")
+  endif()
+endfunction()
+
+# Define a function to check for unsupported combinations with FAST_INTERP
+function(check_fast_interp_error error_message)
+  # Usually, Enable INTERP to enable wasm loader for JIT
+  # WAMR_BUILD_JIT might be undefined, so check it first
+  if(WAMR_BUILD_JIT EQUAL 1)
+    return()
+  endif()
+
+  if(WAMR_BUILD_FAST_JIT EQUAL 1)
+    return()
+  endif()
+
+  if(WAMR_BUILD_INTERP EQUAL 1 AND WAMR_BUILD_FAST_INTERP EQUAL 1)
+    message(FATAL_ERROR "${error_message}")
+  endif()
+endfunction()
+
+# Define a function to check for unsupported combinations with FAST_JIT
+function(check_fast_jit_error error_message)
+  if(WAMR_BUILD_FAST_JIT EQUAL 1)
+    message(FATAL_ERROR "${error_message}")
+  endif()
+endfunction()
+
+# Define a function to check for unsupported combinations with LLVM_JIT
+function(check_llvm_jit_error error_message)
+  if(WAMR_BUILD_JIT EQUAL 1)
+    message(FATAL_ERROR "${error_message}")
+  endif()
+endfunction()
+
+# Below are the unsupported combinations checks
+# Please keep this list in sync with tests/unit/unsupported-features/CMakeLists.txt
+# and tests/wamr-test-suites/test_wamr.sh
+
+if(WAMR_BUILD_EXCE_HANDLING EQUAL 1)
+  check_aot_mode_error("Unsupported build configuration: EXCE_HANDLING + AOT")
+  check_fast_interp_error("Unsupported build configuration: EXCE_HANDLING + FAST_INTERP")
+  check_fast_jit_error("Unsupported build configuration: EXCE_HANDLING + FAST_JIT")
+  check_llvm_jit_error("Unsupported build configuration: EXCE_HANDLING + JIT")
+endif()
+
+if(WAMR_BUILD_GC EQUAL 1)
+  check_fast_jit_error("Unsupported build configuration: GC + FAST_JIT")
+endif()
+
+if(WAMR_BUILD_MEMORY64 EQUAL 1)
+  check_fast_interp_error("Unsupported build configuration: MEMORY64 + FAST_INTERP")
+  check_fast_jit_error("Unsupported build configuration: MEMORY64 + FAST_JIT")
+  check_llvm_jit_error("Unsupported build configuration: MEMORY64 + JIT")
+endif()
+
+if(WAMR_BUILD_MULTI_MEMORY EQUAL 1)
+  check_aot_mode_error("Unsupported build configuration: MULTI_MEMORY + AOT")
+  check_fast_interp_error("Unsupported build configuration: MULTI_MEMORY + FAST_INTERP")
+  check_fast_jit_error("Unsupported build configuration: MULTI_MEMORY + FAST_JIT")
+  check_llvm_jit_error("Unsupported build configuration: MULTI_MEMORY + JIT")
+endif()
+
+if(WAMR_BUILD_MULTI_MODULE EQUAL 1)
+  check_fast_jit_error("Unsupported build configuration: MULTI_MODULE + FAST_JIT")
+  check_llvm_jit_error("Unsupported build configuration: MULTI_MODULE + JIT")
+endif()
+
+if(WAMR_BUILD_SHARED_HEAP EQUAL 1)
+  check_fast_jit_error("Unsupported build configuration: SHARED_HEAP + FAST_JIT")
+endif()
+
+if(WAMR_BUILD_SIMD EQUAL 1)
+  check_classic_interp_error("Unsupported build configuration: SIMD + CLASSIC_INTERP")
+  check_fast_jit_error("Unsupported build configuration: SIMD + FAST_JIT")
+endif()

+ 3 - 1
ci/coding_guidelines_check.py

@@ -159,7 +159,7 @@ def run_clang_format_diff(root: Path, commits: str) -> bool:
                 found = True
         else:
             return not found
-    except subprocess.subprocess.CalledProcessError:
+    except subprocess.CalledProcessError:
         return False
 
 
@@ -183,12 +183,14 @@ def check_file_name(path: Path) -> bool:
     - docker-compose
     - package-lock
     - vite-env.d
+    - .clang-tidy (standard config file for Clang-Tidy)
     """
     if path.stem in [
         "docker-compose",
         "package-lock",
         "vite-env.d",
         "osv-scanner",
+        ".clang-tidy",
     ]:
         return True
 

+ 400 - 0
ci/install_sgx_for_applicaiton_developer.sh

@@ -0,0 +1,400 @@
+#!/bin/bash
+
+# Reference:
+#   https://cc-enabling.trustedservices.intel.com/intel-sgx-sw-installation-guide-linux/02/installation_instructions/#intel-sgx-application-developer
+
+#TODO:
+# report error when curl fails to download files, e.g. due to network issues or incorrect URLs
+
+set -euo pipefail
+if [ "${DEBUG:-0}" -eq 1 ]; then
+  set -o xtrace
+fi
+
+# Error trap handler - logs failure details and calls cleanup before exit
+error_handler() {
+    local exit_code=$?
+    local line_number=${1:-$LINENO}
+    local bash_lineno=${2:-$BASH_LINENO}
+    local last_command=${3:-$BASH_COMMAND}
+    local function_stack=${4:-${FUNCNAME[*]}}
+
+    # Log error context to file
+    {
+        echo "=== ERROR OCCURRED ==="
+        echo "Exit Code: $exit_code"
+        echo "Line Number: $line_number"
+        echo "Bash Line: $bash_lineno"
+        echo "Failed Command: $last_command"
+        echo "Function Stack: $function_stack"
+        echo "Timestamp: $(date '+%Y-%m-%d %H:%M:%S')"
+        echo "======================"
+    } >> "${LOG_FILE:-/tmp/install_sgx.log}" 2>/dev/null || true
+
+    # Print concise error to stderr
+    echo "ERROR: Script failed at line $line_number with exit code $exit_code" >&2
+    echo "Failed command: $last_command" >&2
+    echo "Check log file: ${LOG_FILE:-/tmp/install_sgx.log}" >&2
+
+    # Call cleanup function if it exists
+    if type cleanup >/dev/null 2>&1; then
+        cleanup || true
+    fi
+
+    exit $exit_code
+}
+
+# Set up error trap
+trap 'error_handler $LINENO $BASH_LINENO "$BASH_COMMAND" "${FUNCNAME[*]}"' ERR
+
+# Platform will be detected dynamically by platform_detect() function
+# Supported platforms: Debian12, Debian11, Ubuntu22.04-server, Ubuntu20.04-server
+PLATFORM=""
+
+# Logging infrastructure
+LOG_FILE="/tmp/install_sgx.log"
+
+# Initialize log file with timestamp
+init_log() {
+    echo "=== Intel SGX Installation Log - $(date) ===" > "${LOG_FILE}"
+    echo "Platform: ${PLATFORM}" >> "${LOG_FILE}"
+    echo "Script: $0" >> "${LOG_FILE}"
+    echo "Started at: $(date '+%Y-%m-%d %H:%M:%S')" >> "${LOG_FILE}"
+    echo "" >> "${LOG_FILE}"
+}
+
+# Log message with timestamp
+log_info() {
+    echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*" >> "${LOG_FILE}"
+}
+
+# Execute command with output redirected to log
+log_exec() {
+    log_info "Executing: $*"
+    "$@" >>"$LOG_FILE" 2>&1
+}
+
+# Print environment sourcing instructions
+print_env_instructions() {
+    log_info "Printing environment setup instructions"
+
+    echo "========================================================================"
+    echo "  IMPORTANT: Before building or running SGX applications, you must run:"
+    echo "      source /opt/intel/sgxsdk/environment"
+    echo "  in your current shell to activate SGX SDK environment variables."
+    echo "========================================================================"
+
+    log_info "Environment setup instructions displayed to user"
+}
+
+check_sgx_packages() {
+    log_info "Checking for existing SGX packages..."
+
+    local packages=("libsgx-quote-ex" "libsgx-dcap-ql" "libsgx-enclave-common-dev" "libsgx-dcap-ql-dev" "libsgx-dcap-default-qpl-dev" "tee-appraisal-tool")
+    local missing_packages=()
+
+    for package in "${packages[@]}"; do
+        if ! dpkg -l "$package" >> "${LOG_FILE}" 2>&1; then
+            missing_packages+=("$package")
+            log_info "Package $package not installed"
+        else
+            log_info "Package $package already installed"
+        fi
+    done
+
+    if [ ${#missing_packages[@]} -eq 0 ]; then
+        log_info "All SGX packages are already installed"
+        return 0
+    else
+        log_info "Missing SGX packages: ${missing_packages[*]}"
+        return 1
+    fi
+}
+
+check_sgx_sdk() {
+    log_info "Checking for existing SGX SDK..."
+
+    if [ -d "/opt/intel/sgxsdk" ] && [ -f "/opt/intel/sgxsdk/environment" ]; then
+        log_info "SGX SDK already installed at /opt/intel/sgxsdk"
+
+        # Validate SDK installation by checking key components
+        if [ -f "/opt/intel/sgxsdk/bin/sgx-gdb" ] && [ -d "/opt/intel/sgxsdk/include" ]; then
+            log_info "SGX SDK installation appears complete"
+            return 0
+        else
+            log_info "SGX SDK installation incomplete - missing key components"
+            return 1
+        fi
+    else
+        log_info "SGX SDK not found"
+        return 1
+    fi
+}
+
+check_sgx_repo() {
+    log_info "Checking for existing SGX local repository..."
+
+    if [ -d "/opt/intel/sgx_debian_local_repo" ] && [ -f "/etc/apt/sources.list.d/sgx_debian_local_repo.list" ]; then
+        log_info "SGX local repository already configured"
+        return 0
+    else
+        log_info "SGX local repository not configured"
+        return 1
+    fi
+}
+
+# Modular installation functions
+
+# Platform detection and configuration
+platform_detect() {
+    log_info "Entering platform_detect() function"
+
+    if [ ! -f "/etc/os-release" ]; then
+        log_info "ERROR: /etc/os-release not found - cannot detect OS"
+        echo "ERROR: Cannot detect operating system. /etc/os-release not found." >&2
+        log_info "Exiting platform_detect() function"
+        return 1
+    fi
+
+    # Parse OS information from /etc/os-release
+    local os_id=$(grep '^ID=' /etc/os-release | cut -d'=' -f2 | tr -d '"')
+    local version_id=$(grep '^VERSION_ID=' /etc/os-release | cut -d'=' -f2 | tr -d '"')
+
+    log_info "Raw OS detection: ID=${os_id}, VERSION_ID=${version_id}"
+
+    # Determine platform string based on OS and version
+    case "${os_id}" in
+        "ubuntu")
+            case "${version_id}" in
+                "20.04")
+                    PLATFORM="Ubuntu20.04-server"
+                    ;;
+                "22.04")
+                    PLATFORM="Ubuntu22.04-server"
+                    ;;
+                *)
+                    log_info "ERROR: Unsupported Ubuntu version ${version_id}. Supported: 20.04, 22.04"
+                    echo "ERROR: Unsupported Ubuntu version ${version_id}. This script supports Ubuntu 20.04 and 22.04 only." >&2
+                    log_info "Exiting platform_detect() function"
+                    return 1
+                    ;;
+            esac
+            ;;
+        "debian")
+            case "${version_id}" in
+                "11")
+                    PLATFORM="Debian11"
+                    ;;
+                "12")
+                    PLATFORM="Debian12"
+                    ;;
+                *)
+                    log_info "ERROR: Unsupported Debian version ${version_id}. Supported: 11, 12"
+                    echo "ERROR: Unsupported Debian version ${version_id}. This script supports Debian 11 and 12 only." >&2
+                    log_info "Exiting platform_detect() function"
+                    return 1
+                    ;;
+            esac
+            ;;
+        *)
+            log_info "ERROR: Unsupported OS ${os_id}. Supported: ubuntu, debian"
+            echo "ERROR: Unsupported operating system '${os_id}'. This script supports Ubuntu and Debian only." >&2
+            log_info "Exiting platform_detect() function"
+            return 1
+            ;;
+    esac
+
+    log_info "Successfully detected platform: ${PLATFORM}"
+    echo "Detected platform: ${PLATFORM}"
+
+    log_info "Exiting platform_detect() function"
+    return 0
+}
+
+# Install SGX packages and SDK
+install_packages() {
+    log_info "Entering install_packages() function"
+
+    # Skip repo setup if already configured
+    if ! check_sgx_repo; then
+        log_info "Setting up SGX local repository..."
+
+        pushd /tmp >> "${LOG_FILE}" 2>&1
+        log_exec curl -fsSLO \
+            https://download.01.org/intel-sgx/latest/linux-latest/distro/${PLATFORM}/sgx_debian_local_repo.tgz
+
+        local_sum=$(sha256sum sgx_debian_local_repo.tgz | awk '{print $1}')
+        remote_sum=$(curl -s https://download.01.org/intel-sgx/latest/dcap-latest/linux/SHA256SUM_dcap_1.24.cfg | grep "distro/${PLATFORM}/sgx_debian_local_repo.tgz" | awk '{print $1}')
+        if [[ "$local_sum" == "$remote_sum" ]]; then
+            log_info "Checksum matches"
+        else
+            log_info "Checksum mismatch!"
+        fi
+
+        log_exec sudo mkdir -p /opt/intel
+        log_exec sudo tar xzf sgx_debian_local_repo.tgz -C /opt/intel
+
+        echo 'deb [signed-by=/etc/apt/keyrings/intel-sgx-keyring.asc arch=amd64] file:///opt/intel/sgx_debian_local_repo bookworm main' \
+            | sudo tee /etc/apt/sources.list.d/sgx_debian_local_repo.list | tee -a "${LOG_FILE}" > /dev/null
+
+        log_exec sudo cp /opt/intel/sgx_debian_local_repo/keys/intel-sgx.key /etc/apt/keyrings/intel-sgx-keyring.asc
+        popd >> "${LOG_FILE}" 2>&1
+    else
+        log_info "SGX repository already configured, skipping setup"
+    fi
+
+    # Install SGX packages only if missing
+    if ! check_sgx_packages; then
+        log_info "Installing missing SGX packages..."
+        log_exec sudo apt-get update
+        log_exec sudo apt-get install -y libsgx-quote-ex libsgx-dcap-ql
+    else
+        log_info "SGX packages already installed, skipping"
+    fi
+
+    # Install build dependencies
+    log_exec sudo apt-get update --quiet
+    log_exec sudo apt-get install --quiet -y build-essential python3
+    log_exec sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
+
+    # Install Intel SGX SDK only if missing
+    if ! check_sgx_sdk; then
+        log_info "Installing Intel SGX SDK for Application Developer..."
+
+        pushd /opt/intel >> "${LOG_FILE}" 2>&1
+        log_exec sudo curl -fsSLo sgx_linux_x64_sdk.bin \
+            https://download.01.org/intel-sgx/latest/linux-latest/distro/${PLATFORM}/sgx_linux_x64_sdk_2.27.100.1.bin
+        log_exec sudo chmod +x sgx_linux_x64_sdk.bin
+        log_exec sudo ./sgx_linux_x64_sdk.bin --prefix /opt/intel
+
+        # Log environment setup instructions for user
+        log_info "SGX SDK installation completed successfully."
+        log_info "IMPORTANT: To use the SGX SDK in your development session:"
+        log_info "  1. Run: source /opt/intel/sgxsdk/environment"
+        log_info "  2. This must be done in each shell session where you use SGX"
+        log_info "  3. Environment variables are session-specific and cannot be exported by this script"
+        log_info "  4. Consider adding 'source /opt/intel/sgxsdk/environment' to your ~/.bashrc for automatic setup"
+        popd >> "${LOG_FILE}" 2>&1
+    else
+        log_info "SGX SDK already installed, skipping"
+    fi
+
+    # Install Developer packages for Intel SGX only if missing
+    if ! check_sgx_packages; then
+        log_info "Installing Intel SGX Developer packages..."
+
+        log_exec sudo apt-get install -y libsgx-enclave-common-dev \
+            libsgx-dcap-ql-dev \
+            libsgx-dcap-default-qpl-dev \
+            tee-appraisal-tool
+    else
+        log_info "SGX Developer packages already installed, skipping"
+    fi
+
+    log_info "Exiting install_packages() function"
+    return 0
+}
+
+# Validate the installation was successful
+validate_installation() {
+    log_info "Entering validate_installation() function"
+
+    local validation_failed=0
+
+    # Re-check all components after installation
+    if ! check_sgx_packages; then
+        log_info "VALIDATION FAILED: SGX packages not properly installed"
+        validation_failed=1
+    fi
+
+    if ! check_sgx_sdk; then
+        log_info "VALIDATION FAILED: SGX SDK not properly installed"
+        validation_failed=1
+    fi
+
+    if ! check_sgx_repo; then
+        log_info "VALIDATION FAILED: SGX repository not properly configured"
+        validation_failed=1
+    fi
+
+    if [ $validation_failed -eq 0 ]; then
+        log_info "VALIDATION SUCCESS: All SGX components properly installed"
+    else
+        log_info "VALIDATION FAILED: Some SGX components failed installation"
+        log_info "Exiting validate_installation() function"
+        return 1
+    fi
+
+    log_info "Exiting validate_installation() function"
+    return 0
+}
+
+# Clean up temporary files
+cleanup() {
+    log_info "Entering cleanup() function"
+
+    # Clean up any temporary files in /tmp related to SGX installation
+    if [ -f "/tmp/sgx_debian_local_repo.tgz" ]; then
+        log_info "Removing temporary SGX repository archive"
+        rm -f /tmp/sgx_debian_local_repo.tgz
+    fi
+
+    # Additional cleanup can be added here as needed
+    log_info "Temporary file cleanup completed"
+
+    log_info "Exiting cleanup() function"
+    return 0
+}
+
+# Initialize logging
+init_log
+
+log_info "Starting idempotency checks..."
+
+# Check if everything is already installed
+if check_sgx_packages && check_sgx_sdk && check_sgx_repo; then
+    log_info "Complete SGX installation detected - no action needed"
+    echo "Intel SGX for Application Developer is already installed and configured."
+    print_env_instructions
+    exit 0
+fi
+
+log_info "Partial or missing SGX installation detected - proceeding with installation"
+
+# Main installation flow using modular functions
+
+log_info "Starting Intel SGX for Application Developer installation..."
+
+# Execute installation steps in modular fashion
+platform_detect
+if [ $? -ne 0 ]; then
+    log_info "Platform detection failed"
+    exit 1
+fi
+
+install_packages
+if [ $? -ne 0 ]; then
+    log_info "Package installation failed"
+    exit 1
+fi
+
+validate_installation
+if [ $? -ne 0 ]; then
+    log_info "Installation validation failed"
+    exit 1
+fi
+
+cleanup
+if [ $? -ne 0 ]; then
+    log_info "Cleanup failed"
+    exit 1
+fi
+
+cleanup
+if [ $? -ne 0 ]; then
+    log_info "Cleanup failed"
+    exit 1
+fi
+
+echo "Intel SGX for Application Developer installation completed."
+print_env_instructions

+ 1 - 1
core/config.h

@@ -84,7 +84,7 @@
 #endif
 
 #define AOT_MAGIC_NUMBER 0x746f6100
-#define AOT_CURRENT_VERSION 5
+#define AOT_CURRENT_VERSION 6
 
 #ifndef WASM_ENABLE_JIT
 #define WASM_ENABLE_JIT 0

+ 8 - 7
core/iwasm/aot/aot_loader.c

@@ -307,7 +307,8 @@ loader_mmap(uint32 size, bool prot_exec, char *error_buf, uint32 error_buf_size)
 #if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64) \
     || defined(BUILD_TARGET_RISCV64_LP64D)                       \
     || defined(BUILD_TARGET_RISCV64_LP64)
-#if !defined(__APPLE__) && !defined(BH_PLATFORM_LINUX_SGX)
+#if !defined(__APPLE__) && !defined(BH_PLATFORM_LINUX_SGX) \
+    && !defined(BH_PLATFORM_NUTTX)
     /* The mmapped AOT data and code in 64-bit targets had better be in
        range 0 to 2G, or aot loader may fail to apply some relocations,
        e.g., R_X86_64_32/R_X86_64_32S/R_X86_64_PC32/R_RISCV_32.
@@ -981,7 +982,7 @@ destroy_init_expr(InitializerExpression *expr)
 #endif
 
 #if WASM_ENABLE_EXTENDED_CONST_EXPR != 0
-    // free left expr and right expr for binary oprand
+    /* free left expr and right expr for binary operand */
     if (!is_expr_binary_op(expr->init_expr_type)) {
         return;
     }
@@ -3227,7 +3228,7 @@ do_text_relocation(AOTModule *module, AOTRelocationGroup *group,
         if (!strncmp(symbol, AOT_FUNC_PREFIX, strlen(AOT_FUNC_PREFIX))) {
             p = symbol + strlen(AOT_FUNC_PREFIX);
             if (*p == '\0'
-                || (func_index = (uint32)atoi(p)) > module->func_count) {
+                || (func_index = (uint32)atoi(p)) >= module->func_count) {
                 set_error_buf_v(error_buf, error_buf_size,
                                 "invalid import symbol %s", symbol);
                 goto check_symbol_fail;
@@ -3261,7 +3262,7 @@ do_text_relocation(AOTModule *module, AOTRelocationGroup *group,
                           strlen("_" AOT_FUNC_PREFIX))) {
             p = symbol + strlen("_" AOT_FUNC_PREFIX);
             if (*p == '\0'
-                || (func_index = (uint32)atoi(p)) > module->func_count) {
+                || (func_index = (uint32)atoi(p)) >= module->func_count) {
                 set_error_buf_v(error_buf, error_buf_size, "invalid symbol %s",
                                 symbol);
                 goto check_symbol_fail;
@@ -3272,7 +3273,7 @@ do_text_relocation(AOTModule *module, AOTRelocationGroup *group,
                           strlen("_" AOT_FUNC_INTERNAL_PREFIX))) {
             p = symbol + strlen("_" AOT_FUNC_INTERNAL_PREFIX);
             if (*p == '\0'
-                || (func_index = (uint32)atoi(p)) > module->func_count) {
+                || (func_index = (uint32)atoi(p)) >= module->func_count) {
                 set_error_buf_v(error_buf, error_buf_size, "invalid symbol %s",
                                 symbol);
                 goto check_symbol_fail;
@@ -3462,7 +3463,7 @@ do_data_relocation(AOTModule *module, AOTRelocationGroup *group,
             char *p = symbol + strlen(AOT_FUNC_PREFIX);
             uint32 func_index;
             if (*p == '\0'
-                || (func_index = (uint32)atoi(p)) > module->func_count) {
+                || (func_index = (uint32)atoi(p)) >= module->func_count) {
                 set_error_buf_v(error_buf, error_buf_size,
                                 "invalid relocation symbol %s", symbol);
                 return false;
@@ -3871,7 +3872,7 @@ load_relocation_section(const uint8 *buf, const uint8 *buf_end,
                 read_uint32(buf, buf_end, offset32);
                 relocation->relocation_offset = (uint64)offset32;
                 read_uint32(buf, buf_end, addend32);
-                relocation->relocation_addend = (uint64)addend32;
+                relocation->relocation_addend = (int64)(int32)addend32;
             }
             read_uint32(buf, buf_end, relocation->relocation_type);
             read_uint32(buf, buf_end, symbol_index);

+ 34 - 12
core/iwasm/aot/aot_runtime.c

@@ -1963,6 +1963,12 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
     module_inst->e =
         (WASMModuleInstanceExtra *)((uint8 *)module_inst + extra_info_offset);
     extra = (AOTModuleInstanceExtra *)module_inst->e;
+#if WASM_ENABLE_THREAD_MGR != 0
+    if (os_mutex_init(&extra->common.exception_lock) != 0) {
+        wasm_runtime_free(module_inst);
+        return NULL;
+    }
+#endif
 
 #if WASM_ENABLE_GC != 0
     /* Initialize gc heap first since it may be used when initializing
@@ -2081,17 +2087,25 @@ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
 
 #if WASM_ENABLE_LIBC_WASI != 0
     if (!is_sub_inst) {
+        const WASIArguments *wasi_args = &args->wasi;
+        if (module->wasi_args.set_by_user) {
+            if (wasi_args->set_by_user) {
+                set_error_buf(error_buf, error_buf_size,
+                              "WASI configuration was given via both of module "
+                              "and InstantiationArgs2");
+                goto fail;
+            }
+            wasi_args = &module->wasi_args;
+        }
         if (!wasm_runtime_init_wasi(
-                (WASMModuleInstanceCommon *)module_inst,
-                module->wasi_args.dir_list, module->wasi_args.dir_count,
-                module->wasi_args.map_dir_list, module->wasi_args.map_dir_count,
-                module->wasi_args.env, module->wasi_args.env_count,
-                module->wasi_args.addr_pool, module->wasi_args.addr_count,
-                module->wasi_args.ns_lookup_pool,
-                module->wasi_args.ns_lookup_count, module->wasi_args.argv,
-                module->wasi_args.argc, module->wasi_args.stdio[0],
-                module->wasi_args.stdio[1], module->wasi_args.stdio[2],
-                error_buf, error_buf_size))
+                (WASMModuleInstanceCommon *)module_inst, wasi_args->dir_list,
+                wasi_args->dir_count, wasi_args->map_dir_list,
+                wasi_args->map_dir_count, wasi_args->env, wasi_args->env_count,
+                wasi_args->addr_pool, wasi_args->addr_count,
+                wasi_args->ns_lookup_pool, wasi_args->ns_lookup_count,
+                wasi_args->argv, wasi_args->argc, wasi_args->stdio[0],
+                wasi_args->stdio[1], wasi_args->stdio[2], error_buf,
+                error_buf_size))
             goto fail;
     }
 #endif
@@ -2345,6 +2359,10 @@ aot_deinstantiate(AOTModuleInstance *module_inst, bool is_sub_inst)
         wasm_exec_env_destroy((WASMExecEnv *)module_inst->exec_env_singleton);
     }
 
+#if WASM_ENABLE_THREAD_MGR != 0
+    os_mutex_destroy(&extra->common.exception_lock);
+#endif
+
 #if WASM_ENABLE_PERF_PROFILING != 0
     if (module_inst->func_perf_profilings)
         wasm_runtime_free(module_inst->func_perf_profilings);
@@ -2477,6 +2495,7 @@ invoke_native_with_hw_bound_check(WASMExecEnv *exec_env, void *func_ptr,
        native stack to run the following codes before actually calling
        the aot function in invokeNative function. */
     if (!wasm_runtime_detect_native_stack_overflow(exec_env)) {
+        wasm_runtime_set_exec_env_tls(NULL);
         return false;
     }
 
@@ -4167,7 +4186,8 @@ aot_alloc_tiny_frame(WASMExecEnv *exec_env, uint32 func_index)
 {
     AOTTinyFrame *new_frame = (AOTTinyFrame *)exec_env->wasm_stack.top;
 
-    if ((uint8 *)new_frame > exec_env->wasm_stack.top_boundary) {
+    if ((uint8 *)new_frame + sizeof(AOTTinyFrame)
+        > exec_env->wasm_stack.top_boundary) {
         aot_set_exception((WASMModuleInstance *)exec_env->module_inst,
                           "wasm operand stack overflow");
         return false;
@@ -4323,6 +4343,7 @@ aot_copy_callstack_tiny_frame(WASMExecEnv *exec_env, WASMCApiFrame *buffer,
 
     AOTTinyFrame *frame = (AOTTinyFrame *)(top - sizeof(AOTTinyFrame));
     WASMCApiFrame record_frame;
+    memset(&record_frame, 0, sizeof(WASMCApiFrame));
     while (frame && (uint8_t *)frame >= bottom && count < (skip_n + length)) {
         if (count < skip_n) {
             ++count;
@@ -4365,6 +4386,7 @@ aot_copy_callstack_standard_frame(WASMExecEnv *exec_env, WASMCApiFrame *buffer,
     uint32 frame_size = (uint32)offsetof(AOTFrame, lp);
 
     WASMCApiFrame record_frame;
+    memset(&record_frame, 0, sizeof(WASMCApiFrame));
     while (cur_frame && (uint8_t *)cur_frame >= bottom
            && (uint8_t *)cur_frame + frame_size <= top_boundary
            && count < (skip_n + length)) {
@@ -4690,7 +4712,7 @@ static bool
 cmpxchg_ptr(void **ptr, void *old_val, void *new_val)
 {
 #if defined(os_atomic_cmpxchg)
-    return os_atomic_cmpxchg(ptr, &old_val, new_val);
+    return os_atomic_cmpxchg((_Atomic(void *) *)ptr, &old_val, new_val);
 #else
     /* TODO: add lock when thread-manager is enabled */
     void *read = *ptr;

+ 8 - 0
core/iwasm/aot/arch/aot_reloc_thumb.c

@@ -52,6 +52,10 @@ void __aeabi_idivmod(void);
 void __aeabi_l2d(void);
 void __aeabi_l2f(void);
 void __aeabi_ldivmod(void);
+void __aeabi_memclr(void);
+void __aeabi_memcpy(void);
+void __aeabi_memmove(void);
+void __aeabi_memset(void);
 void __aeabi_llsl(void);
 void __aeabi_llsr(void);
 void __aeabi_lmul(void);
@@ -171,6 +175,10 @@ static SymbolMap target_sym_map[] = {
     REG_SYM(__aeabi_l2d),
     REG_SYM(__aeabi_l2f),
     REG_SYM(__aeabi_ldivmod),
+    REG_SYM(__aeabi_memclr),
+    REG_SYM(__aeabi_memcpy),
+    REG_SYM(__aeabi_memmove),
+    REG_SYM(__aeabi_memset),
     REG_SYM(__aeabi_llsl),
     REG_SYM(__aeabi_llsr),
     REG_SYM(__aeabi_lmul),

+ 20 - 12
core/iwasm/common/arch/invokeNative_thumb.s

@@ -12,7 +12,7 @@ invokeNative:
         .globl _invokeNative
 _invokeNative:
 #endif /* end of BH_PLATFORM_DARWIN */
-
+        .cfi_startproc
 /*
  * Arguments passed in:
  *
@@ -24,34 +24,40 @@ _invokeNative:
         push    {r4, r5, r6, r7}
         push    {lr}
         sub     sp, sp, #4      /* make sp 8 byte aligned */
+        .cfi_def_cfa_offset 24
+        .cfi_offset lr, -20
+        .cfi_offset r4, -16
+        .cfi_offset r5, -12
+        .cfi_offset r6, -8
+        .cfi_offset r7, -4
         mov     ip, r0          /* ip = function ptr */
         mov     r4, r1          /* r4 = argv */
         mov     r5, r2          /* r5 = argc */
 
         cmp     r5, #1          /* at least one argument required: exec_env */
-        blt     return
+        blt     .Lreturn
 
         mov     r6, #0          /* increased stack size */
 
         ldr     r0, [r4]        /* r0 = argv[0] = exec_env */
         add     r4, r4, #4      /* r4 += 4 */
         cmp     r5, #1
-        beq     call_func
+        beq     .Lcall_func
 
         ldr     r1, [r4]        /* r1 = argv[1] */
         add     r4, r4, #4
         cmp     r5, #2
-        beq     call_func
+        beq     .Lcall_func
 
         ldr     r2, [r4]        /* r2 = argv[2] */
         add     r4, r4, #4
         cmp     r5, #3
-        beq     call_func
+        beq     .Lcall_func
 
         ldr     r3, [r4]        /* r3 = argv[3] */
         add     r4, r4, #4
         cmp     r5, #4
-        beq     call_func
+        beq     .Lcall_func
 
         sub    r5, r5, #4       /* argc -= 4, now we have r0 ~ r3 */
 
@@ -66,29 +72,31 @@ _invokeNative:
         mov     sp, r7
 
         mov     lr, r2          /* save r2 */
-loop_args:                      /* copy left arguments to stack */
+
+.Lloop_args:                      /* copy left arguments to stack */
         cmp     r5, #0
-        beq     call_func1
+        beq     .Lcall_func1
         ldr     r2, [r4]
         add     r4, r4, #4
         str     r2, [r7]
         add     r7, r7, #4
         sub     r5, r5, #1
-        b       loop_args
+        b       .Lloop_args
 
-call_func1:
+.Lcall_func1:
         mov     r2, lr          /* restore r2 */
 
-call_func:
+.Lcall_func:
         blx     ip
         add     sp, sp, r6       /* restore sp */
 
-return:
+.Lreturn:
         add     sp, sp, #4      /* make sp 8 byte aligned */
         pop     {r3}
         pop     {r4, r5, r6, r7}
         mov     lr, r3
         bx      lr
+        .cfi_endproc
 #if defined(__linux__) && defined(__ELF__)
 .section .note.GNU-stack,"",%progbits
 #endif

+ 16 - 8
core/iwasm/common/arch/invokeNative_thumb_vfp.s

@@ -12,7 +12,7 @@ invokeNative:
         .globl _invokeNative
 _invokeNative:
 #endif /* end of BH_PLATFORM_DARWIN */
-
+        .cfi_startproc
 /*
  * Arguments passed in:
  *
@@ -24,10 +24,17 @@ _invokeNative:
         push    {r4, r5, r6, r7}
         push    {lr}
         sub     sp, sp, #4      /* make sp 8 byte aligned */
+        .cfi_def_cfa_offset 24
+        .cfi_offset lr, -20
+        .cfi_offset r4, -16
+        .cfi_offset r5, -12
+        .cfi_offset r6, -8
+        .cfi_offset r7, -4
         mov     ip, r0          /* ip = function ptr */
         mov     r4, r1          /* r4 = argv */
         mov     r5, r2          /* r5 = nstacks */
         mov     r7, sp
+        .cfi_def_cfa r7, 24
 
         /* Fill all int args */
         ldr     r0, [r4, #0]    /* r0 = *(int*)&argv[0] = exec_env */
@@ -57,7 +64,7 @@ _invokeNative:
         vldr    s15, [r4, #60]
         /* Directly call the function if no args in stack */
         cmp     r5, #0
-        beq     call_func
+        beq     .Lcall_func
 
         mov     lr, r2          /* save r2 */
 
@@ -73,30 +80,31 @@ _invokeNative:
         mov     r7, sp
         mov     sp, r6
 
-loop_stack_args:                /* copy stack arguments to stack */
+.Lloop_stack_args:                /* copy stack arguments to stack */
         cmp     r5, #0
-        beq     call_func1
+        beq     .Lcall_func1
         ldr     r2, [r4]         /* Note: caller should insure int64 and */
         add     r4, r4, #4       /* double are placed in 8 bytes aligned address */
         str     r2, [r6]
         add     r6, r6, #4
 
         sub     r5, r5, #1
-        b       loop_stack_args
+        b       .Lloop_stack_args
 
-call_func1:
+.Lcall_func1:
         mov     r2, lr          /* restore r2 */
 
-call_func:
+.Lcall_func:
         blx     ip
         mov     sp, r7          /* restore sp */
 
-return:
+.Lreturn:
         add     sp, sp, #4      /* make sp 8 byte aligned */
         pop     {r3}
         pop     {r4, r5, r6, r7}
         mov     lr, r3
         bx      lr
+        .cfi_endproc
 
 #if defined(__linux__) && defined(__ELF__)
 .section .note.GNU-stack,"",%progbits

+ 9 - 1
core/iwasm/common/gc/gc_common.c

@@ -352,7 +352,15 @@ wasm_ref_type_set_heap_type(wasm_ref_type_t *ref_type, bool nullable,
 {
     bool ret;
 
-    bh_assert(heap_type <= HEAP_TYPE_FUNC && heap_type >= HEAP_TYPE_NONE);
+    bh_assert((heap_type >= HEAP_TYPE_ARRAY && heap_type <= HEAP_TYPE_NOFUNC)
+#if WASM_ENABLE_STRINGREF != 0
+              || heap_type == HEAP_TYPE_STRINGREF
+              || heap_type == HEAP_TYPE_STRINGVIEWWTF8
+              || heap_type == HEAP_TYPE_STRINGVIEWWTF16
+              || heap_type == HEAP_TYPE_STRINGVIEWITER
+#endif
+    );
+
     ref_type->value_type =
         nullable ? VALUE_TYPE_HT_NULLABLE_REF : VALUE_TYPE_HT_NON_NULLABLE_REF;
     ref_type->nullable = nullable;

+ 8 - 6
core/iwasm/common/gc/gc_type.h

@@ -269,18 +269,20 @@ wasm_is_refheaptype_typeidx(const RefHeapType_Common *ref_heap_type)
     return ref_heap_type->heap_type >= 0 ? true : false;
 }
 
-/* Whether a ref heap type is a common type: func/any/eq/i31/data,
-   not (type i) or (rtt n i) or (rtt i) */
+/* Whether a ref heap type is a common type:
+   func/any/eq/i31/data/nofunc/noextern, not (type i) or (rtt n i) or (rtt i) */
 inline static bool
 wasm_is_refheaptype_common(const RefHeapType_Common *ref_heap_type)
 {
     return ((ref_heap_type->heap_type >= (int32)HEAP_TYPE_ARRAY
-             && ref_heap_type->heap_type <= (int32)HEAP_TYPE_NONE)
+             && ref_heap_type->heap_type <= (int32)HEAP_TYPE_NOFUNC)
 #if WASM_ENABLE_STRINGREF != 0
-            || (ref_heap_type->heap_type >= (int32)HEAP_TYPE_STRINGVIEWITER
-                && ref_heap_type->heap_type <= (int32)HEAP_TYPE_I31)
+            || ref_heap_type->heap_type == (int32)HEAP_TYPE_STRINGREF
+            || ref_heap_type->heap_type == (int32)HEAP_TYPE_STRINGVIEWWTF8
+            || ref_heap_type->heap_type == (int32)HEAP_TYPE_STRINGVIEWWTF16
+            || ref_heap_type->heap_type == (int32)HEAP_TYPE_STRINGVIEWITER
 #endif
-                )
+            )
                ? true
                : false;
 }

+ 13 - 4
core/iwasm/common/wasm_c_api.c

@@ -3459,9 +3459,16 @@ failed:
         wasm_runtime_free(argv);
 
 #if WASM_ENABLE_DUMP_CALL_STACK != 0 && WASM_ENABLE_THREAD_MGR != 0
-    WASMCluster *cluster = wasm_exec_env_get_cluster(exec_env);
-    cluster_frames = &cluster->exception_frames;
-    wasm_cluster_traverse_lock(exec_env);
+    WASMCluster *cluster = NULL;
+    if (exec_env) {
+        cluster = wasm_exec_env_get_cluster(exec_env);
+    }
+    if (cluster) {
+        cluster_frames = &cluster->exception_frames;
+    }
+    if (cluster_frames) {
+        wasm_cluster_traverse_lock(exec_env);
+    }
 #endif
 
     wasm_trap_t *trap = wasm_trap_new_internal(
@@ -3469,7 +3476,9 @@ failed:
         wasm_runtime_get_exception(func->inst_comm_rt), cluster_frames);
 
 #if WASM_ENABLE_DUMP_CALL_STACK != 0 && WASM_ENABLE_THREAD_MGR != 0
-    wasm_cluster_traverse_unlock(exec_env);
+    if (cluster_frames) {
+        wasm_cluster_traverse_unlock(exec_env);
+    }
 #endif
     return trap;
 }

+ 108 - 41
core/iwasm/common/wasm_memory.c

@@ -162,10 +162,73 @@ runtime_malloc(uint64 size)
     return mem;
 }
 
+static void
+destroy_runtime_managed_shared_heap(WASMSharedHeap *heap)
+{
+    uint64 map_size;
+
+    mem_allocator_destroy(heap->heap_handle);
+    wasm_runtime_free(heap->heap_handle);
+    heap->heap_handle = NULL;
+
+#ifndef OS_ENABLE_HW_BOUND_CHECK
+    map_size = heap->size;
+#else
+    map_size = 8 * (uint64)BH_GB;
+#endif
+    wasm_munmap_linear_memory(heap->base_addr, heap->size, map_size);
+    heap->base_addr = NULL;
+}
+
+static bool
+create_runtime_managed_shared_heap(WASMSharedHeap *heap,
+                                   uint64 heap_struct_size)
+{
+    uint64 map_size;
+
+    heap->heap_handle = runtime_malloc(mem_allocator_get_heap_struct_size());
+    if (!heap->heap_handle) {
+        heap->base_addr = NULL;
+        return false;
+    }
+
+#ifndef OS_ENABLE_HW_BOUND_CHECK
+    map_size = heap->size;
+#else
+    /* Totally 8G is mapped, the opcode load/store address range is 0 to 8G:
+     *   ea = i + memarg.offset
+     * both i and memarg.offset are u32 in range 0 to 4G
+     * so the range of ea is 0 to 8G
+     */
+    map_size = 8 * (uint64)BH_GB;
+#endif
+
+    if (!(heap->base_addr = wasm_mmap_linear_memory(map_size, heap->size))) {
+        goto fail1;
+    }
+    if (!mem_allocator_create_with_struct_and_pool(
+            heap->heap_handle, heap_struct_size, heap->base_addr, heap->size)) {
+        LOG_WARNING("init share heap failed");
+        goto fail2;
+    }
+
+    LOG_VERBOSE("Create runtime managed shared heap %p with size %u",
+                heap->base_addr, (uint32)heap->size);
+    return true;
+
+fail2:
+    wasm_munmap_linear_memory(heap->base_addr, heap->size, map_size);
+fail1:
+    wasm_runtime_free(heap->heap_handle);
+    heap->heap_handle = NULL;
+    heap->base_addr = NULL;
+    return false;
+}
+
 WASMSharedHeap *
 wasm_runtime_create_shared_heap(SharedHeapInitArgs *init_args)
 {
-    uint64 heap_struct_size = sizeof(WASMSharedHeap), map_size;
+    uint64 heap_struct_size = sizeof(WASMSharedHeap);
     uint32 size = init_args->size;
     WASMSharedHeap *heap;
 
@@ -178,6 +241,11 @@ wasm_runtime_create_shared_heap(SharedHeapInitArgs *init_args)
     }
 
     size = align_uint(size, os_getpagesize());
+    if (size != init_args->size) {
+        LOG_WARNING("Shared heap size aligned from %u to %u", init_args->size,
+                    size);
+    }
+
     if (size > APP_HEAP_SIZE_MAX || size < APP_HEAP_SIZE_MIN) {
         LOG_WARNING("Invalid size of shared heap");
         goto fail2;
@@ -203,32 +271,9 @@ wasm_runtime_create_shared_heap(SharedHeapInitArgs *init_args)
                     heap->base_addr, size);
     }
     else {
-        if (!(heap->heap_handle =
-                  runtime_malloc(mem_allocator_get_heap_struct_size()))) {
+        if (!create_runtime_managed_shared_heap(heap, heap_struct_size)) {
             goto fail2;
         }
-
-#ifndef OS_ENABLE_HW_BOUND_CHECK
-        map_size = size;
-#else
-        /* Totally 8G is mapped, the opcode load/store address range is 0 to 8G:
-         *   ea = i + memarg.offset
-         * both i and memarg.offset are u32 in range 0 to 4G
-         * so the range of ea is 0 to 8G
-         */
-        map_size = 8 * (uint64)BH_GB;
-#endif
-
-        if (!(heap->base_addr = wasm_mmap_linear_memory(map_size, size))) {
-            goto fail3;
-        }
-        if (!mem_allocator_create_with_struct_and_pool(
-                heap->heap_handle, heap_struct_size, heap->base_addr, size)) {
-            LOG_WARNING("init share heap failed");
-            goto fail4;
-        }
-        LOG_VERBOSE("Create pool shared heap %p with size %u", heap->base_addr,
-                    size);
     }
 
     os_mutex_lock(&shared_heap_list_lock);
@@ -242,10 +287,6 @@ wasm_runtime_create_shared_heap(SharedHeapInitArgs *init_args)
     os_mutex_unlock(&shared_heap_list_lock);
     return heap;
 
-fail4:
-    wasm_munmap_linear_memory(heap->base_addr, size, map_size);
-fail3:
-    wasm_runtime_free(heap->heap_handle);
 fail2:
     wasm_runtime_free(heap);
 fail1:
@@ -339,6 +380,40 @@ wasm_runtime_unchain_shared_heaps(WASMSharedHeap *head, bool entire_chain)
     return cur;
 }
 
+bool
+wasm_runtime_reset_shared_heap_chain(WASMSharedHeap *shared_heap)
+{
+    uint64 heap_struct_size = sizeof(WASMSharedHeap);
+    WASMSharedHeap *cur;
+
+    if (!shared_heap) {
+        return false;
+    }
+
+    os_mutex_lock(&shared_heap_list_lock);
+    if (shared_heap->attached_count != 0) {
+        os_mutex_unlock(&shared_heap_list_lock);
+        return false;
+    }
+
+    for (cur = shared_heap; cur; cur = cur->chain_next) {
+        if (cur->heap_handle) {
+            destroy_runtime_managed_shared_heap(cur);
+
+            if (!create_runtime_managed_shared_heap(cur, heap_struct_size)) {
+                os_mutex_unlock(&shared_heap_list_lock);
+                return false;
+            }
+        }
+        else {
+            memset(cur->base_addr, 0, (size_t)cur->size);
+        }
+    }
+
+    os_mutex_unlock(&shared_heap_list_lock);
+    return true;
+}
+
 static uint8 *
 get_last_used_shared_heap_base_addr_adj(WASMModuleInstanceCommon *module_inst)
 {
@@ -726,10 +801,9 @@ wasm_runtime_shared_heap_malloc(WASMModuleInstanceCommon *module_inst,
         *p_native_addr = native_addr;
     }
 
-    return memory->is_memory64
-               ? shared_heap->start_off_mem64
-               : shared_heap->start_off_mem32
-                     + ((uint8 *)native_addr - shared_heap->base_addr);
+    return (memory->is_memory64 ? shared_heap->start_off_mem64
+                                : shared_heap->start_off_mem32)
+           + (uintptr_t)((uint8 *)native_addr - shared_heap->base_addr);
 }
 
 void
@@ -830,14 +904,7 @@ destroy_shared_heaps()
         cur = heap;
         heap = heap->next;
         if (cur->heap_handle) {
-            mem_allocator_destroy(cur->heap_handle);
-            wasm_runtime_free(cur->heap_handle);
-#ifndef OS_ENABLE_HW_BOUND_CHECK
-            map_size = cur->size;
-#else
-            map_size = 8 * (uint64)BH_GB;
-#endif
-            wasm_munmap_linear_memory(cur->base_addr, cur->size, map_size);
+            destroy_runtime_managed_shared_heap(cur);
         }
         wasm_runtime_free(cur);
     }

+ 3 - 0
core/iwasm/common/wasm_memory.h

@@ -95,6 +95,9 @@ wasm_runtime_chain_shared_heaps(WASMSharedHeap *head, WASMSharedHeap *body);
 WASMSharedHeap *
 wasm_runtime_unchain_shared_heaps(WASMSharedHeap *head, bool entire_chain);
 
+bool
+wasm_runtime_reset_shared_heap_chain(WASMSharedHeap *shared_heap);
+
 bool
 wasm_runtime_attach_shared_heap(WASMModuleInstanceCommon *module_inst,
                                 WASMSharedHeap *shared_heap);

+ 132 - 97
core/iwasm/common/wasm_native.c

@@ -663,39 +663,44 @@ wasm_native_destroy()
 
 #if WASM_ENABLE_QUICK_AOT_ENTRY != 0
 static void
-invoke_no_args_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_no_args_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *) = func_ptr;
     native_code(exec_env);
+    (void)argv;
+    (void)argv_ret;
 }
 static void
-invoke_no_args_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_no_args_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *) = func_ptr;
-    argv_ret[0] = native_code(exec_env);
+    argv_ret[0] = (uint32)native_code(exec_env);
+    (void)argv;
 }
 static void
-invoke_no_args_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_no_args_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *) = func_ptr;
     int64 ret = native_code(exec_env);
     PUT_I64_TO_ADDR(argv_ret, ret);
+    (void)argv;
 }
 
 static void
-invoke_i_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_i_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int32) = func_ptr;
     native_code(exec_env, argv[0]);
+    (void)argv_ret;
 }
 static void
-invoke_i_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_i_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int32) = func_ptr;
     argv_ret[0] = native_code(exec_env, argv[0]);
 }
 static void
-invoke_i_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_i_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int32) = func_ptr;
     int64 ret = native_code(exec_env, argv[0]);
@@ -703,19 +708,20 @@ invoke_i_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_I_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_I_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int64) = func_ptr;
     native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv));
+    (void)argv_ret;
 }
 static void
-invoke_I_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_I_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int64) = func_ptr;
     argv_ret[0] = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv));
 }
 static void
-invoke_I_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_I_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int64) = func_ptr;
     int64 ret = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv));
@@ -723,19 +729,20 @@ invoke_I_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_ii_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_ii_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int32, int32) = func_ptr;
     native_code(exec_env, argv[0], argv[1]);
+    (void)argv_ret;
 }
 static void
-invoke_ii_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_ii_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int32, int32) = func_ptr;
     argv_ret[0] = native_code(exec_env, argv[0], argv[1]);
 }
 static void
-invoke_ii_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_ii_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int32, int32) = func_ptr;
     int64 ret = native_code(exec_env, argv[0], argv[1]);
@@ -743,20 +750,21 @@ invoke_ii_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_iI_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iI_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int32, int64) = func_ptr;
     native_code(exec_env, argv[0], GET_I64_FROM_ADDR((uint32 *)argv + 1));
+    (void)argv_ret;
 }
 static void
-invoke_iI_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iI_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int32, int64) = func_ptr;
     argv_ret[0] =
         native_code(exec_env, argv[0], GET_I64_FROM_ADDR((uint32 *)argv + 1));
 }
 static void
-invoke_iI_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iI_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int32, int64) = func_ptr;
     int64 ret =
@@ -765,20 +773,21 @@ invoke_iI_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_Ii_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_Ii_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int64, int32) = func_ptr;
     native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv), argv[2]);
+    (void)argv_ret;
 }
 static void
-invoke_Ii_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_Ii_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int64, int32) = func_ptr;
     argv_ret[0] =
         native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv), argv[2]);
 }
 static void
-invoke_Ii_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_Ii_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int64, int32) = func_ptr;
     int64 ret =
@@ -787,21 +796,22 @@ invoke_Ii_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_II_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_II_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int64, int64) = func_ptr;
     native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
                 GET_I64_FROM_ADDR((uint32 *)argv + 2));
+    (void)argv_ret;
 }
 static void
-invoke_II_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_II_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int64, int64) = func_ptr;
     argv_ret[0] = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
                               GET_I64_FROM_ADDR((uint32 *)argv + 2));
 }
 static void
-invoke_II_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_II_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int64, int64) = func_ptr;
     int64 ret = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
@@ -810,19 +820,20 @@ invoke_II_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_iii_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iii_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int32, int32, int32) = func_ptr;
     native_code(exec_env, argv[0], argv[1], argv[2]);
+    (void)argv_ret;
 }
 static void
-invoke_iii_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iii_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int32, int32, int32) = func_ptr;
     argv_ret[0] = native_code(exec_env, argv[0], argv[1], argv[2]);
 }
 static void
-invoke_iii_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iii_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int32, int32, int32) = func_ptr;
     int64 ret = native_code(exec_env, argv[0], argv[1], argv[2]);
@@ -830,21 +841,22 @@ invoke_iii_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_iiI_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiI_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int32, int32, int64) = func_ptr;
     native_code(exec_env, argv[0], argv[1],
                 GET_I64_FROM_ADDR((uint32 *)argv + 2));
+    (void)argv_ret;
 }
 static void
-invoke_iiI_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiI_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int32, int32, int64) = func_ptr;
     argv_ret[0] = native_code(exec_env, argv[0], argv[1],
                               GET_I64_FROM_ADDR((uint32 *)argv + 2));
 }
 static void
-invoke_iiI_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiI_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int32, int32, int64) = func_ptr;
     int64 ret = native_code(exec_env, argv[0], argv[1],
@@ -853,21 +865,22 @@ invoke_iiI_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_iIi_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iIi_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int32, int64, int32) = func_ptr;
     native_code(exec_env, argv[0], GET_I64_FROM_ADDR((uint32 *)argv + 1),
                 argv[3]);
+    (void)argv_ret;
 }
 static void
-invoke_iIi_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iIi_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int32, int64, int32) = func_ptr;
     argv_ret[0] = native_code(exec_env, argv[0],
                               GET_I64_FROM_ADDR((uint32 *)argv + 1), argv[3]);
 }
 static void
-invoke_iIi_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iIi_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int32, int64, int32) = func_ptr;
     int64 ret = native_code(exec_env, argv[0],
@@ -876,14 +889,15 @@ invoke_iIi_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_iII_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iII_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int32, int64, int64) = func_ptr;
     native_code(exec_env, argv[0], GET_I64_FROM_ADDR((uint32 *)argv + 1),
                 GET_I64_FROM_ADDR((uint32 *)argv + 3));
+    (void)argv_ret;
 }
 static void
-invoke_iII_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iII_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int32, int64, int64) = func_ptr;
     argv_ret[0] =
@@ -891,7 +905,7 @@ invoke_iII_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
                     GET_I64_FROM_ADDR((uint32 *)argv + 3));
 }
 static void
-invoke_iII_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iII_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int32, int64, int64) = func_ptr;
     int64 ret =
@@ -901,20 +915,21 @@ invoke_iII_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_Iii_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_Iii_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int64, int32, int32) = func_ptr;
     native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv), argv[2], argv[3]);
+    (void)argv_ret;
 }
 static void
-invoke_Iii_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_Iii_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int64, int32, int32) = func_ptr;
     argv_ret[0] = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
                               argv[2], argv[3]);
 }
 static void
-invoke_Iii_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_Iii_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int64, int32, int32) = func_ptr;
     int64 ret = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
@@ -923,21 +938,22 @@ invoke_Iii_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_IiI_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IiI_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int64, int32, int64) = func_ptr;
     native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv), argv[2],
                 GET_I64_FROM_ADDR((uint32 *)argv + 3));
+    (void)argv_ret;
 }
 static void
-invoke_IiI_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IiI_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int64, int32, int64) = func_ptr;
     argv_ret[0] = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
                               argv[2], GET_I64_FROM_ADDR((uint32 *)argv + 3));
 }
 static void
-invoke_IiI_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IiI_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int64, int32, int64) = func_ptr;
     int64 ret = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
@@ -946,21 +962,22 @@ invoke_IiI_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_IIi_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IIi_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int64, int64, int32) = func_ptr;
     native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
                 GET_I64_FROM_ADDR((uint32 *)argv + 2), argv[4]);
+    (void)argv_ret;
 }
 static void
-invoke_IIi_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IIi_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int64, int64, int32) = func_ptr;
     argv_ret[0] = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
                               GET_I64_FROM_ADDR((uint32 *)argv + 2), argv[4]);
 }
 static void
-invoke_IIi_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IIi_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int64, int64, int32) = func_ptr;
     int64 ret = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
@@ -969,15 +986,16 @@ invoke_IIi_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_III_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_III_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int64, int64, int64) = func_ptr;
     native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
                 GET_I64_FROM_ADDR((uint32 *)argv + 2),
                 GET_I64_FROM_ADDR((uint32 *)argv + 4));
+    (void)argv_ret;
 }
 static void
-invoke_III_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_III_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int64, int64, int64) = func_ptr;
     argv_ret[0] = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
@@ -985,7 +1003,7 @@ invoke_III_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
                               GET_I64_FROM_ADDR((uint32 *)argv + 4));
 }
 static void
-invoke_III_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_III_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int64, int64, int64) = func_ptr;
     int64 ret = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
@@ -995,19 +1013,20 @@ invoke_III_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_iiii_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiii_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int32, int32, int32, int32) = func_ptr;
     native_code(exec_env, argv[0], argv[1], argv[2], argv[3]);
+    (void)argv_ret;
 }
 static void
-invoke_iiii_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiii_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int32, int32, int32, int32) = func_ptr;
     argv_ret[0] = native_code(exec_env, argv[0], argv[1], argv[2], argv[3]);
 }
 static void
-invoke_iiii_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiii_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int32, int32, int32, int32) = func_ptr;
     int64 ret = native_code(exec_env, argv[0], argv[1], argv[2], argv[3]);
@@ -1015,21 +1034,22 @@ invoke_iiii_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_iiiI_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiiI_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int32, int32, int32, int64) = func_ptr;
     native_code(exec_env, argv[0], argv[1], argv[2],
                 GET_I64_FROM_ADDR((uint32 *)argv + 3));
+    (void)argv_ret;
 }
 static void
-invoke_iiiI_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiiI_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int32, int32, int32, int64) = func_ptr;
     argv_ret[0] = native_code(exec_env, argv[0], argv[1], argv[2],
                               GET_I64_FROM_ADDR((uint32 *)argv + 3));
 }
 static void
-invoke_iiiI_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiiI_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int32, int32, int32, int64) = func_ptr;
     int64 ret = native_code(exec_env, argv[0], argv[1], argv[2],
@@ -1038,21 +1058,22 @@ invoke_iiiI_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_iiIi_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiIi_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int32, int32, int64, int32) = func_ptr;
     native_code(exec_env, argv[0], argv[1],
                 GET_I64_FROM_ADDR((uint32 *)argv + 2), argv[4]);
+    (void)argv_ret;
 }
 static void
-invoke_iiIi_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiIi_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int32, int32, int64, int32) = func_ptr;
     argv_ret[0] = native_code(exec_env, argv[0], argv[1],
                               GET_I64_FROM_ADDR((uint32 *)argv + 2), argv[4]);
 }
 static void
-invoke_iiIi_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiIi_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int32, int32, int64, int32) = func_ptr;
     int64 ret = native_code(exec_env, argv[0], argv[1],
@@ -1061,15 +1082,16 @@ invoke_iiIi_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_iiII_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiII_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int32, int32, int64, int64) = func_ptr;
     native_code(exec_env, argv[0], argv[1],
                 GET_I64_FROM_ADDR((uint32 *)argv + 2),
                 GET_I64_FROM_ADDR((uint32 *)argv + 4));
+    (void)argv_ret;
 }
 static void
-invoke_iiII_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiII_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int32, int32, int64, int64) = func_ptr;
     argv_ret[0] = native_code(exec_env, argv[0], argv[1],
@@ -1077,7 +1099,7 @@ invoke_iiII_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
                               GET_I64_FROM_ADDR((uint32 *)argv + 4));
 }
 static void
-invoke_iiII_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiII_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int32, int32, int64, int64) = func_ptr;
     int64 ret = native_code(exec_env, argv[0], argv[1],
@@ -1087,14 +1109,15 @@ invoke_iiII_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_iIii_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iIii_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int32, int64, int32, int32) = func_ptr;
     native_code(exec_env, argv[0], GET_I64_FROM_ADDR((uint32 *)argv + 1),
                 argv[3], argv[4]);
+    (void)argv_ret;
 }
 static void
-invoke_iIii_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iIii_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int32, int64, int32, int32) = func_ptr;
     argv_ret[0] =
@@ -1102,7 +1125,7 @@ invoke_iIii_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
                     argv[3], argv[4]);
 }
 static void
-invoke_iIii_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iIii_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int32, int64, int32, int32) = func_ptr;
     int64 ret =
@@ -1112,14 +1135,15 @@ invoke_iIii_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_iIiI_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iIiI_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int32, int64, int32, int64) = func_ptr;
     native_code(exec_env, argv[0], GET_I64_FROM_ADDR((uint32 *)argv + 1),
                 argv[3], GET_I64_FROM_ADDR((uint32 *)argv + 4));
+    (void)argv_ret;
 }
 static void
-invoke_iIiI_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iIiI_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int32, int64, int32, int64) = func_ptr;
     argv_ret[0] =
@@ -1127,7 +1151,7 @@ invoke_iIiI_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
                     argv[3], GET_I64_FROM_ADDR((uint32 *)argv + 4));
 }
 static void
-invoke_iIiI_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iIiI_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int32, int64, int32, int64) = func_ptr;
     int64 ret =
@@ -1137,14 +1161,15 @@ invoke_iIiI_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_iIIi_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iIIi_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int32, int64, int64, int32) = func_ptr;
     native_code(exec_env, argv[0], GET_I64_FROM_ADDR((uint32 *)argv + 1),
                 GET_I64_FROM_ADDR((uint32 *)argv + 3), argv[5]);
+    (void)argv_ret;
 }
 static void
-invoke_iIIi_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iIIi_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int32, int64, int64, int32) = func_ptr;
     argv_ret[0] =
@@ -1152,7 +1177,7 @@ invoke_iIIi_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
                     GET_I64_FROM_ADDR((uint32 *)argv + 3), argv[5]);
 }
 static void
-invoke_iIIi_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iIIi_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int32, int64, int64, int32) = func_ptr;
     int64 ret =
@@ -1162,15 +1187,16 @@ invoke_iIIi_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_iIII_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iIII_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int32, int64, int64, int64) = func_ptr;
     native_code(exec_env, argv[0], GET_I64_FROM_ADDR((uint32 *)argv + 1),
                 GET_I64_FROM_ADDR((uint32 *)argv + 3),
                 GET_I64_FROM_ADDR((uint32 *)argv + 5));
+    (void)argv_ret;
 }
 static void
-invoke_iIII_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iIII_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int32, int64, int64, int64) = func_ptr;
     argv_ret[0] =
@@ -1179,7 +1205,7 @@ invoke_iIII_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
                     GET_I64_FROM_ADDR((uint32 *)argv + 5));
 }
 static void
-invoke_iIII_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iIII_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int32, int64, int64, int64) = func_ptr;
     int64 ret =
@@ -1190,21 +1216,22 @@ invoke_iIII_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_Iiii_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_Iiii_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int64, int32, int32, int32) = func_ptr;
     native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv), argv[2], argv[3],
                 argv[4]);
+    (void)argv_ret;
 }
 static void
-invoke_Iiii_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_Iiii_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int64, int32, int32, int32) = func_ptr;
     argv_ret[0] = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
                               argv[2], argv[3], argv[4]);
 }
 static void
-invoke_Iiii_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_Iiii_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int64, int32, int32, int32) = func_ptr;
     int64 ret = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
@@ -1213,15 +1240,16 @@ invoke_Iiii_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_IiiI_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IiiI_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int64, int32, int32, int64) = func_ptr;
     native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv), argv[2], argv[3],
                 GET_I64_FROM_ADDR((uint32 *)argv + 4));
+    (void)argv_ret;
 }
 
 static void
-invoke_IiiI_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IiiI_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int64, int32, int32, int64) = func_ptr;
     argv_ret[0] =
@@ -1230,7 +1258,7 @@ invoke_IiiI_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_IiiI_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IiiI_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int64, int32, int32, int64) = func_ptr;
     int64 ret =
@@ -1240,14 +1268,15 @@ invoke_IiiI_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_IiIi_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IiIi_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int64, int32, int64, int32) = func_ptr;
     native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv), argv[2],
                 GET_I64_FROM_ADDR((uint32 *)argv + 3), argv[5]);
+    (void)argv_ret;
 }
 static void
-invoke_IiIi_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IiIi_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int64, int32, int64, int32) = func_ptr;
     argv_ret[0] =
@@ -1255,7 +1284,7 @@ invoke_IiIi_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
                     GET_I64_FROM_ADDR((uint32 *)argv + 3), argv[5]);
 }
 static void
-invoke_IiIi_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IiIi_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int64, int32, int64, int32) = func_ptr;
     int64 ret =
@@ -1265,15 +1294,16 @@ invoke_IiIi_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_IiII_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IiII_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int64, int32, int64, int64) = func_ptr;
     native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv), argv[2],
                 GET_I64_FROM_ADDR((uint32 *)argv + 3),
                 GET_I64_FROM_ADDR((uint32 *)argv + 5));
+    (void)argv_ret;
 }
 static void
-invoke_IiII_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IiII_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int64, int32, int64, int64) = func_ptr;
     argv_ret[0] = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
@@ -1281,7 +1311,7 @@ invoke_IiII_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
                               GET_I64_FROM_ADDR((uint32 *)argv + 5));
 }
 static void
-invoke_IiII_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IiII_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int64, int32, int64, int64) = func_ptr;
     int64 ret = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
@@ -1291,14 +1321,15 @@ invoke_IiII_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_IIii_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IIii_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int64, int64, int32, int32) = func_ptr;
     native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
                 GET_I64_FROM_ADDR((uint32 *)argv + 2), argv[4], argv[5]);
+    (void)argv_ret;
 }
 static void
-invoke_IIii_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IIii_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int64, int64, int32, int32) = func_ptr;
     argv_ret[0] =
@@ -1306,7 +1337,7 @@ invoke_IIii_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
                     GET_I64_FROM_ADDR((uint32 *)argv + 2), argv[4], argv[5]);
 }
 static void
-invoke_IIii_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IIii_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int64, int64, int32, int32) = func_ptr;
     int64 ret =
@@ -1316,15 +1347,16 @@ invoke_IIii_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_IIiI_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IIiI_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int64, int64, int32, int64) = func_ptr;
     native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
                 GET_I64_FROM_ADDR((uint32 *)argv + 2), argv[4],
                 GET_I64_FROM_ADDR((uint32 *)argv + 5));
+    (void)argv_ret;
 }
 static void
-invoke_IIiI_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IIiI_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int64, int64, int32, int64) = func_ptr;
     argv_ret[0] = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
@@ -1332,7 +1364,7 @@ invoke_IIiI_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
                               GET_I64_FROM_ADDR((uint32 *)argv + 5));
 }
 static void
-invoke_IIiI_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IIiI_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int64, int64, int32, int64) = func_ptr;
     int64 ret = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
@@ -1342,15 +1374,16 @@ invoke_IIiI_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_IIIi_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IIIi_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int64, int64, int64, int32) = func_ptr;
     native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
                 GET_I64_FROM_ADDR((uint32 *)argv + 2),
                 GET_I64_FROM_ADDR((uint32 *)argv + 4), argv[6]);
+    (void)argv_ret;
 }
 static void
-invoke_IIIi_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IIIi_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int64, int64, int64, int32) = func_ptr;
     argv_ret[0] = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
@@ -1358,7 +1391,7 @@ invoke_IIIi_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
                               GET_I64_FROM_ADDR((uint32 *)argv + 4), argv[6]);
 }
 static void
-invoke_IIIi_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IIIi_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int64, int64, int64, int32) = func_ptr;
     int64 ret = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
@@ -1368,16 +1401,17 @@ invoke_IIIi_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_IIII_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IIII_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int64, int64, int64, int64) = func_ptr;
     native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
                 GET_I64_FROM_ADDR((uint32 *)argv + 2),
                 GET_I64_FROM_ADDR((uint32 *)argv + 4),
                 GET_I64_FROM_ADDR((uint32 *)argv + 6));
+    (void)argv_ret;
 }
 static void
-invoke_IIII_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IIII_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int64, int64, int64, int64) = func_ptr;
     argv_ret[0] = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
@@ -1386,7 +1420,7 @@ invoke_IIII_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
                               GET_I64_FROM_ADDR((uint32 *)argv + 6));
 }
 static void
-invoke_IIII_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_IIII_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int64, int64, int64, int64) = func_ptr;
     int64 ret = native_code(exec_env, GET_I64_FROM_ADDR((uint32 *)argv),
@@ -1397,14 +1431,15 @@ invoke_IIII_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
 }
 
 static void
-invoke_iiiii_v(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiiii_v(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     void (*native_code)(WASMExecEnv *, int32, int32, int32, int32, int32) =
         func_ptr;
     native_code(exec_env, argv[0], argv[1], argv[2], argv[3], argv[4]);
+    (void)argv_ret;
 }
 static void
-invoke_iiiii_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiiii_i(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int32 (*native_code)(WASMExecEnv *, int32, int32, int32, int32, int32) =
         func_ptr;
@@ -1412,7 +1447,7 @@ invoke_iiiii_i(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
         native_code(exec_env, argv[0], argv[1], argv[2], argv[3], argv[4]);
 }
 static void
-invoke_iiiii_I(void *func_ptr, void *exec_env, int32 *argv, int32 *argv_ret)
+invoke_iiiii_I(void *func_ptr, void *exec_env, uint32 *argv, uint32 *argv_ret)
 {
     int64 (*native_code)(WASMExecEnv *, int32, int32, int32, int32, int32) =
         func_ptr;

+ 162 - 7
core/iwasm/common/wasm_runtime_common.c

@@ -415,19 +415,39 @@ runtime_exception_handler(EXCEPTION_POINTERS *exce_info)
 }
 #endif /* end of BH_PLATFORM_WINDOWS */
 
+#ifdef BH_PLATFORM_WINDOWS
+static PVOID runtime_exception_handler_handle = NULL;
+static int32 runtime_exception_handler_ref_count = 0;
+static korp_mutex runtime_exception_handler_lock = NULL;
+#endif
+
 static bool
 runtime_signal_init()
 {
 #ifndef BH_PLATFORM_WINDOWS
     return os_thread_signal_init(runtime_signal_handler) == 0 ? true : false;
 #else
-    if (os_thread_signal_init() != 0)
+    os_mutex_lock(&runtime_exception_handler_lock);
+
+    if (os_thread_signal_init() != 0) {
+        os_mutex_unlock(&runtime_exception_handler_lock);
         return false;
+    }
 
-    if (!AddVectoredExceptionHandler(1, runtime_exception_handler)) {
+    if (runtime_exception_handler_ref_count == 0) {
+        runtime_exception_handler_handle =
+            AddVectoredExceptionHandler(1, runtime_exception_handler);
+    }
+
+    if (!runtime_exception_handler_handle) {
         os_thread_signal_destroy();
+        os_mutex_unlock(&runtime_exception_handler_lock);
         return false;
     }
+
+    runtime_exception_handler_ref_count++;
+
+    os_mutex_unlock(&runtime_exception_handler_lock);
 #endif
     return true;
 }
@@ -436,7 +456,25 @@ static void
 runtime_signal_destroy()
 {
 #ifdef BH_PLATFORM_WINDOWS
-    RemoveVectoredExceptionHandler(runtime_exception_handler);
+    os_mutex_lock(&runtime_exception_handler_lock);
+
+    if (runtime_exception_handler_ref_count > 0) {
+        runtime_exception_handler_ref_count--;
+    }
+
+    if (runtime_exception_handler_ref_count == 0
+        && runtime_exception_handler_handle) {
+        if (RemoveVectoredExceptionHandler(runtime_exception_handler_handle)) {
+            runtime_exception_handler_handle = NULL;
+        }
+        else {
+            /* Keep the handle so future init/destroy cycles can retry remove.
+             * Clearing it here may leave a live callback registered forever. */
+            runtime_exception_handler_ref_count = 1;
+        }
+    }
+
+    os_mutex_unlock(&runtime_exception_handler_lock);
 #endif
     os_thread_signal_destroy();
 }
@@ -1648,6 +1686,9 @@ void
 wasm_runtime_instantiation_args_set_defaults(struct InstantiationArgs2 *args)
 {
     memset(args, 0, sizeof(*args));
+#if WASM_ENABLE_LIBC_WASI != 0
+    wasi_args_set_defaults(&args->wasi);
+#endif
 }
 
 WASMModuleInstanceCommon *
@@ -1714,6 +1755,84 @@ wasm_runtime_instantiation_args_set_max_memory_pages(
     p->v1.max_memory_pages = v;
 }
 
+#if WASM_ENABLE_LIBC_WASI != 0
+void
+wasm_runtime_instantiation_args_set_wasi_arg(struct InstantiationArgs2 *p,
+                                             char *argv[], int argc)
+{
+    WASIArguments *wasi_args = &p->wasi;
+
+    wasi_args->argv = argv;
+    wasi_args->argc = (uint32)argc;
+    wasi_args->set_by_user = true;
+}
+
+void
+wasm_runtime_instantiation_args_set_wasi_env(struct InstantiationArgs2 *p,
+                                             const char *env[],
+                                             uint32 env_count)
+{
+    WASIArguments *wasi_args = &p->wasi;
+
+    wasi_args->env = env;
+    wasi_args->env_count = env_count;
+    wasi_args->set_by_user = true;
+}
+
+void
+wasm_runtime_instantiation_args_set_wasi_dir(struct InstantiationArgs2 *p,
+                                             const char *dir_list[],
+                                             uint32 dir_count,
+                                             const char *map_dir_list[],
+                                             uint32 map_dir_count)
+{
+    WASIArguments *wasi_args = &p->wasi;
+
+    wasi_args->dir_list = dir_list;
+    wasi_args->dir_count = dir_count;
+    wasi_args->map_dir_list = map_dir_list;
+    wasi_args->map_dir_count = map_dir_count;
+    wasi_args->set_by_user = true;
+}
+
+void
+wasm_runtime_instantiation_args_set_wasi_stdio(struct InstantiationArgs2 *p,
+                                               int64 stdinfd, int64 stdoutfd,
+                                               int64 stderrfd)
+{
+    WASIArguments *wasi_args = &p->wasi;
+
+    wasi_args->stdio[0] = (os_raw_file_handle)stdinfd;
+    wasi_args->stdio[1] = (os_raw_file_handle)stdoutfd;
+    wasi_args->stdio[2] = (os_raw_file_handle)stderrfd;
+    wasi_args->set_by_user = true;
+}
+
+void
+wasm_runtime_instantiation_args_set_wasi_addr_pool(struct InstantiationArgs2 *p,
+                                                   const char *addr_pool[],
+                                                   uint32 addr_pool_size)
+{
+    WASIArguments *wasi_args = &p->wasi;
+
+    wasi_args->addr_pool = addr_pool;
+    wasi_args->addr_count = addr_pool_size;
+    wasi_args->set_by_user = true;
+}
+
+void
+wasm_runtime_instantiation_args_set_wasi_ns_lookup_pool(
+    struct InstantiationArgs2 *p, const char *ns_lookup_pool[],
+    uint32 ns_lookup_pool_size)
+{
+    WASIArguments *wasi_args = &p->wasi;
+
+    wasi_args->ns_lookup_pool = ns_lookup_pool;
+    wasi_args->ns_lookup_count = ns_lookup_pool_size;
+    wasi_args->set_by_user = true;
+}
+#endif /* WASM_ENABLE_LIBC_WASI != 0 */
+
 WASMModuleInstanceCommon *
 wasm_runtime_instantiate_ex2(WASMModuleCommon *module,
                              const struct InstantiationArgs2 *args,
@@ -3494,6 +3613,7 @@ wasm_runtime_set_wasi_args_ex(WASMModuleCommon *module, const char *dir_list[],
     wasi_args->stdio[0] = (os_raw_file_handle)stdinfd;
     wasi_args->stdio[1] = (os_raw_file_handle)stdoutfd;
     wasi_args->stdio[2] = (os_raw_file_handle)stderrfd;
+    wasi_args->set_by_user = true;
 
 #if WASM_ENABLE_MULTI_MODULE != 0
 #if WASM_ENABLE_INTERP != 0
@@ -3524,6 +3644,7 @@ wasm_runtime_set_wasi_addr_pool(wasm_module_t module, const char *addr_pool[],
     if (wasi_args) {
         wasi_args->addr_pool = addr_pool;
         wasi_args->addr_count = addr_pool_size;
+        wasi_args->set_by_user = true;
     }
 }
 
@@ -3537,6 +3658,7 @@ wasm_runtime_set_wasi_ns_lookup_pool(wasm_module_t module,
     if (wasi_args) {
         wasi_args->ns_lookup_pool = ns_lookup_pool;
         wasi_args->ns_lookup_count = ns_lookup_pool_size;
+        wasi_args->set_by_user = true;
     }
 }
 
@@ -3814,7 +3936,8 @@ wasm_runtime_init_wasi(WASMModuleInstanceCommon *module_inst,
 
     /* addr_pool(textual) -> apool */
     for (i = 0; i < addr_pool_size; i++) {
-        char *cp, *address, *mask;
+        char *cp, *address, *mask, *nextptr, *endptr;
+        long mask_val;
         bool ret = false;
 
         cp = bh_strdup(addr_pool[i]);
@@ -3824,18 +3947,35 @@ wasm_runtime_init_wasi(WASMModuleInstanceCommon *module_inst,
             goto fail;
         }
 
-        address = strtok(cp, "/");
-        mask = strtok(NULL, "/");
+        address = bh_strtok_r(cp, "/", &nextptr);
+        mask = bh_strtok_r(NULL, "/", &nextptr);
 
         if (!mask) {
             snprintf(error_buf, error_buf_size,
                      "Invalid address pool entry: %s, must be in the format of "
                      "ADDRESS/MASK",
                      addr_pool[i]);
+            wasm_runtime_free(cp);
+            goto fail;
+        }
+
+        errno = 0;
+        mask_val = strtol(mask, &endptr, 10);
+
+        if (mask == endptr || *endptr != '\0') {
+            snprintf(error_buf, error_buf_size,
+                     "Invalid address pool entry: mask must be a number");
+            wasm_runtime_free(cp);
+            goto fail;
+        }
+        if (errno != 0 || mask_val < 0) {
+            snprintf(error_buf, error_buf_size,
+                     "Init wasi environment failed: invalid mask number");
+            wasm_runtime_free(cp);
             goto fail;
         }
 
-        ret = addr_pool_insert(apool, address, (uint8)atoi(mask));
+        ret = addr_pool_insert(apool, address, (uint8)mask_val);
         wasm_runtime_free(cp);
         if (!ret) {
             set_error_buf(error_buf, error_buf_size,
@@ -7996,3 +8136,18 @@ wasm_runtime_check_and_update_last_used_shared_heap(
     return false;
 }
 #endif
+
+WASMModuleInstanceExtraCommon *
+GetModuleInstanceExtraCommon(WASMModuleInstance *module_inst)
+{
+#if WASM_ENABLE_AOT != 0
+    if (module_inst->module_type == Wasm_Module_AoT) {
+        return &((AOTModuleInstanceExtra *)module_inst->e)->common;
+    }
+    else {
+        return &module_inst->e->common;
+    }
+#else
+    return &module_inst->e->common;
+#endif
+}

+ 43 - 0
core/iwasm/common/wasm_runtime_common.h

@@ -614,6 +614,9 @@ wasm_runtime_get_exec_env_tls(void);
 
 struct InstantiationArgs2 {
     InstantiationArgs v1;
+#if WASM_ENABLE_LIBC_WASI != 0
+    WASIArguments wasi;
+#endif
 };
 
 void
@@ -735,6 +738,43 @@ void
 wasm_runtime_instantiation_args_set_max_memory_pages(
     struct InstantiationArgs2 *p, uint32 v);
 
+/* See wasm_export.h for description */
+WASM_RUNTIME_API_EXTERN void
+wasm_runtime_instantiation_args_set_wasi_arg(struct InstantiationArgs2 *p,
+                                             char *argv[], int argc);
+
+/* See wasm_export.h for description */
+WASM_RUNTIME_API_EXTERN void
+wasm_runtime_instantiation_args_set_wasi_env(struct InstantiationArgs2 *p,
+                                             const char *env[],
+                                             uint32 env_count);
+
+/* See wasm_export.h for description */
+WASM_RUNTIME_API_EXTERN void
+wasm_runtime_instantiation_args_set_wasi_dir(struct InstantiationArgs2 *p,
+                                             const char *dir_list[],
+                                             uint32 dir_count,
+                                             const char *map_dir_list[],
+                                             uint32 map_dir_count);
+
+/* See wasm_export.h for description */
+WASM_RUNTIME_API_EXTERN void
+wasm_runtime_instantiation_args_set_wasi_stdio(struct InstantiationArgs2 *p,
+                                               int64 stdinfd, int64 stdoutfd,
+                                               int64 stderrfd);
+
+/* See wasm_export.h for description */
+WASM_RUNTIME_API_EXTERN void
+wasm_runtime_instantiation_args_set_wasi_addr_pool(struct InstantiationArgs2 *p,
+                                                   const char *addr_pool[],
+                                                   uint32 addr_pool_size);
+
+/* See wasm_export.h for description */
+WASM_RUNTIME_API_EXTERN void
+wasm_runtime_instantiation_args_set_wasi_ns_lookup_pool(
+    struct InstantiationArgs2 *p, const char *ns_lookup_pool[],
+    uint32 ns_lookup_pool_size);
+
 /* See wasm_export.h for description */
 WASM_RUNTIME_API_EXTERN WASMModuleInstanceCommon *
 wasm_runtime_instantiate_ex2(WASMModuleCommon *module,
@@ -1387,6 +1427,9 @@ wasm_runtime_check_and_update_last_used_shared_heap(
     uint8 **shared_heap_base_addr_adj_p, bool is_memory64);
 #endif
 
+struct WASMModuleInstanceExtraCommon *
+GetModuleInstanceExtraCommon(struct WASMModuleInstance *module_inst);
+
 #ifdef __cplusplus
 }
 #endif

+ 1 - 1
core/iwasm/compilation/aot_emit_memory.c

@@ -676,7 +676,7 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
                 *alignp = max_align;
             }
             else {
-                unsigned int align = 1 << (shift - 1);
+                unsigned int align = 1U << (shift - 1);
                 if (align > max_align) {
                     align = max_align;
                 }

+ 36 - 0
core/iwasm/compilation/aot_llvm.c

@@ -3005,6 +3005,10 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option)
                 else
                     vendor_sys = "-pc-windows-";
             }
+            else if (!strcmp(abi, "darwin") || !strcmp(abi, "macho")) {
+                /* macOS/Darwin: x18 is reserved by Apple */
+                vendor_sys = "-apple-";
+            }
             else {
                 if (is_baremetal_target(arch, cpu, abi))
                     vendor_sys = "-unknown-none-";
@@ -3050,6 +3054,14 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option)
                 if (!abi)
                     abi = "gnu";
             }
+            else if (strstr(default_triple, "darwin")
+                     || strstr(default_triple, "apple")) {
+                /* macOS/Darwin: x18 is reserved by Apple, must use correct
+                 * triple to prevent LLVM from using it */
+                vendor_sys = "-apple-darwin";
+                if (!abi)
+                    abi = "";
+            }
             else {
                 vendor_sys = "-pc-linux-";
                 if (!abi)
@@ -3139,6 +3151,30 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option)
         if (!features)
             features = "";
 
+#if (defined(__APPLE__) || defined(__MACH__)) && defined(BUILD_TARGET_AARCH64)
+        /* On macOS ARM64, x18 is reserved by Apple for TLS. Even though we're
+         * generating ELF (Linux-style) AOT files, we must tell LLVM to not
+         * use x18, otherwise the AOT code will crash when running on macOS. */
+        {
+            bool is_aarch64 = false;
+            if (arch && !strncmp(arch, "aarch64", 7))
+                is_aarch64 = true;
+            else if (triple_norm && strstr(triple_norm, "aarch64"))
+                is_aarch64 = true;
+
+            if (is_aarch64) {
+                if (features[0] != '\0') {
+                    snprintf(features_buf, sizeof(features_buf),
+                             "%s,+reserve-x18", features);
+                    features = features_buf;
+                }
+                else {
+                    features = "+reserve-x18";
+                }
+            }
+        }
+#endif
+
         /* Get target with triple, note that LLVMGetTargetFromTriple()
            return 0 when success, but not true. */
         if (LLVMGetTargetFromTriple(triple_norm, &target, &err) != 0) {

+ 1 - 0
core/iwasm/compilation/aot_orc_extra2.cpp

@@ -85,6 +85,7 @@ MyPassManager::add(llvm::Pass *P)
     // a hack to avoid having a copy of the whole addPassesToEmitMC.
     // we want to add PrintStackSizes before FreeMachineFunctionPass.
     if (P->getPassName() == "Free MachineFunction") {
+        delete P;
         return;
     }
     llvm::legacy::PassManager::add(P);

+ 11 - 6
core/iwasm/include/gc_export.h

@@ -51,16 +51,21 @@ typedef enum wasm_value_type_enum {
 typedef int32_t wasm_heap_type_t;
 
 typedef enum wasm_heap_type_enum {
+    HEAP_TYPE_NOFUNC = -0x0D,
+    HEAP_TYPE_NOEXTERN = -0x0E,
+    HEAP_TYPE_NONE = -0x0F,
     HEAP_TYPE_FUNC = -0x10,
     HEAP_TYPE_EXTERN = -0x11,
     HEAP_TYPE_ANY = -0x12,
     HEAP_TYPE_EQ = -0x13,
-    HEAP_TYPE_I31 = -0x16,
-    HEAP_TYPE_NOFUNC = -0x17,
-    HEAP_TYPE_NOEXTERN = -0x18,
-    HEAP_TYPE_STRUCT = -0x19,
-    HEAP_TYPE_ARRAY = -0x1A,
-    HEAP_TYPE_NONE = -0x1B
+    HEAP_TYPE_I31 = -0x14,
+    HEAP_TYPE_STRUCT = -0x15,
+    HEAP_TYPE_ARRAY = -0x16,
+    /* Stringref Types */
+    HEAP_TYPE_STRINGREF = -0x19,
+    HEAP_TYPE_STRINGVIEWWTF8 = -0x1A,
+    HEAP_TYPE_STRINGVIEWWTF16 = -0x1E,
+    HEAP_TYPE_STRINGVIEWITER = -0x1F
 } wasm_heap_type_enum;
 
 struct WASMObject;

+ 2 - 0
core/iwasm/include/wasm_c_api.h

@@ -22,6 +22,8 @@
 #else
 #define WASM_API_EXTERN __declspec(dllimport)
 #endif
+#elif defined(__GNUC__) || defined(__clang__)
+#define WASM_API_EXTERN __attribute__((visibility("default")))
 #else
 #define WASM_API_EXTERN
 #endif

+ 43 - 0
core/iwasm/include/wasm_export.h

@@ -764,6 +764,38 @@ WASM_RUNTIME_API_EXTERN void
 wasm_runtime_instantiation_args_set_max_memory_pages(
     struct InstantiationArgs2 *p, uint32_t v);
 
+WASM_RUNTIME_API_EXTERN void
+wasm_runtime_instantiation_args_set_wasi_arg(struct InstantiationArgs2 *p,
+                                             char *argv[], int argc);
+
+WASM_RUNTIME_API_EXTERN void
+wasm_runtime_instantiation_args_set_wasi_env(struct InstantiationArgs2 *p,
+                                             const char *env[],
+                                             uint32_t env_count);
+
+WASM_RUNTIME_API_EXTERN void
+wasm_runtime_instantiation_args_set_wasi_dir(struct InstantiationArgs2 *p,
+                                             const char *dir_list[],
+                                             uint32_t dir_count,
+                                             const char *map_dir_list[],
+                                             uint32_t map_dir_count);
+
+WASM_RUNTIME_API_EXTERN void
+wasm_runtime_instantiation_args_set_wasi_stdio(struct InstantiationArgs2 *p,
+                                               int64_t stdinfd,
+                                               int64_t stdoutfd,
+                                               int64_t stderrfd);
+
+WASM_RUNTIME_API_EXTERN void
+wasm_runtime_instantiation_args_set_wasi_addr_pool(struct InstantiationArgs2 *p,
+                                                   const char *addr_pool[],
+                                                   uint32_t addr_pool_size);
+
+WASM_RUNTIME_API_EXTERN void
+wasm_runtime_instantiation_args_set_wasi_ns_lookup_pool(
+    struct InstantiationArgs2 *p, const char *ns_lookup_pool[],
+    uint32_t ns_lookup_pool_size);
+
 /**
  * Instantiate a WASM module, with specified instantiation arguments
  *
@@ -2405,6 +2437,17 @@ wasm_runtime_chain_shared_heaps(wasm_shared_heap_t head,
 wasm_shared_heap_t
 wasm_runtime_unchain_shared_heaps(wasm_shared_heap_t head, bool entire_chain);
 
+/**
+ * Reset shared heap chain. For each shared heap in the chain, if it is a
+ * pre-allocated shared heap, its memory region will be zeroed. For a
+ * WAMR-managed shared heap, it will be destroyed and reinitialized.
+ *
+ * @param shared_heap The head of the shared heap chain.
+ * @return true if success, false otherwise.
+ */
+WASM_RUNTIME_API_EXTERN bool
+wasm_runtime_reset_shared_heap_chain(wasm_shared_heap_t shared_heap);
+
 /**
  * Attach a shared heap, it can be the head of shared heap chain, in that case,
  * attach the shared heap chain, to a module instance

+ 1 - 0
core/iwasm/interpreter/wasm.h

@@ -848,6 +848,7 @@ typedef struct WASIArguments {
     char **argv;
     uint32 argc;
     os_raw_file_handle stdio[3];
+    bool set_by_user;
 } WASIArguments;
 #endif
 

+ 18 - 7
core/iwasm/interpreter/wasm_interp_classic.c

@@ -1715,11 +1715,24 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
                 exception_tag_index = *((uint32 *)tgtframe_sp);
                 tgtframe_sp++;
 
-                /* get tag type */
-                uint8 tag_type_index =
-                    module->module->tags[exception_tag_index]->type;
-                uint32 cell_num_to_copy =
-                    wasm_types[tag_type_index]->param_cell_num;
+                uint32 cell_num_to_copy = 0;
+
+                if (IS_INVALID_TAGINDEX(exception_tag_index)) {
+                    /*
+                     * Cross-module exception with unknown tag.
+                     * No parameters to copy - just re-throw with
+                     * the invalid tag index so find_a_catch_handler
+                     * routes it to CATCH_ALL.
+                     */
+                    cell_num_to_copy = 0;
+                }
+                else {
+                    /* get tag type */
+                    uint8 tag_type_index =
+                        module->module->tags[exception_tag_index]->type;
+                    cell_num_to_copy =
+                        wasm_types[tag_type_index]->param_cell_num;
+                }
 
                 /* move exception parameters (if there are any) onto top
                  * of stack */
@@ -6580,12 +6593,10 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
         HANDLE_OP(WASM_OP_CATCH_ALL)
         HANDLE_OP(EXT_OP_TRY)
 #endif
-#if WASM_ENABLE_JIT != 0 && WASM_ENABLE_SIMD != 0
         /* SIMD isn't supported by interpreter, but when JIT is
            enabled, `iwasm --interp <wasm_file>` may be run to
            trigger the SIMD opcode in interpreter */
         HANDLE_OP(WASM_OP_SIMD_PREFIX)
-#endif
         HANDLE_OP(WASM_OP_UNUSED_0x16)
         HANDLE_OP(WASM_OP_UNUSED_0x17)
         HANDLE_OP(WASM_OP_UNUSED_0x27)

+ 16 - 13
core/iwasm/interpreter/wasm_interp_fast.c

@@ -442,7 +442,7 @@ wasm_interp_get_frame_ref(WASMInterpFrame *frame)
         opnd_off = *(int16 *)(frame_ip + off); \
         addr_tmp = frame_lp + opnd_off;        \
         PUT_REF_TO_ADDR(addr_tmp, value);      \
-        SET_FRAME_REF(ond_off);                \
+        SET_FRAME_REF(opnd_off);               \
     } while (0)
 
 #define SET_OPERAND(op_type, off, value) SET_OPERAND_##op_type(off, value)
@@ -999,9 +999,9 @@ fail:
                     }                                                      \
                 }                                                          \
                 else if (cells[0] == 2) {                                  \
-                    PUT_I64_TO_ADDR(                                       \
-                        frame_lp + dst_offsets[0],                         \
-                        GET_I64_FROM_ADDR(frame_lp + src_offsets[0]));     \
+                    int64 tmp_i64 =                                        \
+                        GET_I64_FROM_ADDR(frame_lp + src_offsets[0]);      \
+                    PUT_I64_TO_ADDR(frame_lp + dst_offsets[0], tmp_i64);   \
                     /* Ignore constants because they are not reference */  \
                     if (src_offsets[0] >= 0) {                             \
                         CLEAR_FRAME_REF((unsigned)src_offsets[0]);         \
@@ -1011,9 +1011,9 @@ fail:
                     }                                                      \
                 }                                                          \
                 else if (cells[0] == 4) {                                  \
-                    PUT_V128_TO_ADDR(                                      \
-                        frame_lp + dst_offsets[0],                         \
-                        GET_V128_FROM_ADDR(frame_lp + src_offsets[0]));    \
+                    V128 tmp_v128 =                                        \
+                        GET_V128_FROM_ADDR(frame_lp + src_offsets[0]);     \
+                    PUT_V128_TO_ADDR(frame_lp + dst_offsets[0], tmp_v128); \
                     /* Ignore constants because they are not reference */  \
                     if (src_offsets[0] >= 0) {                             \
                         CLEAR_FRAME_REF((unsigned)src_offsets[0]);         \
@@ -1062,14 +1062,14 @@ fail:
                 if (cells[0] == 1)                                          \
                     frame_lp[dst_offsets[0]] = frame_lp[src_offsets[0]];    \
                 else if (cells[0] == 2) {                                   \
-                    PUT_I64_TO_ADDR(                                        \
-                        frame_lp + dst_offsets[0],                          \
-                        GET_I64_FROM_ADDR(frame_lp + src_offsets[0]));      \
+                    int64 tmp_i64 =                                         \
+                        GET_I64_FROM_ADDR(frame_lp + src_offsets[0]);       \
+                    PUT_I64_TO_ADDR(frame_lp + dst_offsets[0], tmp_i64);    \
                 }                                                           \
                 else if (cells[0] == 4) {                                   \
-                    PUT_V128_TO_ADDR(                                       \
-                        frame_lp + dst_offsets[0],                          \
-                        GET_V128_FROM_ADDR(frame_lp + src_offsets[0]));     \
+                    V128 tmp_v128 =                                         \
+                        GET_V128_FROM_ADDR(frame_lp + src_offsets[0]);      \
+                    PUT_V128_TO_ADDR(frame_lp + dst_offsets[0], tmp_v128);  \
                 }                                                           \
             }                                                               \
             else {                                                          \
@@ -7534,6 +7534,9 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
         HANDLE_OP(EXT_OP_LOOP)
         HANDLE_OP(EXT_OP_IF)
         HANDLE_OP(EXT_OP_BR_TABLE_CACHE)
+#if WASM_ENABLE_SIMDE == 0
+        HANDLE_OP(WASM_OP_SIMD_PREFIX)
+#endif
         {
             wasm_set_exception(module, "unsupported opcode");
             goto got_exception;

+ 31 - 6
core/iwasm/interpreter/wasm_loader.c

@@ -701,7 +701,7 @@ destroy_init_expr(WASMModule *module, InitializerExpression *expr)
 #endif
 
 #if WASM_ENABLE_EXTENDED_CONST_EXPR != 0
-    // free left expr and right exprs for binary oprand
+    /* free left expr and right exprs for binary operand */
     if (!is_expr_binary_op(expr->init_expr_type)) {
         return;
     }
@@ -1920,6 +1920,11 @@ resolve_struct_type(const uint8 **p_buf, const uint8 *buf_end,
         if (need_ref_type_map)
             ref_type_map_count++;
 
+        if (wasm_is_reftype_anyref(ref_type.ref_type)) {
+            LOG_ERROR("Not support using anyref in struct fields");
+            return false;
+        }
+
         if (wasm_is_type_reftype(ref_type.ref_type))
             ref_field_count++;
 
@@ -2039,6 +2044,11 @@ resolve_array_type(const uint8 **p_buf, const uint8 *buf_end,
         return false;
     }
 
+    if (wasm_is_reftype_anyref(ref_type.ref_type)) {
+        LOG_ERROR("Not support using anyref in array element type");
+        return false;
+    }
+
     CHECK_BUF(p, p_end, 1);
     mutable = read_uint8(p);
     if (!check_mutability(mutable, error_buf, error_buf_size)) {
@@ -8545,8 +8555,7 @@ check_offset_pop(WASMLoaderContext *ctx, uint32 cells)
 static bool
 check_dynamic_offset_pop(WASMLoaderContext *ctx, uint32 cells)
 {
-    if (ctx->dynamic_offset < 0
-        || (ctx->dynamic_offset > 0 && (uint32)ctx->dynamic_offset < cells))
+    if (ctx->dynamic_offset < 0 || (uint32)ctx->dynamic_offset < cells)
         return false;
     return true;
 }
@@ -9720,6 +9729,16 @@ preserve_local_for_block(WASMLoaderContext *loader_ctx, uint8 opcode,
 
     /* preserve locals before blocks to ensure that "tee/set_local" inside
         blocks will not influence the value of these locals */
+    uint32 frame_offset_cell =
+        (uint32)(loader_ctx->frame_offset - loader_ctx->frame_offset_bottom);
+    uint32 frame_ref_cell =
+        (uint32)(loader_ctx->frame_ref - loader_ctx->frame_ref_bottom);
+    if (frame_offset_cell < loader_ctx->stack_cell_num
+        || frame_ref_cell < loader_ctx->stack_cell_num) {
+        set_error_buf(error_buf, error_buf_size, "stack cell num error");
+        return false;
+    }
+
     while (i < loader_ctx->stack_cell_num) {
         int16 cur_offset = loader_ctx->frame_offset_bottom[i];
         uint8 cur_type = loader_ctx->frame_ref_bottom[i];
@@ -12106,13 +12125,19 @@ re_scan:
                         }
 #endif
 
+                        uint8 *frame_ref_before_pop = loader_ctx->frame_ref;
                         POP_TYPE(
                             wasm_type->types[wasm_type->param_count - i - 1]);
 #if WASM_ENABLE_FAST_INTERP != 0
                         /* decrease the frame_offset pointer accordingly to keep
-                         * consistent with frame_ref stack */
-                        cell_num = wasm_value_type_cell_num(
-                            wasm_type->types[wasm_type->param_count - i - 1]);
+                         * consistent with frame_ref stack. Use the actual
+                         * popped cell count instead of
+                         * wasm_value_type_cell_num() because when the stack top
+                         * is VALUE_TYPE_ANY, wasm_loader_pop_frame_ref always
+                         * pops exactly 1 cell regardless of the expected type
+                         */
+                        cell_num = (uint32)(frame_ref_before_pop
+                                            - loader_ctx->frame_ref);
                         loader_ctx->frame_offset -= cell_num;
 
                         if (loader_ctx->frame_offset

+ 3 - 4
core/iwasm/interpreter/wasm_mini_loader.c

@@ -375,8 +375,8 @@ destroy_const_expr_stack(ConstExprContext *ctx, bool free_exprs)
 static void
 destroy_init_expr(InitializerExpression *expr)
 {
-    // free left expr and right exprs for binary oprand
-    if (is_expr_binary_op(expr->init_expr_type)) {
+    /* free left expr and right exprs for binary operand */
+    if (!is_expr_binary_op(expr->init_expr_type)) {
         return;
     }
     if (expr->u.binary.l_expr) {
@@ -4345,8 +4345,7 @@ check_offset_pop(WASMLoaderContext *ctx, uint32 cells)
 static bool
 check_dynamic_offset_pop(WASMLoaderContext *ctx, uint32 cells)
 {
-    if (ctx->dynamic_offset < 0
-        || (ctx->dynamic_offset > 0 && (uint32)ctx->dynamic_offset < cells))
+    if (ctx->dynamic_offset < 0 || (uint32)ctx->dynamic_offset < cells)
         return false;
     return true;
 }

+ 1 - 8
core/iwasm/interpreter/wasm_opcode.h

@@ -790,13 +790,6 @@ typedef enum WASMAtomicEXTOpcode {
 #endif
 #define SET_GOTO_TABLE_ELEM(opcode) [opcode] = HANDLE_OPCODE(opcode)
 
-#if WASM_ENABLE_SIMDE != 0
-#define SET_GOTO_TABLE_SIMD_PREFIX_ELEM() \
-    SET_GOTO_TABLE_ELEM(WASM_OP_SIMD_PREFIX),
-#else
-#define SET_GOTO_TABLE_SIMD_PREFIX_ELEM()
-#endif
-
 #if WASM_ENABLE_SIMDE != 0
 #define DEF_EXT_V128_HANDLE()                                       \
     SET_GOTO_TABLE_ELEM(EXT_OP_SET_LOCAL_FAST_V128),     /* 0xdd */ \
@@ -1038,7 +1031,7 @@ typedef enum WASMAtomicEXTOpcode {
         HANDLE_OPCODE(EXT_OP_TRY),                   /* 0xdb */ \
         SET_GOTO_TABLE_ELEM(WASM_OP_GC_PREFIX),      /* 0xfb */ \
         SET_GOTO_TABLE_ELEM(WASM_OP_MISC_PREFIX),    /* 0xfc */ \
-        SET_GOTO_TABLE_SIMD_PREFIX_ELEM()            /* 0xfd */ \
+        SET_GOTO_TABLE_ELEM(WASM_OP_SIMD_PREFIX),    /* 0xfd */ \
         SET_GOTO_TABLE_ELEM(WASM_OP_ATOMIC_PREFIX),  /* 0xfe */ \
         DEF_DEBUG_BREAK_HANDLE() DEF_EXT_V128_HANDLE()          \
     };

+ 28 - 10
core/iwasm/interpreter/wasm_runtime.c

@@ -2512,6 +2512,12 @@ wasm_instantiate(WASMModule *module, WASMModuleInstance *parent,
     module_inst->module = module;
     module_inst->e =
         (WASMModuleInstanceExtra *)((uint8 *)module_inst + extra_info_offset);
+#if WASM_ENABLE_THREAD_MGR != 0
+    if (os_mutex_init(&module_inst->e->common.exception_lock) != 0) {
+        wasm_runtime_free(module_inst);
+        return NULL;
+    }
+#endif
 
 #if WASM_ENABLE_MULTI_MODULE != 0
     module_inst->e->sub_module_inst_list =
@@ -3276,17 +3282,25 @@ wasm_instantiate(WASMModule *module, WASMModuleInstance *parent,
 #if WASM_ENABLE_LIBC_WASI != 0
     /* The sub-instance will get the wasi_ctx from main-instance */
     if (!is_sub_inst) {
+        const WASIArguments *wasi_args = &args->wasi;
+        if (module->wasi_args.set_by_user) {
+            if (wasi_args->set_by_user) {
+                set_error_buf(error_buf, error_buf_size,
+                              "WASI configuration was given via both of module "
+                              "and InstantiationArgs2");
+                goto fail;
+            }
+            wasi_args = &module->wasi_args;
+        }
         if (!wasm_runtime_init_wasi(
-                (WASMModuleInstanceCommon *)module_inst,
-                module->wasi_args.dir_list, module->wasi_args.dir_count,
-                module->wasi_args.map_dir_list, module->wasi_args.map_dir_count,
-                module->wasi_args.env, module->wasi_args.env_count,
-                module->wasi_args.addr_pool, module->wasi_args.addr_count,
-                module->wasi_args.ns_lookup_pool,
-                module->wasi_args.ns_lookup_count, module->wasi_args.argv,
-                module->wasi_args.argc, module->wasi_args.stdio[0],
-                module->wasi_args.stdio[1], module->wasi_args.stdio[2],
-                error_buf, error_buf_size)) {
+                (WASMModuleInstanceCommon *)module_inst, wasi_args->dir_list,
+                wasi_args->dir_count, wasi_args->map_dir_list,
+                wasi_args->map_dir_count, wasi_args->env, wasi_args->env_count,
+                wasi_args->addr_pool, wasi_args->addr_count,
+                wasi_args->ns_lookup_pool, wasi_args->ns_lookup_count,
+                wasi_args->argv, wasi_args->argc, wasi_args->stdio[0],
+                wasi_args->stdio[1], wasi_args->stdio[2], error_buf,
+                error_buf_size)) {
             goto fail;
         }
     }
@@ -3493,6 +3507,9 @@ wasm_deinstantiate(WASMModuleInstance *module_inst, bool is_sub_inst)
     bh_bitmap_delete(module_inst->e->common.elem_dropped);
 #endif
 
+#if WASM_ENABLE_THREAD_MGR != 0
+    os_mutex_destroy(&module_inst->e->common.exception_lock);
+#endif
     wasm_runtime_free(module_inst);
 }
 
@@ -3610,6 +3627,7 @@ call_wasm_with_hw_bound_check(WASMModuleInstance *module_inst,
        native stack to run the following codes before actually calling
        the aot function in invokeNative function. */
     if (!wasm_runtime_detect_native_stack_overflow(exec_env)) {
+        wasm_runtime_set_exec_env_tls(NULL);
         return;
     }
 

+ 3 - 0
core/iwasm/interpreter/wasm_runtime.h

@@ -334,6 +334,9 @@ typedef struct WASMModuleInstanceExtraCommon {
     /* The gc heap created */
     void *gc_heap_handle;
 #endif
+#if WASM_ENABLE_THREAD_MGR != 0
+    korp_mutex exception_lock;
+#endif
 } WASMModuleInstanceExtraCommon;
 
 /* Extra info of WASM module instance for interpreter/jit mode */

+ 3 - 0
core/iwasm/libraries/lib-wasi-threads/tid_allocator.c

@@ -8,7 +8,10 @@
 #include "bh_log.h"
 
 bh_static_assert(TID_MIN <= TID_MAX);
+/* Some platforms, like Zephyr, have already defined MIN at this point */
+#ifndef MIN
 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#endif
 
 bool
 tid_allocator_init(TidAllocator *tid_allocator)

+ 3 - 2
core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c

@@ -1014,7 +1014,8 @@ print_i64_wrapper(wasm_exec_env_t exec_env, int64 i64)
 static void
 print_i32_f32_wrapper(wasm_exec_env_t exec_env, int32 i32, float f32)
 {
-    os_printf("in specttest.print_i32_f32(%" PRId32 ", %f)\n", i32, f32);
+    os_printf("in specttest.print_i32_f32(%" PRId32 ", %f)\n", i32,
+              (double)f32);
 }
 
 static void
@@ -1026,7 +1027,7 @@ print_f64_f64_wrapper(wasm_exec_env_t exec_env, double f64_1, double f64_2)
 static void
 print_f32_wrapper(wasm_exec_env_t exec_env, float f32)
 {
-    os_printf("in specttest.print_f32(%f)\n", f32);
+    os_printf("in specttest.print_f32(%f)\n", (double)f32);
 }
 
 static void

+ 10 - 3
core/iwasm/libraries/libc-emcc/libc_emcc_wrapper.c

@@ -245,14 +245,21 @@ mmap_wrapper(wasm_exec_env_t exec_env, void *addr, int length, int prot,
     if (buf_offset == 0)
         return -1;
 
-    if (fd <= 0)
+    if (fd <= 0) {
+        module_free((uint64)buf_offset);
         return -1;
+    }
 
-    if (lseek(fd, offset, SEEK_SET) == -1)
+    if (lseek(fd, offset, SEEK_SET) == -1) {
+        module_free((uint64)buf_offset);
         return -1;
+    }
 
     size_read = read(fd, buf, length);
-    (void)size_read;
+    if (size_read < 0) {
+        module_free((uint64)buf_offset);
+        return -1;
+    }
     return buf_offset;
 }
 

+ 12 - 3
core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c

@@ -430,7 +430,7 @@ fd_table_attach(struct fd_table *ft, __wasi_fd_t fd, struct fd_object *fo,
                 __wasi_rights_t rights_base, __wasi_rights_t rights_inheriting)
     REQUIRES_EXCLUSIVE(ft->lock) CONSUMES(fo->refcount)
 {
-    bh_assert(ft->size > fd && "File descriptor table too small");
+    bh_assert(ft->size > (size_t)fd && "File descriptor table too small");
     struct fd_entry *fe = &ft->entries[fd];
     bh_assert(fe->object == NULL
               && "Attempted to overwrite an existing descriptor");
@@ -2585,7 +2585,7 @@ wasi_ssp_sock_connect(wasm_exec_env_t exec_env, struct fd_table *curfds,
         return __WASI_EACCES;
     }
 
-    error = fd_object_get(curfds, &fo, fd, __WASI_RIGHT_SOCK_BIND, 0);
+    error = fd_object_get(curfds, &fo, fd, __WASI_RIGHT_SOCK_CONNECT, 0);
     if (error != __WASI_ESUCCESS) {
         return error;
     }
@@ -3105,7 +3105,6 @@ addr_pool_insert(struct addr_pool *addr_pool, const char *addr, uint8 mask)
     }
 
     next->next = NULL;
-    next->mask = mask;
 
     if (os_socket_inet_network(true, addr, &target) != BHT_OK) {
         // If parsing IPv4 fails, try IPv6
@@ -3116,10 +3115,20 @@ addr_pool_insert(struct addr_pool *addr_pool, const char *addr, uint8 mask)
         next->type = IPv6;
         bh_memcpy_s(next->addr.ip6, sizeof(next->addr.ip6), target.ipv6,
                     sizeof(target.ipv6));
+        if (mask > 128) {
+            wasm_runtime_free(next);
+            return false;
+        }
+        next->mask = mask;
     }
     else {
         next->type = IPv4;
         next->addr.ip4 = target.ipv4;
+        if (mask > 32) {
+            wasm_runtime_free(next);
+            return false;
+        }
+        next->mask = mask;
     }
 
     /* attach with */

+ 2 - 15
core/iwasm/libraries/thread-mgr/thread_manager.c

@@ -29,8 +29,6 @@ static bh_list cluster_list_head;
 static bh_list *const cluster_list = &cluster_list_head;
 static korp_mutex cluster_list_lock;
 
-static korp_mutex _exception_lock;
-
 typedef void (*list_visitor)(void *, void *);
 
 static uint32 cluster_max_thread_num = CLUSTER_MAX_THREAD_NUM;
@@ -51,10 +49,6 @@ thread_manager_init()
         return false;
     if (os_mutex_init(&cluster_list_lock) != 0)
         return false;
-    if (os_mutex_init(&_exception_lock) != 0) {
-        os_mutex_destroy(&cluster_list_lock);
-        return false;
-    }
     return true;
 }
 
@@ -69,7 +63,6 @@ thread_manager_destroy()
         cluster = next;
     }
     wasm_cluster_cancel_all_callbacks();
-    os_mutex_destroy(&_exception_lock);
     os_mutex_destroy(&cluster_list_lock);
 }
 
@@ -1540,19 +1533,13 @@ wasm_cluster_is_thread_terminated(WASMExecEnv *exec_env)
 void
 exception_lock(WASMModuleInstance *module_inst)
 {
-    /*
-     * Note: this lock could be per module instance if desirable.
-     * We can revisit on AOT version bump.
-     * It probably doesn't matter though because the exception handling
-     * logic should not be executed too frequently anyway.
-     */
-    os_mutex_lock(&_exception_lock);
+    os_mutex_lock(&GetModuleInstanceExtraCommon(module_inst)->exception_lock);
 }
 
 void
 exception_unlock(WASMModuleInstance *module_inst)
 {
-    os_mutex_unlock(&_exception_lock);
+    os_mutex_unlock(&GetModuleInstanceExtraCommon(module_inst)->exception_lock);
 }
 
 void

+ 0 - 6
core/iwasm/libraries/wasi-nn/cmake/iwasm_helper.cmake

@@ -28,12 +28,6 @@ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -W
 
 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused")
 
-if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
-  if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
-    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
-  endif ()
-endif ()
-
 set (WAMR_BUILD_INTERP 1)
 set (WAMR_BUILD_AOT 1)
 set (WAMR_BUILD_JIT 0)

+ 18 - 4
core/iwasm/libraries/wasi-nn/src/wasi_nn_llamacpp.c

@@ -623,8 +623,15 @@ get_output(void *ctx, graph_execution_context exec_ctx, uint32_t index,
             printf("%s\n", output_metadata);
         }
 
-        memcpy(output_tensor->buf, output_metadata, strlen(output_metadata));
-        *output_tensor_size = strlen(output_metadata);
+        size_t metadata_len = strlen(output_metadata);
+        if (metadata_len > output_tensor->size) {
+            NN_ERR_PRINTF("Output buffer too small for metadata: "
+                          "need %zu, got %zu",
+                          metadata_len, output_tensor->size);
+            return too_large;
+        }
+        memcpy(output_tensor->buf, output_metadata, metadata_len);
+        *output_tensor_size = metadata_len;
         return success;
     }
 
@@ -643,8 +650,15 @@ get_output(void *ctx, graph_execution_context exec_ctx, uint32_t index,
             printf("%s", buf);
         }
 
-        memcpy(output_tensor->buf + end_pos, buf, strlen(buf));
-        end_pos += strlen(buf);
+        size_t piece_len = strlen(buf);
+        if (end_pos + piece_len > output_tensor->size) {
+            NN_ERR_PRINTF("Output buffer too small: need at least %zu,"
+                          " got %zu",
+                          end_pos + piece_len, output_tensor->size);
+            return too_large;
+        }
+        memcpy(output_tensor->buf + end_pos, buf, piece_len);
+        end_pos += piece_len;
     }
 
     if (backend_ctx->config.stream_stdout) {

+ 5 - 1
core/shared/mem-alloc/ems/ems_gc.c

@@ -308,8 +308,12 @@ reclaim_instance_heap(gc_heap_t *heap)
         return GC_SUCCESS;
     ret = gct_vm_begin_rootset_enumeration(heap->cluster, heap);
 #endif
-    if (!ret)
+    if (!ret) {
+        if (heap->root_set) {
+            rollback_mark(heap);
+        }
         return GC_ERROR;
+    }
 
 #if BH_ENABLE_GC_VERIFY != 0
     /* no matter whether the enumeration is successful or not, the data

+ 4 - 6
core/shared/mem-alloc/ems/ems_kfc.c

@@ -286,13 +286,13 @@ gc_migrate(gc_handle_t handle, char *pool_buf_new, gc_size_t pool_buf_size)
     while (cur < end) {
         size = hmu_get_size(cur);
 
-#if BH_ENABLE_GC_CORRUPTION_CHECK != 0
         if (size <= 0 || size > (uint32)((uint8 *)end - (uint8 *)cur)) {
             LOG_ERROR("[GC_ERROR]Heap is corrupted, heap migrate failed.\n");
+#if BH_ENABLE_GC_CORRUPTION_CHECK != 0
             heap->is_heap_corrupted = true;
+#endif
             return GC_ERROR;
         }
-#endif
 
         if (hmu_get_ut(cur) == HMU_FC && !HMU_IS_FC_NORMAL(size)) {
             tree_node = (hmu_tree_node_t *)cur;
@@ -315,15 +315,13 @@ gc_migrate(gc_handle_t handle, char *pool_buf_new, gc_size_t pool_buf_size)
         cur = (hmu_t *)((char *)cur + size);
     }
 
-#if BH_ENABLE_GC_CORRUPTION_CHECK != 0
     if (cur != end) {
         LOG_ERROR("[GC_ERROR]Heap is corrupted, heap migrate failed.\n");
+#if BH_ENABLE_GC_CORRUPTION_CHECK != 0
         heap->is_heap_corrupted = true;
+#endif
         return GC_ERROR;
     }
-#else
-    bh_assert(cur == end);
-#endif
 
     return 0;
 }

+ 32 - 14
core/shared/platform/include/platform_wasi_types.h

@@ -29,6 +29,9 @@
 #endif /* _Alignof */
 
 extern "C" {
+#elif defined(_MSC_VER) && !_CRT_HAS_C11
+#define _Static_assert static_assert
+#define _Alignof __alignof
 #endif
 
 /* There is no need to check the WASI layout if we're using uvwasi or libc-wasi
@@ -530,19 +533,14 @@ assert_wasi_layout(offsetof(__wasi_subscription_t, userdata) == 0, "witx calcula
 assert_wasi_layout(offsetof(__wasi_subscription_t, u) == 8, "witx calculated offset");
 
 /* keep syncing with wasi_socket_ext.h */
-typedef enum {
-    /* Used only for sock_addr_resolve hints */
-    SOCKET_ANY = -1,
-    SOCKET_DGRAM = 0,
-    SOCKET_STREAM,
-} __wasi_sock_type_t;
 
 typedef uint16_t __wasi_ip_port_t;
 
 /* Ensure that __wasi_addr_type_t has a size of 4 byte (I32).
    However, it will not have the type safety of enum. */
 typedef uint32_t __wasi_addr_type_t;
-enum { IPv4 = 0, IPv6 };
+#define IPv4 (0)
+#define IPv6 (1)
 
 /* n0.n1.n2.n3 */
 typedef struct __wasi_addr_ip4_t {
@@ -589,20 +587,40 @@ typedef struct __wasi_addr_t {
     } addr;
 } __wasi_addr_t;
 
-typedef enum { INET4 = 0, INET6, INET_UNSPEC } __wasi_address_family_t;
+/* Force 32-bit wire width for cross-boundary fields */
+typedef int32_t __wasi_sock_type_t;
+#define SOCKET_ANY    (-1)
+#define SOCKET_DGRAM  (0)
+#define SOCKET_STREAM (1)
+
+typedef int32_t __wasi_address_family_t;
+#define INET4       (0)
+#define INET6       (1)
+#define INET_UNSPEC (2)
 
 typedef struct __wasi_addr_info_t {
-    __wasi_addr_t addr;
+    __wasi_addr_t      addr;
     __wasi_sock_type_t type;
 } __wasi_addr_info_t;
 
 typedef struct __wasi_addr_info_hints_t {
-   __wasi_sock_type_t type;
-   __wasi_address_family_t family;
-   // this is to workaround lack of optional parameters
-   uint8_t hints_enabled;
+    __wasi_sock_type_t        type;          // 4 bytes
+    __wasi_address_family_t   family;        // 4 bytes
+    uint8_t                   hints_enabled; // 1 byte
+    uint8_t                   _pad[3];       // enforce layout
 } __wasi_addr_info_hints_t;
 
+assert_wasi_layout(sizeof(__wasi_sock_type_t) == 4, "sock_type must be 4 bytes");
+assert_wasi_layout(sizeof(__wasi_address_family_t) == 4, "addr_family must be 4 bytes");
+
+assert_wasi_layout(sizeof(__wasi_addr_info_hints_t) == 12, "hints_t must be 12 bytes");
+assert_wasi_layout(offsetof(__wasi_addr_info_hints_t, type) == 0, "hints.type@0");
+assert_wasi_layout(offsetof(__wasi_addr_info_hints_t, family) == 4, "hints.family@4");
+assert_wasi_layout(offsetof(__wasi_addr_info_hints_t, hints_enabled) == 8, "hints.enabled@8");
+
+assert_wasi_layout(offsetof(__wasi_addr_info_t, type) == sizeof(__wasi_addr_t),
+                   "addr_info.type follows addr");
+
 #undef assert_wasi_layout
 
 /* clang-format on */
@@ -610,4 +628,4 @@ typedef struct __wasi_addr_info_hints_t {
 }
 #endif
 
-#endif /* end of _PLATFORM_WASI_TYPES_H */
+#endif /* end of _PLATFORM_WASI_TYPES_H */

+ 16 - 0
core/shared/platform/zephyr/platform_internal.h

@@ -7,8 +7,24 @@
 #ifndef _PLATFORM_INTERNAL_H
 #define _PLATFORM_INTERNAL_H
 
+/*
+ * Modern Zephyr uses zephyr/ namespace.
+ *
+ * Note: Cannot use KERNEL_VERSION_NUMBER here as it's defined in version.h
+ * which we're trying to include. Must use feature detection instead.
+ */
+#ifdef __has_include
+#if __has_include(<zephyr/autoconf.h>)
+#include <zephyr/autoconf.h>
+#include <zephyr/version.h>
+#else
 #include <autoconf.h>
 #include <version.h>
+#endif
+#else
+#include <autoconf.h>
+#include <version.h>
+#endif
 
 #if KERNEL_VERSION_NUMBER < 0x030200 /* version 3.2.0 */
 #include <zephyr.h>

+ 24 - 11
core/shared/platform/zephyr/zephyr_file.c

@@ -120,13 +120,15 @@ zephyr_fs_alloc_obj(bool is_dir, const char *path, int *index)
             ptr = &desc_array[i];
             ptr->used = true;
             ptr->is_dir = is_dir;
-            ptr->path = bh_strdup(path);
             ptr->dir_index = 0;
+            size_t path_len = strlen(path) + 1;
+            ptr->path = BH_MALLOC(path_len);
             if (ptr->path == NULL) {
                 ptr->used = false;
                 k_mutex_unlock(&desc_array_mutex);
                 return NULL;
             }
+            strcpy(ptr->path, path);
             *index = i + 3;
             break;
         }
@@ -451,6 +453,7 @@ os_openat(os_file_handle handle, const char *path, __wasi_oflags_t oflags,
     }
 
     if (!build_absolute_path(abs_path, sizeof(abs_path), path)) {
+        BH_FREE(*out);
         return __WASI_ENOMEM;
     }
 
@@ -591,8 +594,9 @@ os_preadv(os_file_handle handle, const struct __wasi_iovec_t *iov, int iovcnt,
 
         total_read += bytes_read;
 
-        // If we read less than we asked for, stop reading
-        if (bytes_read < iov[i].buf_len) {
+        /*  If we read less than we asked for, stop reading
+            bytes_read being a non-negative value was already checked */
+        if ((size_t)bytes_read < iov[i].buf_len) {
             break;
         }
     }
@@ -627,8 +631,9 @@ os_pwritev(os_file_handle handle, const struct __wasi_ciovec_t *iov, int iovcnt,
 
         total_written += bytes_written;
 
-        // If we wrote less than we asked for, stop writing
-        if (bytes_written < iov[i].buf_len) {
+        /*  If we wrote less than we asked for, stop writing
+            bytes_read being a non-negative value was already checked */
+        if ((size_t)bytes_written < iov[i].buf_len) {
             break;
         }
     }
@@ -657,8 +662,9 @@ os_readv(os_file_handle handle, const struct __wasi_iovec_t *iov, int iovcnt,
 
         total_read += bytes_read;
 
-        // If we read less than we asked for, stop reading
-        if (bytes_read < iov[i].buf_len) {
+        /*  If we read less than we asked for, stop reading
+            bytes_read being a non-negative value was already checked */
+        if ((size_t)bytes_read < iov[i].buf_len) {
             break;
         }
     }
@@ -702,8 +708,9 @@ os_writev(os_file_handle handle, const struct __wasi_ciovec_t *iov, int iovcnt,
 
         total_written += bytes_written;
 
-        // If we wrote less than we asked for, stop writing
-        if (bytes_written < iov[i].buf_len) {
+        /*  If we wrote less than we asked for, stop writing
+            bytes_read being a non-negative value was already checked */
+        if ((size_t)bytes_written < iov[i].buf_len) {
             break;
         }
     }
@@ -850,11 +857,17 @@ os_renameat(os_file_handle old_handle, const char *old_path,
     for (int i = 0; i < CONFIG_WASI_MAX_OPEN_FILES; i++) {
         struct zephyr_fs_desc *ptr = &desc_array[i];
         if (ptr->used && ptr->path && strcmp(ptr->path, abs_old_path) == 0) {
-            char *new_path_copy = bh_strdup(new_path);
+            size_t new_path_len = strlen(abs_new_path) + 1;
+            char *new_path_copy = BH_MALLOC(new_path_len);
             if (new_path_copy != NULL) {
+                strcpy(new_path_copy, abs_new_path);
                 BH_FREE(ptr->path);
                 ptr->path = new_path_copy;
             }
+            else {
+                k_mutex_unlock(&desc_array_mutex);
+                return __WASI_ENOMEM;
+            }
             break; // Only one descriptor should match
         }
     }
@@ -1195,4 +1208,4 @@ bool
 os_is_stderr_handle(os_file_handle handle)
 {
     return (handle == (os_file_handle)stderr);
-}
+}

+ 58 - 34
core/shared/platform/zephyr/zephyr_socket.c

@@ -173,7 +173,7 @@ os_socket_getbooloption(bh_socket_t socket, int level, int optname,
     int optval;
     socklen_t optval_size = sizeof(optval);
 
-    if (zsock_setsockopt(socket->fd, level, optname, &optval, optval_size)
+    if (zsock_getsockopt(socket->fd, level, optname, &optval, &optval_size)
         != 0) {
         return BHT_ERROR;
     }
@@ -190,7 +190,7 @@ os_socket_create(bh_socket_t *sock, bool is_ipv4, bool is_tcp)
 
     *(sock) = BH_MALLOC(sizeof(zephyr_handle));
 
-    if (!sock) {
+    if (!*sock) {
         return BHT_ERROR;
     }
 
@@ -262,8 +262,13 @@ os_socket_settimeout(bh_socket_t socket, uint64 timeout_us)
     timeout.tv_sec = timeout_us / 1000000;
     timeout.tv_usec = timeout_us % 1000000;
 
-    return zsock_setsockopt(socket->fd, SOL_SOCKET, SO_RCVTIMEO, &timeout,
-                            sizeof(timeout));
+    if (zsock_setsockopt(socket->fd, SOL_SOCKET, SO_RCVTIMEO, &timeout,
+                         sizeof(timeout))
+        != 0) {
+        return BHT_ERROR;
+    }
+
+    return BHT_OK;
 }
 
 int
@@ -277,7 +282,7 @@ os_socket_accept(bh_socket_t server_sock, bh_socket_t *sock, void *addr,
                  unsigned int *addrlen)
 {
     *sock = BH_MALLOC(sizeof(zephyr_handle));
-    if (!sock) {
+    if (!*sock) {
         return BHT_ERROR;
     }
 
@@ -609,7 +614,7 @@ os_socket_get_send_timeout(bh_socket_t socket, uint64 *timeout_us)
     struct timeval tv;
     socklen_t tv_len = sizeof(tv);
 
-    if (zsock_setsockopt(socket->fd, SOL_SOCKET, SO_SNDTIMEO, &tv, tv_len)
+    if (zsock_getsockopt(socket->fd, SOL_SOCKET, SO_SNDTIMEO, &tv, &tv_len)
         != 0) {
         return BHT_ERROR;
     }
@@ -639,7 +644,7 @@ os_socket_get_recv_timeout(bh_socket_t socket, uint64 *timeout_us)
     struct timeval tv;
     socklen_t tv_len = sizeof(tv);
 
-    if (zsock_setsockopt(socket->fd, SOL_SOCKET, SO_RCVTIMEO, &tv, tv_len)
+    if (zsock_getsockopt(socket->fd, SOL_SOCKET, SO_RCVTIMEO, &tv, &tv_len)
         != 0) {
         return BHT_ERROR;
     }
@@ -693,21 +698,18 @@ os_socket_get_linger(bh_socket_t socket, bool *is_enabled, int *linger_s)
     return BHT_ERROR;
 }
 
-// TCP_NODELAY Disable TCP buffering (ignored, for compatibility)
 int
 os_socket_set_tcp_no_delay(bh_socket_t socket, bool is_enabled)
 {
-    errno = ENOSYS;
-
-    return BHT_ERROR;
+    return os_socket_setbooloption(socket, IPPROTO_TCP, TCP_NODELAY,
+                                   is_enabled);
 }
 
 int
 os_socket_get_tcp_no_delay(bh_socket_t socket, bool *is_enabled)
 {
-    errno = ENOSYS;
-
-    return BHT_ERROR;
+    return os_socket_getbooloption(socket, IPPROTO_TCP, TCP_NODELAY,
+                                   is_enabled);
 }
 
 int
@@ -760,8 +762,8 @@ os_socket_get_tcp_keep_idle(bh_socket_t socket, uint32_t *time_s)
     socklen_t time_s_len = sizeof(time_s_int);
 
 #ifdef TCP_KEEPIDLE
-    if (zsock_setsockopt(socket->fd, IPPROTO_TCP, TCP_KEEPIDLE, &time_s_int,
-                         time_s_len)
+    if (zsock_getsockopt(socket->fd, IPPROTO_TCP, TCP_KEEPIDLE, &time_s_int,
+                         &time_s_len)
         != 0) {
         return BHT_ERROR;
     }
@@ -769,8 +771,8 @@ os_socket_get_tcp_keep_idle(bh_socket_t socket, uint32_t *time_s)
 
     return BHT_OK;
 #elif defined(TCP_KEEPALIVE)
-    if (zsock_setsockopt(socket->fd, IPPROTO_TCP, TCP_KEEPALIVE, &time_s_int,
-                         time_s_len)
+    if (zsock_getsockopt(socket->fd, IPPROTO_TCP, TCP_KEEPALIVE, &time_s_int,
+                         &time_s_len)
         != 0) {
         return BHT_ERROR;
     }
@@ -856,17 +858,37 @@ os_socket_get_tcp_fastopen_connect(bh_socket_t socket, bool *is_enabled)
 int
 os_socket_set_ip_multicast_loop(bh_socket_t socket, bool ipv6, bool is_enabled)
 {
-    errno = ENOSYS;
-
-    return BHT_ERROR;
+    if (ipv6) {
+#ifdef IPPROTO_IPV6
+        return os_socket_setbooloption(socket, IPPROTO_IPV6,
+                                       IPV6_MULTICAST_LOOP, is_enabled);
+#else
+        errno = EAFNOSUPPORT;
+        return BHT_ERROR;
+#endif
+    }
+    else {
+        return os_socket_setbooloption(socket, IPPROTO_IP, IP_MULTICAST_LOOP,
+                                       is_enabled);
+    }
 }
 
 int
 os_socket_get_ip_multicast_loop(bh_socket_t socket, bool ipv6, bool *is_enabled)
 {
-    errno = ENOSYS;
-
-    return BHT_ERROR;
+    if (ipv6) {
+#ifdef IPPROTO_IPV6
+        return os_socket_getbooloption(socket, IPPROTO_IPV6,
+                                       IPV6_MULTICAST_LOOP, is_enabled);
+#else
+        errno = EAFNOSUPPORT;
+        return BHT_ERROR;
+#endif
+    }
+    else {
+        return os_socket_getbooloption(socket, IPPROTO_IP, IP_MULTICAST_LOOP,
+                                       is_enabled);
+    }
 }
 
 int
@@ -965,13 +987,13 @@ os_socket_set_ip_ttl(bh_socket_t socket, uint8_t ttl_s)
 int
 os_socket_get_ip_ttl(bh_socket_t socket, uint8_t *ttl_s)
 {
-    socklen_t opt_len = sizeof(*ttl_s);
-
-    if (zsock_setsockopt(socket->fd, IPPROTO_IP, IP_MULTICAST_TTL, ttl_s,
-                         opt_len)
-        != 0) {
+    /*  Most socket-level options utilize an int argument for optval */
+    int opt;
+    socklen_t opt_len = sizeof(opt);
+    if (zsock_getsockopt(socket->fd, IPPROTO_IP, IP_TTL, &opt, &opt_len) != 0) {
         return BHT_ERROR;
     }
+    *ttl_s = (uint8_t)opt;
 
     return BHT_OK;
 }
@@ -991,13 +1013,15 @@ os_socket_set_ip_multicast_ttl(bh_socket_t socket, uint8_t ttl_s)
 int
 os_socket_get_ip_multicast_ttl(bh_socket_t socket, uint8_t *ttl_s)
 {
-    socklen_t opt_len = sizeof(*ttl_s);
-
-    if (zsock_setsockopt(socket->fd, IPPROTO_IP, IP_MULTICAST_TTL, ttl_s,
-                         opt_len)
+    /*  Most socket-level options utilize an int argument for optval */
+    int opt;
+    socklen_t opt_len = sizeof(opt);
+    if (zsock_getsockopt(socket->fd, IPPROTO_IP, IP_MULTICAST_TTL, &opt,
+                         &opt_len)
         != 0) {
         return BHT_ERROR;
     }
+    *ttl_s = (uint8_t)opt;
 
     return BHT_OK;
 }
@@ -1059,4 +1083,4 @@ int
 os_poll(os_poll_file_handle *fds, os_nfds_t nfs, int timeout)
 {
     return zsock_poll(fds, nfs, timeout);
-}
+}

+ 10 - 0
core/shared/utils/bh_common.c

@@ -166,6 +166,16 @@ wa_strdup(const char *s)
     return s1;
 }
 
+char *
+bh_strtok_r(char *str, const char *delim, char **saveptr)
+{
+#if !(defined(_WIN32) || defined(_WIN32_))
+    return strtok_r(str, delim, saveptr);
+#else
+    return strtok_s(str, delim, saveptr);
+#endif
+}
+
 #if WASM_ENABLE_WAMR_COMPILER != 0 || WASM_ENABLE_JIT != 0
 int
 bh_system(const char *cmd)

+ 3 - 0
core/shared/utils/bh_common.h

@@ -66,6 +66,9 @@ bh_strdup(const char *s);
 char *
 wa_strdup(const char *s);
 
+char *
+bh_strtok_r(char *str, const char *delim, char **saveptr);
+
 #if WASM_ENABLE_WAMR_COMPILER != 0 || WASM_ENABLE_JIT != 0
 /* Executes a system command in bash/cmd.exe */
 int

+ 5 - 2
core/shared/utils/bh_queue.c

@@ -96,14 +96,15 @@ bh_queue_destroy(bh_queue *queue)
 bool
 bh_post_msg2(bh_queue *queue, bh_queue_node *msg)
 {
+    bh_queue_mutex_lock(&queue->queue_lock);
+
     if (queue->cnt >= queue->max) {
         queue->drops++;
         bh_free_msg(msg);
+        bh_queue_mutex_unlock(&queue->queue_lock);
         return false;
     }
 
-    bh_queue_mutex_lock(&queue->queue_lock);
-
     if (queue->cnt == 0) {
         bh_assert(queue->head == NULL);
         bh_assert(queue->tail == NULL);
@@ -131,7 +132,9 @@ bh_post_msg(bh_queue *queue, unsigned short tag, void *body, unsigned int len)
 {
     bh_queue_node *msg = bh_new_msg(tag, body, len, NULL);
     if (msg == NULL) {
+        bh_queue_mutex_lock(&queue->queue_lock);
         queue->drops++;
+        bh_queue_mutex_unlock(&queue->queue_lock);
         if (len != 0 && body)
             BH_FREE(body);
         return false;

+ 533 - 211
doc/build_wamr.md

@@ -1,36 +1,141 @@
-
 # Build WAMR vmcore
 
-WAMR vmcore is a set of runtime libraries for loading and running Wasm modules. This document introduces how to build the WAMR vmcore.
+WAMR vmcore is the runtime library set that loads and runs Wasm modules. This guide walks you through building the WAMR vmcore.
 
 References:
-- [how to build iwasm](../product-mini/README.md): building different target platforms such as Linux, Windows, Mac etc
-- [Blog: Introduction to WAMR running modes](https://bytecodealliance.github.io/wamr.dev/blog/introduction-to-wamr-running-modes/)
 
+- [how to build iwasm](../product-mini/README.md): build for Linux, Windows, macOS, and more
+- [Blog: Introduction to WAMR running modes](https://bytecodealliance.github.io/wamr.dev/blog/introduction-to-wamr-running-modes/)
 
-## WAMR vmcore cmake building configurations
+## building configurations
 
-By including the script `runtime_lib.cmake` under folder [build-scripts](../build-scripts) in CMakeList.txt, it is easy to use vmcore to build host software with cmake.
+Include the script `runtime_lib.cmake` from [build-scripts](../build-scripts) into your CMakeLists.txt to pull vmcore into your build.
 
 ```cmake
-# add this into your CMakeList.txt
+# add this into your CMakeLists.txt
 include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
 add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
 ```
 
-The script `runtime_lib.cmake` defines a number of variables for configuring the WAMR runtime features. You can set these variables in your CMakeList.txt or pass the configurations from cmake command line.
+The `runtime_lib.cmake` script exposes variables that control WAMR runtime features. Set them in CMakeLists.txt or pass them on the cmake command line.
+
+```cmake
+# Set flags in CMakeLists.txt
+set(WAMR_BUILD_AOT 1)
+set(WAMR_BUILD_JIT 0)
+set(WAMR_BUILD_LIBC_BUILTIN 1)
+set(WAMR_BUILD_LIBC_WASI 1)
+# Include the runtime lib script
+include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
+add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
+```
 
-Please refer to [a full list of configuration options](./tired_support.md#appendix-all-compilation-flags).
+### All compilation flags
+
+| Compilation flags                                                                                        | Description                          |
+| -------------------------------------------------------------------------------------------------------- | ------------------------------------ |
+| [WAMR_APP_THREAD_STACK_SIZE_MAX](#set-maximum-app-thread-stack-size)                                     | Maximum stack size for app threads   |
+| [WAMR_BH_LOG](#host-defined-log)                                                                         | Host defined logging                 |
+| [WAMR_BH_VPRINTF](#host-defined-vprintf)                                                                 | Host defined vprintf                 |
+| [WAMR_BUILD_ALLOC_WITH_USAGE](#user-defined-linear-memory-allocator)                                     | Allocation with usage tracking       |
+| [WAMR_BUILD_ALLOC_WITH_USER_DATA](#user-defined-linear-memory-allocator)                                 | Allocation with user data            |
+| [WAMR_BUILD_AOT](#configure-aot)                                                                         | AoT compilation(wamrc)               |
+| [WAMR_BUILD_AOT](#configure-aot)                                                                         | AoT runtime                          |
+| [WAMR_BUILD_AOT_INTRINSICS](#aot-intrinsics)                                                             | AoT intrinsics                       |
+| [WAMR_BUILD_AOT_STACK_FRAME](#aot-stack-frame-feature)                                                   | AoT stack frame                      |
+| [WAMR_BUILD_AOT_VALIDATOR](#aot-validator)                                                               | AoT validator                        |
+| [WAMR_BUILD_BULK_MEMORY](#bulk-memory-feature)                                                           | bulk memory                          |
+| [WAMR_BUILD_COPY_CALL_STACK](#copy-call-stack)                                                           | copy call stack                      |
+| [WAMR_BUILD_CUSTOM_NAME_SECTION](#name-section)                                                          | name section                         |
+| [WAMR_BUILD_DEBUG_AOT](#source-debugging-features)                                                       | debug AoT                            |
+| [WAMR_BUILD_DEBUG_INTERP](#source-debugging-features)                                                    | debug interpreter                    |
+| [WAMR_BUILD_DUMP_CALL_STACK](#dump-call-stack-feature)                                                   | dump call stack                      |
+| [WAMR_BUILD_DYNAMIC_AOT_DEBUG](#source-debugging-features)                                               | dynamic AoT debugging                |
+| [WAMR_BUILD_EXCE_HANDLING](#exception-handling)                                                          | exception handling                   |
+| [WAMR_BUILD_EXTENDED_CONST_EXPR](#extended-constant-expression)                                          | extended constant expressions        |
+| [WAMR_BUILD_FAST_INTERP](#configure-interpreters)                                                        | fast interpreter                     |
+| [WAMR_BUILD_FAST_JIT](#configure-fast-jit)                                                               | fast JIT                             |
+| [WAMR_BUILD_FAST_JIT_DUMP](#configure-fast-jit)                                                          | fast JIT dump                        |
+| [WAMR_BUILD_GC](#garbage-collection)                                                                     | garbage collection                   |
+| [WAMR_BUILD_GC_HEAP_VERIFY](#garbage-collection)                                                         | garbage collection heap verification |
+| [WAMR_BUILD_GC_HEAP_SIZE_DEFAULT](garbage-collection)                                                    | default garbage collection heap size |
+| [WAMR_BUILD_GLOBAL_HEAP_POOL](#a-pre-allocation-for-runtime-and-wasm-apps)                               | global heap pool                     |
+| [WAMR_BUILD_GLOBAL_HEAP_SIZE](#a-pre-allocation-for-runtime-and-wasm-apps)                               | global heap size                     |
+| [WAMR_BUILD_INSTRUCTION_METERING](#instruction-metering)                                                 | instruction metering                 |
+| [WAMR_BUILD_INTERP](#configure-interpreters)                                                             | interpreter                          |
+| [WAMR_BUILD_INVOKE_NATIVE_GENERAL](#invoke-general-ffi)                                                  | FFI general                          |
+| [WAMR_BUILD_JIT](#configure-llvm-jit)                                                                    | JIT compilation                      |
+| [WAMR_BUILD_LAZY_JIT](#configure-llvm-jit)                                                               | lazy JIT compilation                 |
+| [WAMR_BUILD_LIBC_BUILTIN](#configure-libc)                                                               | libc builtin functions               |
+| [WAMR_BUILD_LIBC_EMCC](#configure-libc)                                                                  | libc emcc compatibility              |
+| [WAMR_BUILD_LIBC_UVWASI](#configure-libc)                                                                | libc uvwasi compatibility            |
+| [WAMR_BUILD_LIBC_WASI](#configure-libc)                                                                  | wasi libc                            |
+| [WAMR_BUILD_LIB_PTHREAD](#lib-pthread)                                                                   | pthread library                      |
+| [WAMR_BUILD_LIB_PTHREAD_SEMAPHORE](#lib-pthread-semaphore)                                               | pthread semaphore support            |
+| [WAMR_BUILD_LIB_RATS](#librats)                                                                          | RATS library                         |
+| [WAMR_BUILD_LIB_WASI_THREADS](#lib-wasi-threads)                                                         | wasi threads                         |
+| [WAMR_BUILD_LINUX_PERF](#linux-perf-support)                                                             | Linux performance counters           |
+| [WAMR_BUILD_LIME1](#lime1-target)                                                                        | LIME1 runtime                        |
+| [WAMR_BUILD_LOAD_CUSTOM_SECTION](#load-wasm-custom-sections)                                             | loading custom sections              |
+| [WAMR_BUILD_MEMORY64](#memory64-feature)                                                                 | memory64 support                     |
+| [WAMR_BUILD_MEMORY_PROFILING](#memory-profiling-experiment)                                              | memory profiling                     |
+| [WAMR_BUILD_MINI_LOADER](#wasm-mini-loader) :warning: :exclamation:                                      | mini loader                          |
+| [WAMR_BUILD_MODULE_INST_CONTEXT](#module-instance-context-apis)                                          | module instance context              |
+| [WAMR_BUILD_MULTI_MEMORY](#multi-memory)                                                                 | multi-memory support                 |
+| [WAMR_BUILD_MULTI_MODULE](#multi-module-feature)                                                         | multi-module support                 |
+| [WAMR_BUILD_PERF_PROFILING](#performance-profiling-experiment)                                           | performance profiling                |
+| [WAMR_BUILD_PLATFORM](#configure-platform-and-architecture)                                              | Default platform                     |
+| [WAMR_BUILD_QUICK_AOT_ENTRY](#quick-aotjti-entries)                                                      | quick AOT entry                      |
+| [WAMR_BUILD_REF_TYPES](#reference-types-feature)                                                         | reference types                      |
+| [WAMR_BUILD_SANITIZER](#sanitizer)                                                                       | sanitizer                            |
+| [WAMR_BUILD_SGX_IPFS](#intel-protected-file-system)                                                      | Intel Protected File System support  |
+| [WAMR_BUILD_SHARED_HEAP](#shared-heap-among-wasm-apps-and-host-native)                                   | shared heap                          |
+| [WAMR_BUILD_SHARED_MEMORY](shared-memory-feature)                                                        | shared memory                        |
+| [WAMR_BUILD_SHRUNK_MEMORY](#shrunk-the-memory-usage)                                                     | shrunk memory                        |
+| [WAMR_BUILD_SIMD](#128-bit-simd-feature)                                                                 | SIMD support                         |
+| [WAMR_BUILD_SIMDE](#128-bit-simd-feature)                                                                | SIMD E extensions                    |
+| [WAMR_BUILD_SPEC_TEST](#support-spec-test)                                                               | spec test                            |
+| [WAMR_BUILD_STACK_GUARD_SIZE](#stack-guard-size)                                                         | Stack guard size                     |
+| [WAMR_BUILD_STATIC_PGO](running-pgoprofile-guided-optimization-instrumented-aot-file)                    | Static PGO                           |
+| [WAMR_BUILD_STRINGREF](#garbage-collection)                                                              | String reference support             |
+| [WAMR_BUILD_TAIL_CALL](#tail-call-feature)                                                               | Tail call optimization               |
+| [WAMR_BUILD_TARGET](#configure-platform-and-architecture)                                                | Default target architecture          |
+| [WAMR_BUILD_THREAD_MGR](#thread-manager)                                                                 | Thread manager                       |
+| [WAMR_BUILD_WAMR_COMPILER](#configure-aot)                                                               | WAMR compiler                        |
+| [WAMR_BUILD_WASI_EPHEMERAL_NN](#lib-wasi-nn-with-wasi_ephemeral_nn-module-support)                       | WASI ephemeral NN                    |
+| [WAMR_BUILD_WASI_NN](#lib-wasi-nn)                                                                       | WASI NN                              |
+| [WAMR_BUILD_WASI_NN_EXTERNAL_DELEGATE_PATH](#lib-wasi-nn-external-delegate-mode)                         | External delegate path for WASI NN   |
+| [WAMR_BUILD_WASI_NN_ENABLE_GPU](#lib-wasi-nn-gpu-mode)                                                   | GPU support for WASI NN              |
+| [WAMR_BUILD_WASI_NN_LLAMACPP](#lib-wasi-nn)                                                              | LLAMA CPP for WASI NN                |
+| [WAMR_BUILD_WASI_NN_ONNX](#lib-wasi-nn)                                                                  | ONNX for WASI NN                     |
+| [WAMR_BUILD_WASI_NN_OPENVINO](#lib-wasi-nn)                                                              | OpenVINO for WASI NN                 |
+| [WAMR_BUILD_WASI_NN_TFLITE](#lib-wasi-nn)                                                                | TFLite for WASI NN                   |
+| [WAMR_BUILD_WASM_CACHE](#wasm-cache)                                                                     | WASM cache                           |
+| [WAMR_CONFIGURABLE_BOUNDS_CHECKS](#configurable-memory-access-boundary-check) :warning: :exclamation:    | Configurable bounds checks           |
+| [WAMR_DISABLE_APP_ENTRY](#exclude-wamr-application-entry-functions)                                      | Disable app entry                    |
+| [WAMR_DISABLE_HW_BOUND_CHECK](#disable-boundary-check-with-hardware-trap)                                | Disable hardware bound check         |
+| [WAMR_DISABLE_STACK_HW_BOUND_CHECK](#disable-native-stack-boundary-check-with-hardware-trap)             | Disable stack hardware bound check   |
+| [WAMR_DISABLE_WAKEUP_BLOCKING_OP](#disable-async-wakeup-of-blocking-operation)                           | Disable wakeup blocking operation    |
+| [WAMR_DISABLE_WRITE_GS_BASE](#disable-writing-the-linear-memory-base-address-to-x86-gs-segment-register) | Disable write GS base                |
+| [WAMR_TEST_GC](#test-garbage-collection)                                                                 | Test garbage collection              |
+
+### **Privileged Features** :warning: :exclamation:
+
+_Privileged Features_ are powerful options that can boost performance or add capabilities but lower security by compromising isolation. Use them with care and test thoroughly.
+
+### **[config.h](../core/config.h)**
+
+Above compilation flags map to macros in `config.h`. For example, `WAMR_BUILD_AOT` maps to `WAMR_BUILD_AOT` in `config.h`. The build system sets these macros automatically based on your CMake settings. If your build doesn't set those flags, default values in `config.h` apply.
 
 ### **Configure platform and architecture**
 
-- **WAMR_BUILD_PLATFORM**:  set the target platform. It can be set to any platform name (folder name) under folder [core/shared/platform](../core/shared/platform).
+- **WAMR_BUILD_PLATFORM**: set the target platform. Match the platform folder name under [core/shared/platform](../core/shared/platform).
 
-- **WAMR_BUILD_TARGET**: set the target CPU architecture. Current supported targets are:  X86_64, X86_32, AARCH64, ARM, THUMB, XTENSA, ARC, RISCV32, RISCV64 and MIPS.
-  - For ARM and THUMB, the format is \<arch>\[\<sub-arch>]\[_VFP], where \<sub-arch> is the ARM sub-architecture and the "_VFP" suffix means using VFP coprocessor registers s0-s15 (d0-d7) for passing arguments or returning results in standard procedure-call. Both \<sub-arch> and "_VFP" are optional, e.g. ARMV7, ARMV7_VFP, THUMBV7, THUMBV7_VFP and so on.
-  - For AARCH64, the format is\<arch>[\<sub-arch>], VFP is enabled by default. \<sub-arch> is optional, e.g. AARCH64, AARCH64V8, AARCH64V8.1 and so on.
-  - For RISCV64, the format is \<arch\>[_abi], where "_abi" is optional, currently the supported formats are RISCV64, RISCV64_LP64D and RISCV64_LP64: RISCV64 and RISCV64_LP64D are identical, using [LP64D](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) as abi (LP64 with hardware floating-point calling convention for FLEN=64). And RISCV64_LP64 uses [LP64](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) as abi (Integer calling-convention only, and hardware floating-point calling convention is not used).
-  - For RISCV32, the format is \<arch\>[_abi], where "_abi" is optional, currently the supported formats are RISCV32, RISCV32_ILP32D, RISCV32_ILP32F and RISCV32_ILP32: RISCV32 and RISCV32_ILP32D are identical, using [ILP32D](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) as abi (ILP32 with hardware floating-point calling convention for FLEN=64). RISCV32_ILP32F uses [ILP32F](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) as abi (ILP32 with hardware floating-point calling convention for FLEN=32). And RISCV32_ILP32 uses [ILP32](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) as abi (Integer calling-convention only, and hardware floating-point calling convention is not used).
+- **WAMR_BUILD_TARGET**: set the target CPU architecture. Supported targets: X86_64, X86_32, AARCH64, ARM, THUMB, XTENSA, ARC, RISCV32, RISCV64, and MIPS.
+  - For ARM and THUMB, use `<arch>[<sub-arch>][_VFP]`. `<sub-arch>` is the ARM sub-architecture. `_VFP` means arguments and returns use VFP coprocessor registers s0-s15 (d0-d7). Both are optional, for example ARMV7, ARMV7_VFP, THUMBV7, or THUMBV7_VFP.
+  - For AARCH64, use `<arch>[<sub-arch>]`. VFP is on by default. `<sub-arch>` is optional, for example AARCH64, AARCH64V8, or AARCH64V8.1.
+  - For RISCV64, use `<arch>[_abi]`. `_abi` is optional. Supported: RISCV64, RISCV64_LP64D, and RISCV64_LP64. RISCV64 and RISCV64_LP64D both use [LP64D](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) (LP64 with hardware floating-point for FLEN=64). RISCV64_LP64 uses [LP64](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) (integer calling convention only; no hardware floating-point calling convention).
+  - For RISCV32, use `<arch>[_abi]`. `_abi` is optional. Supported: RISCV32, RISCV32_ILP32D, RISCV32_ILP32F, and RISCV32_ILP32. RISCV32 and RISCV32_ILP32D both use [ILP32D](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) (ILP32 with hardware floating-point for FLEN=64). RISCV32_ILP32F uses [ILP32F](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) (ILP32 with hardware floating-point for FLEN=32). RISCV32_ILP32 uses [ILP32](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc#named-abis) (integer calling convention only).
 
 ```bash
 cmake -DWAMR_BUILD_PLATFORM=linux -DWAMR_BUILD_TARGET=ARM
@@ -38,171 +143,270 @@ cmake -DWAMR_BUILD_PLATFORM=linux -DWAMR_BUILD_TARGET=ARM
 
 ### **Configure interpreters**
 
-- **WAMR_BUILD_INTERP**=1/0: enable or disable WASM interpreter
+- **WAMR_BUILD_INTERP**=1/0: turn the WASM interpreter on or off.
+
+- **WAMR_BUILD_FAST_INTERP**=1/0: pick fast (default) or classic interpreter.
+
+> [!NOTE]
+> The fast interpreter runs ~2X faster than classic interpreter, but consumes about 2X memory to hold the pre-compiled code.
 
-- **WAMR_BUILD_FAST_INTERP**=1/0: build fast (default) or classic WASM interpreter.
+### **Configure AOT**
 
-  NOTE: the fast interpreter runs ~2X faster than classic interpreter, but consumes about 2X memory to hold the pre-compiled code.
+- **WAMR_BUILD_AOT**=1/0: turn AOT on or off. Defaults to on.
+- **WAMR_BUILD_WAMR_COMPILER**=1/0. It is used to wasm loader and compilation to indictate compiler mode.
 
-### **Configure AOT and JITs**
+### **Configure LLVM JIT**
 
-- **WAMR_BUILD_AOT**=1/0, enable AOT or not, default to enable if not set
-- **WAMR_BUILD_JIT**=1/0, enable LLVM JIT or not, default to disable if not set
-- **WAMR_BUILD_FAST_JIT**=1/0, enable Fast JIT or not, default to disable if not set
-- **WAMR_BUILD_FAST_JIT**=1 and **WAMR_BUILD_JIT**=1, enable Multi-tier JIT, default to disable if not set
+Comparing with fast JIT, LLVM JIT covers more architectures and produces better optimized code, but takes longer on cold start.
+
+- **WAMR_BUILD_JIT**=1/0: turn LLVM JIT on or off. Defaults to off.
+- **WAMR_BUILD_LAZY_JIT**=1/0: turn lazy JIT on or off. Defaults to off. With lazy JIT, functions are compiled in background threads before they are called, which can reduce startup time for large modules.
+
+### **Configure Fast JIT**
+
+The fast JIT is a lightweight JIT that emits code quickly and tunes hot functions.
+
+- **WAMR_BUILD_FAST_JIT**=1/0: turn Fast JIT on or off. Defaults to off.
+- **WAMR_BUILD_FAST_JIT_DUMP**=1/0: dump fast JIT compiled code to stdout for debugging. Defaults to off.
+
+> [!WARNING]
+> It currently covers only a few architectures (x86_64).
+
+### **Configure Multi-tier JIT**
+
+Use fast jit as the first tier and LLVM JIT as the second tier.
+
+- With **WAMR_BUILD_FAST_JIT**=1 and **WAMR_BUILD_JIT**=1, you get multi-tier JIT. Defaults to off.
+
+> [!WARNING]
+> It currently covers only a few architectures (x86_64).
 
 ### **Configure LIBC**
 
-- **WAMR_BUILD_LIBC_BUILTIN**=1/0, build the built-in libc subset for WASM app, default to enable if not set
+- **WAMR_BUILD_LIBC_BUILTIN**=1/0: build the built-in libc subset for WASM apps. Defaults to on.
+
+- **WAMR_BUILD_LIBC_WASI**=1/0: build the [WASI](https://github.com/WebAssembly/WASI) libc subset for WASM apps. Defaults to on.
 
-- **WAMR_BUILD_LIBC_WASI**=1/0, build the [WASI](https://github.com/WebAssembly/WASI) libc subset for WASM app, default to enable if not set
+- **WAMR_BUILD_LIBC_UVWASI**=1/0 (Experiment): build the WASI libc subset for WASM apps using [uvwasi](https://github.com/nodejs/uvwasi). Defaults to off.
 
-- **WAMR_BUILD_LIBC_UVWASI**=1/0 (Experiment), build the [WASI](https://github.com/WebAssembly/WASI) libc subset for WASM app based on [uvwasi](https://github.com/nodejs/uvwasi) implementation, default to disable if not set
+- **WAMR_BUILD_LIBC_EMCC**=1/0: build the emcc-compatible libc subset for WASM apps. Defaults to off.
 
-> Note: WAMR doesn't support a safe sandbox on all platforms. For platforms that do not support **WAMR_BUILD_LIBC_WASI**, e.g. Windows, developers can try using an unsafe uvwasi-based WASI implementation by using **WAMR_BUILD_LIBC_UVWASI**.
+> [!WARNING]
+> WAMR is not a secure sandbox on every platform. On platforms where **WAMR_BUILD_LIBC_WASI** is unsupported (for example Windows), you can try the uvwasi-based WASI via **WAMR_BUILD_LIBC_UVWASI**, but it is unsafe.
 
-### **Enable Multi-Module feature**
+### **Multi-Module feature**
 
-- **WAMR_BUILD_MULTI_MODULE**=1/0, default to disable if not set
-> Note: See [Multiple Modules as Dependencies](./multi_module.md) for more details.
+- **WAMR_BUILD_MULTI_MODULE**=1/0, default to off.
 
-### **Enable WASM mini loader**
+> [!NOTE]
+> See [Multiple Modules as Dependencies](./multi_module.md) for details.
 
-- **WAMR_BUILD_MINI_LOADER**=1/0, default to disable if not set
+> [!WARNING]
+> The multi-module feature is not supported in fast-jit or llvm-jit modes.
 
-> Note: the mini loader doesn't check the integrity of the WASM binary file, developer must ensure that the WASM file is well-formed.
+### **WASM mini loader**
 
-### **Enable shared memory feature**
-- **WAMR_BUILD_SHARED_MEMORY**=1/0, default to disable if not set
+- **WAMR_BUILD_MINI_LOADER**=1/0, default to off.
 
-### **Enable bulk memory feature**
-- **WAMR_BUILD_BULK_MEMORY**=1/0, default to disable if not set
+> [!NOTE]
+> The mini loader skips integrity checks on the WASM binary. Make sure the file is valid yourself.
 
-### **Enable memory64 feature**
-- **WAMR_BUILD_MEMORY64**=1/0, default to disable if not set
+> [!WARNING]
+> This is a [privileged feature](#privileged-features) that compromises security. Use it only when you trust the WASM binary source.
 
-> Note: Currently, the memory64 feature is only supported in classic interpreter running mode and AOT mode.
+### **shared memory feature**
 
-### **Enable thread manager**
-- **WAMR_BUILD_THREAD_MGR**=1/0, default to disable if not set
+- **WAMR_BUILD_SHARED_MEMORY**=1/0, default to off.
 
-### **Enable lib-pthread**
-- **WAMR_BUILD_LIB_PTHREAD**=1/0, default to disable if not set
-> Note: The dependent feature of lib pthread such as the `shared memory` and `thread manager` will be enabled automatically.
+### **bulk memory feature**
 
-> See [WAMR pthread library](./pthread_library.md) for more details.
+- **WAMR_BUILD_BULK_MEMORY**=1/0, default to off.
 
-### **Enable lib-pthread-semaphore**
-- **WAMR_BUILD_LIB_PTHREAD_SEMAPHORE**=1/0, default to disable if not set
-> Note: This feature depends on `lib-pthread`, it will be enabled automatically if this feature is enabled.
+### **memory64 feature**
 
-### **Enable lib wasi-threads**
-- **WAMR_BUILD_LIB_WASI_THREADS**=1/0, default to disable if not set
-> Note: The dependent feature of lib wasi-threads such as the `shared memory` and `thread manager` will be enabled automatically.
+- **WAMR_BUILD_MEMORY64**=1/0, default to off.
 
-> See [wasi-threads](./pthread_impls.md#wasi-threads-new) and [Introduction to WAMR WASI threads](https://bytecodealliance.github.io/wamr.dev/blog/introduction-to-wamr-wasi-threads) for more details.
+> [!WARNING]
+> Supported only in classic interpreter mode and AOT mode.
 
-### **Enable lib wasi-nn**
-- **WAMR_BUILD_WASI_NN**=1/0, default to disable if not set
-> Note: WAMR_BUILD_WASI_NN without WAMR_BUILD_WASI_EPHEMERAL_NN is deprecated and will likely be removed in future versions of WAMR. Please consider to enable WAMR_BUILD_WASI_EPHEMERAL_NN as well.
-> Note: See [WASI-NN](../core/iwasm/libraries/wasi-nn) for more details.
+### **thread manager**
 
-### **Enable lib wasi-nn GPU mode**
-- **WAMR_BUILD_WASI_NN_ENABLE_GPU**=1/0, default to disable if not set
+- **WAMR_BUILD_THREAD_MGR**=1/0, default to off.
 
-### **Enable lib wasi-nn external delegate mode**
-- **WAMR_BUILD_WASI_NN_ENABLE_EXTERNAL_DELEGATE**=1/0, default to disable if not set
+### **lib-pthread**
 
-- **WAMR_BUILD_WASI_NN_EXTERNAL_DELEGATE_PATH**=Path to the external delegate shared library (e.g. `libedgetpu.so.1.0` for Coral USB)
+- **WAMR_BUILD_LIB_PTHREAD**=1/0, default to off.
 
-### **Enable lib wasi-nn with `wasi_ephemeral_nn` module support**
-- **WAMR_BUILD_WASI_EPHEMERAL_NN**=1/0, default to enable if not set
+> [!NOTE]
+> When you enable lib pthread, required features such as `shared memory` and `thread manager` are enabled automatically. See [WAMR pthread library](./pthread_library.md) for details.
+
+### **lib-pthread-semaphore**
+
+- **WAMR_BUILD_LIB_PTHREAD_SEMAPHORE**=1/0, default to off.
+
+> [!NOTE]
+> This depends on `lib-pthread` and turns it on automatically.
+
+### **lib wasi-threads**
+
+- **WAMR_BUILD_LIB_WASI_THREADS**=1/0, default to off.
+
+> [!NOTE]
+> Enabling lib wasi-threads also enables its dependencies `shared memory` and `thread manager`. See [wasi-threads](./pthread_impls.md#wasi-threads-new) and [Introduction to WAMR WASI threads](https://bytecodealliance.github.io/wamr.dev/blog/introduction-to-wamr-wasi-threads) for details.
+
+### **lib wasi-nn**
+
+- **WAMR_BUILD_WASI_NN**=1/0, default to off.
+- **WAMR_BUILD_WASI_NN_LLAMACPP**=1/0, default to off.
+- **WAMR_BUILD_WASI_NN_ONNX**=1/0, default to off.
+- **WAMR_BUILD_WASI_NN_OPENVINO**=1/0, default to off.
+- **WAMR_BUILD_WASI_NN_TFLITE**=1/0, default to off.
+
+> [!NOTE]
+> Using WAMR_BUILD_WASI_NN without WAMR_BUILD_WASI_EPHEMERAL_NN is deprecated and may be removed later. Please enable WAMR_BUILD_WASI_EPHEMERAL_NN too. See [WASI-NN](../core/iwasm/libraries/wasi-nn) for details.
+
+### **lib wasi-nn GPU mode**
+
+- **WAMR_BUILD_WASI_NN_ENABLE_GPU**=1/0, default to off.
+
+### **lib wasi-nn external delegate mode**
+
+- **WAMR_BUILD_WASI_NN_ENABLE_EXTERNAL_DELEGATE**=1/0, default to off.
+
+- **WAMR_BUILD_WASI_NN_EXTERNAL_DELEGATE_PATH**=Path to the external delegate shared library (for example `libedgetpu.so.1.0` for Coral USB).
+
+### **lib wasi-nn with `wasi_ephemeral_nn` module support**
+
+- **WAMR_BUILD_WASI_EPHEMERAL_NN**=1/0, default to on.
 
 ### **Disable boundary check with hardware trap**
-- **WAMR_DISABLE_HW_BOUND_CHECK**=1/0, default to enable if not set and supported by platform
-> Note: by default only platform [linux/darwin/android/windows/vxworks 64-bit](https://github.com/bytecodealliance/wasm-micro-runtime/blob/5fb5119239220b0803e7045ca49b0a29fe65e70e/core/shared/platform/linux/platform_internal.h#L81) will enable the boundary check with hardware trap feature, for 32-bit platforms it's automatically disabled even when the flag is set to 0, and the wamrc tool will generate AOT code without boundary check instructions in all 64-bit targets except SGX to improve performance. The boundary check includes linear memory access boundary and native stack access boundary, if `WAMR_DISABLE_STACK_HW_BOUND_CHECK` below isn't set.
+
+- **WAMR_DISABLE_HW_BOUND_CHECK**=1/0, default to on if the platform supports it. Otherwise, software boundary checks are used.
+
+> [!NOTE]
+> By default only [linux/darwin/android/windows/vxworks 64-bit](https://github.com/bytecodealliance/wasm-micro-runtime/blob/5fb5119239220b0803e7045ca49b0a29fe65e70e/core/shared/platform/linux/platform_internal.h#L81) platforms enable this hardware trap boundary check. On 32-bit platforms it is off even if the flag is 0. The wamrc tool omits boundary check instructions in AOT code for all 64-bit targets except SGX to improve speed. The boundary check covers linear memory access and native stack access unless `WAMR_DISABLE_STACK_HW_BOUND_CHECK` is set.
 
 ### **Disable native stack boundary check with hardware trap**
-- **WAMR_DISABLE_STACK_HW_BOUND_CHECK**=1/0, default to enable if not set and supported by platform, same as `WAMR_DISABLE_HW_BOUND_CHECK`.
-> Note: When boundary check with hardware trap is disabled, or `WAMR_DISABLE_HW_BOUND_CHECK` is set to 1, the native stack boundary check with hardware trap will be disabled too, no matter what value is set to `WAMR_DISABLE_STACK_HW_BOUND_CHECK`. And when boundary check with hardware trap is enabled, the status of this feature is set according to the value of `WAMR_DISABLE_STACK_HW_BOUND_CHECK`.
+
+- **WAMR_DISABLE_STACK_HW_BOUND_CHECK**=1/0, default to on if the platform supports it; same rule as `WAMR_DISABLE_HW_BOUND_CHECK`. Otherwise, software boundary checks are used.
+
+> [!NOTE]
+> If hardware trap boundary checks are off (or `WAMR_DISABLE_HW_BOUND_CHECK` is 1), native stack boundary checks are also off regardless of `WAMR_DISABLE_STACK_HW_BOUND_CHECK`. If hardware trap boundary checks are on, this setting decides whether the native stack check is on.
 
 ### **Disable async wakeup of blocking operation**
-- **WAMR_DISABLE_WAKEUP_BLOCKING_OP**=1/0, default to enable if supported by the platform
-> Note: The feature helps async termination of blocking threads. If you disable it, the runtime can wait for termination of blocking threads possibly forever.
 
-### **Enable tail call feature**
-- **WAMR_BUILD_TAIL_CALL**=1/0, default to disable if not set
+- **WAMR_DISABLE_WAKEUP_BLOCKING_OP**=1/0, default to on when the platform supports it.
+
+> [!NOTE]
+> This feature lets blocking threads terminate asynchronously. If you disable it, blocking threads may never finish when asked to exit.
+
+### **tail call feature**
+
+- **WAMR_BUILD_TAIL_CALL**=1/0, default to off.
+
+### **128-bit SIMD feature**
+
+- **WAMR_BUILD_SIMD**=1/0, default to on.
+- **WAMR_BUILD_SIMDE**=1/0, default to off.
+
+SIMDE (SIMD Everywhere) implements SIMD operations in fast interpreter mode.
+
+> [!WARNING]
+> Supported in AOT, JIT, and fast-interpreter modes with the SIMDe library.
+
+### **SIMDe library for SIMD in fast interpreter**
+
+- **WAMR_BUILD_LIB_SIMDE**=1/0, default to off.
 
-### **Enable 128-bit SIMD feature**
-- **WAMR_BUILD_SIMD**=1/0, default to enable if not set
-> Note: supported in AOT mode, JIT mode, and fast-interpreter mode with SIMDe library.
+> [!NOTE]
+> When enabled, SIMDe (SIMD Everywhere) implements SIMD operations in fast interpreter mode.
 
-### **Enable SIMDe library for SIMD in fast interpreter**
-- **WAMR_BUILD_LIB_SIMDE**=1/0, default to disable if not set
-> Note: If enabled, SIMDe (SIMD Everywhere) library will be used to implement SIMD operations in fast interpreter mode.
+### **Exception Handling**
 
-### **Enable Exception Handling**
-- **WAMR_BUILD_EXCE_HANDLING**=1/0, default to disable if not set
+- **WAMR_BUILD_EXCE_HANDLING**=1/0, default to off.
 
-> Note: Currently, the exception handling feature is only supported in classic interpreter running mode.
+> [!NOTE]
+> Current implementation supports only Legacy Wasm exception handling proposal, not the latest version.
 
-### **Enable Garbage Collection**
-- **WAMR_BUILD_GC**=1/0, default to disable if not set
+> [!WARNING]
+> Exception handling currently works only in classic interpreter mode.
+
+### **Garbage Collection**
+
+- **WAMR_BUILD_GC**=1/0, default to off.
+- **WAMR_BUILD_GC_HEAP_VERIFY**=1/0, default to off. When enabled, verifies the heap during free.
+- **WAMR_BUILD_STRINGREF**=1/0, default to off. When enabled, need to set WAMR_STRINGREF_IMPL_SOURCE as well
+
+> [!WARNING]
+> Garbage collection is not supported in fast-jit mode and multi-tier-jit mode.
 
 ### **Set the Garbage Collection heap size**
-- **WAMR_BUILD_GC_HEAP_SIZE_DEFAULT**=n, default to 128 kB (131072) if not set
 
-### **Configure Debug**
+- **WAMR_BUILD_GC_HEAP_SIZE_DEFAULT**=n, default to 128 kB (131072).
+
+### **Multi Memory**
+
+- **WAMR_BUIL_MULTI_MEMORY**=1/0, default to off.
+
+> [!WARNING]
+> Multi memory is supported only in classic interpreter mode.
+
+### **Name Section**
+
+- **WAMR_BUILD_CUSTOM_NAME_SECTION**=1/0: load function names from the custom name section. Default is off.
+
+### **AOT stack frame feature**
 
-- **WAMR_BUILD_CUSTOM_NAME_SECTION**=1/0, load the function name from custom name section, default to disable if not set
+- **WAMR_BUILD_AOT_STACK_FRAME**=1/0, default to off.
 
-### **Enable AOT stack frame feature**
-- **WAMR_BUILD_AOT_STACK_FRAME**=1/0, default to disable if not set
-> Note: if it is enabled, the AOT or JIT stack frames (like stack frame of classic interpreter but only necessary data is committed) will be created for AOT or JIT mode in function calls. And please add `--enable-dump-call-stack` option to wamrc during compiling AOT module.
+> [!NOTE]
+> When enabled, AOT or JIT stack frames (similar to classic interpreter frames but storing only what is needed) are built during calls. Add `--enable-dump-call-stack` to wamrc when compiling AOT modules.
 
-### **Enable dump call stack feature**
-- **WAMR_BUILD_DUMP_CALL_STACK**=1/0, default to disable if not set
+### **dump call stack feature**
 
-> Note: if it is enabled, the call stack will be dumped when exception occurs.
+- **WAMR_BUILD_DUMP_CALL_STACK**=1/0, default to off.
 
-> - For interpreter mode, the function names are firstly extracted from *custom name section*, if this section doesn't exist or the feature is not enabled, then the name will be extracted from the import/export sections
-> - For AOT/JIT mode, the function names are extracted from import/export section, please export as many functions as possible (for `wasi-sdk` you can use `-Wl,--export-all`) when compiling wasm module, and add `--enable-dump-call-stack --emit-custom-sections=name` option to wamrc during compiling AOT module.
+> [!NOTE]
+> When enabled, the runtime dumps the call stack on exceptions.
+>
+> - In interpreter mode, names come first from the custom name section. If that section is absent or disabled, names come from import/export sections.
+> - In AOT/JIT mode, names come from the import/export section. Export as many functions as possible (for `wasi-sdk` you can use `-Wl,--export-all`) when compiling the wasm module, and add `--enable-dump-call-stack --emit-custom-sections=name` to wamrc when compiling the AOT module.
 
-### **Enable memory profiling (Experiment)**
-- **WAMR_BUILD_MEMORY_PROFILING**=1/0, default to disable if not set
-> Note: if it is enabled, developer can use API `void wasm_runtime_dump_mem_consumption(wasm_exec_env_t exec_env)` to dump the memory consumption info.
-Currently we only profile the memory consumption of module, module_instance and exec_env, the memory consumed by other components such as `wasi-ctx`, `multi-module` and `thread-manager` are not included.
+### **memory profiling (Experiment)**
 
-> Also refer to [Memory usage estimation for a module](./memory_usage.md).
+- **WAMR_BUILD_MEMORY_PROFILING**=1/0, default to off.
 
-### **Enable performance profiling (Experiment)**
-- **WAMR_BUILD_PERF_PROFILING**=1/0, default to disable if not set
-> Note: if it is enabled, developer can use API `void wasm_runtime_dump_perf_profiling(wasm_module_inst_t module_inst)` to dump the performance consumption info. Currently we only profile the performance consumption of each WASM function.
+> [!NOTE]
+> When enabled, call `void wasm_runtime_dump_mem_consumption(wasm_exec_env_t exec_env)` to dump memory usage. Currently only module, module_instance, and exec_env memory are measured; other components such as `wasi-ctx`, `multi-module`, and `thread-manager` are not included. See [Memory usage estimation for a module](./memory_usage.md).
 
-> The function name searching sequence is the same with dump call stack feature.
+### **performance profiling (Experiment)**
 
-> Also refer to [Tune the performance of running wasm/aot file](./perf_tune.md).
+- **WAMR_BUILD_PERF_PROFILING**=1/0, default to off.
 
-### **Enable the global heap**
-- **WAMR_BUILD_GLOBAL_HEAP_POOL**=1/0, default to disable if not set for all *iwasm* applications, except for the platforms Alios and Zephyr.
+> [!NOTE]
+> When enabled, call `void wasm_runtime_dump_perf_profiling(wasm_module_inst_t module_inst)` to dump per-function performance. Function name lookup follows the same order as the dump call stack feature. See [Tune the performance of running wasm/aot file](./perf_tune.md).
 
-> **WAMR_BUILD_GLOBAL_HEAP_POOL** is used in the *iwasm* applications provided in the directory `product-mini`. When writing your own host application using WAMR, if you want to use a global heap and allocate memory from it, you must set the initialization argument `mem_alloc_type` to `Alloc_With_Pool`.
-> The global heap is defined in the documentation [Memory model and memory usage tunning](memory_tune.md).
+### **A pre-allocation for runtime and wasm apps**
 
-### **Set the global heap size**
-- **WAMR_BUILD_GLOBAL_HEAP_SIZE**=n, default to 10 MB (10485760) if not set for all *iwasm* applications, except for the platforms Alios (256 kB), Riot (256 kB) and Zephyr (128 kB).
+- **WAMR_BUILD_GLOBAL_HEAP_POOL**=1/0, default to off for _iwasm_ apps except on Alios and Zephyr.
+- **WAMR_BUILD_GLOBAL_HEAP_SIZE**=n, default to 10 MB (10485760) for _iwasm_ apps, except Alios (256 kB), Riot (256 kB), and Zephyr (128 kB).
 
-> **WAMR_BUILD_GLOBAL_HEAP_SIZE** is used in the *iwasm* applications provided in the directory `product-mini`. When writing your own host application using WAMR, if you want to set the amount of memory dedicated to the global heap pool, you must set the initialization argument `mem_alloc_option.pool` with the appropriate values.
-> The global heap is defined in the documentation [Memory model and memory usage tunning](memory_tune.md).
-> Note: if `WAMR_BUILD_GLOBAL_HEAP_SIZE` is not set and the flag `WAMR_BUILD_SPEC_TEST` is set, the global heap size is equal to 300 MB (314572800), or 100 MB (104857600) when compiled for Intel SGX (Linux).
+> [!NOTE]
+> When enabled, WAMR uses a big global heap for runtime and wasm apps instead of allocating memory from the system directly. This can reduce memory fragmentation and improve performance when many small allocations happen. The global heap is allocated at startup. **WAMR_BUILD_GLOBAL_HEAP_POOL** applies to _iwasm_ apps in `product-mini`. For your own host app, set `mem_alloc_type` to `Alloc_With_Pool` if you want to use a global heap. The global heap is described in [Memory model and memory usage tunning](memory_tune.md). **WAMR_BUILD_GLOBAL_HEAP_SIZE** applies to _iwasm_ apps in `product-mini`. For your host app, set `mem_alloc_option.pool` with the size you want for the global heap. The global heap is described in [Memory model and memory usage tunning](memory_tune.md).
 
 ### **Set maximum app thread stack size**
-- **WAMR_APP_THREAD_STACK_SIZE_MAX**=n, default to 8 MB (8388608) if not set
-> Note: the AOT boundary check with hardware trap mechanism might consume large stack since the OS may lazily grow the stack mapping as a guard page is hit, we may use this configuration to reduce the total stack usage, e.g. -DWAMR_APP_THREAD_STACK_SIZE_MAX=131072 (128 KB).
 
-### **Set vprintf callback**
-- **WAMR_BH_VPRINTF**=<vprintf_callback>, default to disable if not set
-> Note: if the vprintf_callback function is provided by developer, the os_printf() and os_vprintf() in Linux, Darwin, Windows, VxWorks, Android and esp-idf platforms, besides WASI Libc output will call the callback function instead of libc vprintf() function to redirect the stdout output. For example, developer can define the callback function like below outside runtime lib:
+- **WAMR_APP_THREAD_STACK_SIZE_MAX**=n, default to 8 MB (8388608).
+
+> [!NOTE]
+> AOT boundary checks with hardware traps may use large stacks because the OS can grow stacks lazily when a guard page is hit. Use this setting to cap total stack use, for example `-DWAMR_APP_THREAD_STACK_SIZE_MAX=131072` (128 KB).
+
+### **Host defined vprintf**
+
+- **WAMR_BH_VPRINTF**=<vprintf_callback>, default to off.
+
+> [!NOTE]
+> If you provide `vprintf_callback`, `os_printf()` and `os_vprintf()` on Linux, Darwin, Windows, VxWorks, Android, and esp-idf, plus WASI libc output, call your callback instead of libc `vprintf()`. Example outside the runtime lib:
 >
 > ```C
 > int my_vprintf(const char *format, va_list ap)
@@ -220,64 +424,91 @@ Currently we only profile the memory consumption of module, module_instance and
 > }
 > ```
 >
-> and then use `cmake -DWAMR_BH_VPRINTF=my_vprintf ..` to pass the callback function, or add `BH_VPRINTF=my_vprintf` macro for the compiler, e.g. add line `add_definitions(-DBH_VPRINTF=my_vprintf)` in CMakeLists.txt. See [basic sample](../samples/basic/src/main.c) for a usage example.
+> Then run `cmake -DWAMR_BH_VPRINTF=my_vprintf ..`, or add the compiler macro `BH_VPRINTF=my_vprintf` (for example `add_definitions(-DBH_VPRINTF=my_vprintf)` in CMakeLists.txt). See [basic sample](../samples/basic/src/main.c) for an example.
 
-### **WAMR_BH_LOG**=<log_callback>, default to disable if not set
-> Note: if the log_callback function is provided by the developer, WAMR logs are redirected to such callback. For example:
+### **WAMR_BH_LOG**=<log_callback>, default to off.
+
+> [!NOTE]
+> If you provide `log_callback`, WAMR logs go there. Example:
+>
 > ```C
 > void my_log(uint32 log_level, const char *file, int line, const char *fmt, ...)
 > {
 >     /* Usage of custom logger */
 > }
 > ```
-> See [basic sample](../samples/basic/src/main.c) for a usage example.
+>
+> See [basic sample](../samples/basic/src/main.c) for an example.
 
-### **Enable reference types feature**
-- **WAMR_BUILD_REF_TYPES**=1/0, default to enable if not set
+### **reference types feature**
+
+- **WAMR_BUILD_REF_TYPES**=1/0, default to on.
 
 ### **Exclude WAMR application entry functions**
-- **WAMR_DISABLE_APP_ENTRY**=1/0, default to disable if not set
 
-> Note: The WAMR application entry (`core/iwasm/common/wasm_application.c`) encapsulate some common process to instantiate, execute the wasm functions and print the results. Some platform related APIs are used in these functions, so you can enable this flag to exclude this file if your platform doesn't support those APIs.
-> *Don't enable this flag if you are building `product-mini`*
+- **WAMR_DISABLE_APP_ENTRY**=1/0, default to off.
+
+> [!NOTE]
+> The WAMR application entry (`core/iwasm/common/wasm_application.c`) wraps common steps to instantiate and run wasm functions and print results. These use platform APIs. this flag to skip the file if your platform lacks those APIs. _Do not enable this flag when building `product-mini`._
 
-### **Enable source debugging features**
-- **WAMR_BUILD_DEBUG_INTERP**=1/0, default to 0 if not set
-> Note: There are some other setup required by source debugging, please refer to [source_debugging.md](./source_debugging.md) and [WAMR source debugging basic](https://bytecodealliance.github.io/wamr.dev/blog/wamr-source-debugging-basic) for more details.
+### **source debugging features**
 
-### **Enable load wasm custom sections**
-- **WAMR_BUILD_LOAD_CUSTOM_SECTION**=1/0, default to disable if not set
+- **WAMR_BUILD_DEBUG_INTERP**=1/0, default to off.
+- **WAMR_BUILD_DEBUG_AOT**=1/0, default to off.
+- **WAMR_BUILD_DYNAMIC_AOT_DEBUG**=1/0, default to off.
 
-> Note: By default, the custom sections are ignored. If the embedder wants to get custom sections from `wasm_module_t`, then `WAMR_BUILD_LOAD_CUSTOM_SECTION` should be enabled, and then `wasm_runtime_get_custom_section` can be used to get a custom section by name.
+> [!NOTE]
+> Source debugging needs extra setup. See [source_debugging.md](./source_debugging.md) and [WAMR source debugging basic](https://bytecodealliance.github.io/wamr.dev/blog/wamr-source-debugging-basic).
 
-> Note: If `WAMR_BUILD_CUSTOM_NAME_SECTION` is enabled, then the `custom name section` will be treated as a special section and consumed by the runtime, not available to the embedder.
+### **load wasm custom sections**
 
-> For AoT file, must use `--emit-custom-sections` to specify which sections need to be emitted into AoT file, otherwise all custom sections will be ignored.
+- **WAMR_BUILD_LOAD_CUSTOM_SECTION**=1/0, default to off.
+
+> [!NOTE]
+> By default, custom sections are ignored. `WAMR_BUILD_LOAD_CUSTOM_SECTION` so the embedder can read them via `wasm_runtime_get_custom_section`. If `WAMR_BUILD_CUSTOM_NAME_SECTION` is on, the custom name section is consumed by the runtime and unavailable to the embedder. For AoT files, pass `--emit-custom-sections` to wamrc to keep the sections; otherwise they are dropped.
 
 ### **Stack guard size**
-- **WAMR_BUILD_STACK_GUARD_SIZE**=n, default to N/A if not set.
-> Note: By default, the stack guard size is 1K (1024) or 24K (if uvwasi enabled).
+
+- **WAMR_BUILD_STACK_GUARD_SIZE**=n, default to N/A when not set.
+
+> [!NOTE]
+> By default, stack guard size is 1K (1024) or 24K when uvwasi is enabled.
 
 ### **Disable writing the linear memory base address to x86 GS segment register**
-- **WAMR_DISABLE_WRITE_GS_BASE**=1/0, default to enable if not set and supported by platform
-> Note: by default only platform [linux x86-64](https://github.com/bytecodealliance/wasm-micro-runtime/blob/5fb5119239220b0803e7045ca49b0a29fe65e70e/core/shared/platform/linux/platform_internal.h#L67) will enable this feature, for 32-bit platforms it's automatically disabled even when the flag is set to 0. In linux x86-64, writing the linear memory base address to x86 GS segment register may be used to speedup the linear memory access for LLVM AOT/JIT, when `--enable-segue=[<flags>]` option is added for `wamrc` or `iwasm`.
 
-> See [Enable segue optimization for wamrc when generating the aot file](./perf_tune.md#3-enable-segue-optimization-for-wamrc-when-generating-the-aot-file) for more details.
+- **WAMR_DISABLE_WRITE_GS_BASE**=1/0, default to on if the platform supports it.
+
+> [!NOTE]
+> By default only [linux x86-64](https://github.com/bytecodealliance/wasm-micro-runtime/blob/5fb5119239220b0803e7045ca49b0a29fe65e70e/core/shared/platform/linux/platform_internal.h#L67) enables this. On 32-bit platforms it stays off even if set to 0. On linux x86-64, writing the linear memory base to the GS segment can speed up linear memory access for LLVM AOT/JIT when `--enable-segue=[<flags>]` is passed to `wamrc` or `iwasm`.
+>
+> See [segue optimization for wamrc when generating the aot file](./perf_tune.md#3-enable-segue-optimization-for-wamrc-when-generating-the-aot-file) for details.
 
 ### **User defined linear memory allocator**
-- **WAMR_BUILD_ALLOC_WITH_USAGE**=1/0, default to disable if not set
-> Notes: by default, the linear memory is allocated by system. when it's set to 1 and Alloc_With_Allocator is selected, it will be allocated by customer.
 
-### **Enable running PGO(Profile-Guided Optimization) instrumented AOT file**
-- **WAMR_BUILD_STATIC_PGO**=1/0, default to disable if not set
-> Note: See [Use the AOT static PGO method](./perf_tune.md#5-use-the-aot-static-pgo-method) for more details.
+- **WAMR_BUILD_ALLOC_WITH_USAGE**=1/0, default to off.
+- **WAMR_BUILD_ALLOC_WITH_USER_DATA**=1/0, default to off.
+
+> [!NOTE]
+> By default, the system allocates linear memory. With this on and `Alloc_With_Allocator` selected, you can provide your own allocator.
+
+### **running PGO(Profile-Guided Optimization) instrumented AOT file**
+
+- **WAMR_BUILD_STATIC_PGO**=1/0, default to off.
+
+> [!NOTE]
+> See [Use the AOT static PGO method](./perf_tune.md#5-use-the-aot-static-pgo-method).
 
-### **Enable linux perf support**
-- **WAMR_BUILD_LINUX_PERF**=1/0, enable linux perf support to generate the flamegraph to analyze the performance of a wasm application, default to disable if not set
-> Note: See [Use linux-perf](./perf_tune.md#7-use-linux-perf) for more details.
+### **linux perf support**
+
+- **WAMR_BUILD_LINUX_PERF**=1/0: enable linux perf support to generate flamegraphs for wasm app performance. Default is off.
+
+> [!NOTE]
+> See [Use linux-perf](./perf_tune.md#7-use-linux-perf).
+
+### **module instance context APIs**
+
+- **WAMR_BUILD_MODULE_INST_CONTEXT**=1/0: enable module instance context APIs so the embedder can set one or more contexts for a wasm module instance. Default is on.
 
-### **Enable module instance context APIs**
-- **WAMR_BUILD_MODULE_INST_CONTEXT**=1/0, enable module instance context APIs which can set one or more contexts created by the embedder for a wasm module instance, default to enable if not set:
 ```C
     wasm_runtime_create_context_key
     wasm_runtime_destroy_context_key
@@ -285,95 +516,187 @@ Currently we only profile the memory consumption of module, module_instance and
     wasm_runtime_set_context_spread
     wasm_runtime_get_context
 ```
-> Note: See [wasm_export.h](../core/iwasm/include/wasm_export.h) for more details.
 
-### **Enable quick AOT/JTI entries**
-- **WAMR_BUILD_QUICK_AOT_ENTRY**=1/0, enable registering quick call entries to speedup the aot/jit func call process, default to enable if not set
-> Note: See [Refine callings to AOT/JIT functions from host native](./perf_tune.md#83-refine-callings-to-aotjit-functions-from-host-native) for more details.
+> [!NOTE]
+> See [wasm_export.h](../core/iwasm/include/wasm_export.h) for details.
+
+### **quick AOT/JTI entries**
+
+- **WAMR_BUILD_QUICK_AOT_ENTRY**=1/0: register quick call entries to speed up AOT/JIT function calls. Default is on.
+
+> [!NOTE]
+> See [Refine callings to AOT/JIT functions from host native](./perf_tune.md#83-refine-callings-to-aotjit-functions-from-host-native).
+
+### **AOT intrinsics**
+
+- **WAMR_BUILD_AOT_INTRINSICS**=1/0: turn on AOT intrinsic functions. Default is on. AOT code can call these when wamrc uses `--disable-llvm-intrinsics` or `--enable-builtin-intrinsics=<intr1,intr2,...>`.
+
+> [!NOTE]
+> See [Tuning the XIP intrinsic functions](./xip.md#tuning-the-xip-intrinsic-functions).
 
-### **Enable AOT intrinsics**
-- **WAMR_BUILD_AOT_INTRINSICS**=1/0, enable the AOT intrinsic functions, default to enable if not set. These functions can be called from the AOT code when `--disable-llvm-intrinsics` flag or `--enable-builtin-intrinsics=<intr1,intr2,...>` flag is used by wamrc to generate the AOT file.
-> Note: See [Tuning the XIP intrinsic functions](./xip.md#tuning-the-xip-intrinsic-functions) for more details.
+### **extended constant expression**
 
-### **Enable extended constant expression**
-- **WAMR_BUILD_EXTENDED_CONST_EXPR**=1/0, default to disable if not set.
-> Note: See [Extended Constant Expressions](https://github.com/WebAssembly/extended-const/blob/main/proposals/extended-const/Overview.md) for more details.
+- **WAMR_BUILD_EXTENDED_CONST_EXPR**=1/0, default to off.
 
-### **Enable bulk-memory-opt**
-- **WAMR_BUILD_BULK_MEMORY_OPT**=1/0, default to disable if not set.
-> Note: See [bulk-memory-opt](https://github.com/WebAssembly/tool-conventions/blob/main/Lime.md#bulk-memory-opt) for more details.
+> [!NOTE]
+> See [Extended Constant Expressions](https://github.com/WebAssembly/extended-const/blob/main/proposals/extended-const/Overview.md).
 
-### **Enable call-indirect-overlong**
-- **WAMR_BUILD_CALL_INDIRECT_OVERLONG**=1/0, default to disable if not set.
-> Note: See [call-indirect-overlong](https://github.com/WebAssembly/tool-conventions/blob/main/Lime.md#call-indirect-overlong) for more details.
+### **bulk-memory-opt**
 
-### **Enable Lime1 target**
-- **WAMR_BUILD_LIME1**=1/0, default to disable if not set.
-> Note: See [Lime1](https://github.com/WebAssembly/tool-conventions/blob/main/Lime.md#lime1) for more details.
+- **WAMR_BUILD_BULK_MEMORY_OPT**=1/0, default to off.
+
+> [!NOTE]
+> See [bulk-memory-opt](https://github.com/WebAssembly/tool-conventions/blob/main/Lime.md#bulk-memory-opt).
+
+### **call-indirect-overlong**
+
+- **WAMR_BUILD_CALL_INDIRECT_OVERLONG**=1/0, default to off.
+
+> [!NOTE]
+> See [call-indirect-overlong](https://github.com/WebAssembly/tool-conventions/blob/main/Lime.md#call-indirect-overlong).
+
+### **Lime1 target**
+
+- **WAMR_BUILD_LIME1**=1/0, default to off.
+
+> [!NOTE]
+> See [Lime1](https://github.com/WebAssembly/tool-conventions/blob/main/Lime.md#lime1).
 
 ### **Configurable memory access boundary check**
-- **WAMR_CONFIGURABLE_BOUNDS_CHECKS**=1/0, default to disable if not set
-> Note: If it is enabled, allow to run `iwasm --disable-bounds-checks` to disable the memory access boundary checks for interpreter mode.
 
-### **Module instance context APIs**
-- **WAMR_BUILD_MODULE_INST_CONTEXT**=1/0, default to disable if not set
-> Note: If it is enabled, allow to set one or more contexts created by embedder for a module instance, the below APIs are provided:
-```C
-    wasm_runtime_create_context_key
-    wasm_runtime_destroy_context_key
-    wasm_runtime_set_context
-    wasm_runtime_set_context_spread
-    wasm_runtime_get_context
-```
+- **WAMR_CONFIGURABLE_BOUNDS_CHECKS**=1/0, default to off.
+
+> [!WARNING]
+> When enabled, you can run `iwasm --disable-bounds-checks` to turn off memory access boundary checks in interpreter mode. This is a [privileged feature](#privileged-features); use it carefully.
 
 ### **Shared heap among wasm apps and host native**
-- **WAMR_BUILD_SHARED_HEAP**=1/0, default to disable if not set
-> Note: If it is enabled, allow to create one or more shared heaps, and attach one to a module instance, the belows APIs ared provided:
-```C
-   wasm_runtime_create_shared_heap
-   wasm_runtime_attach_shared_heap
-   wasm_runtime_detach_shared_heap
-   wasm_runtime_shared_heap_malloc
-   wasm_runtime_shared_heap_free
-```
-And the wasm app can calls below APIs to allocate/free memory from/to the shared heap if it is attached to the app's module instance:
-```C
-   void *shared_heap_malloc();
-   void shared_heap_free(void *ptr);
-```
+
+- **WAMR_BUILD_SHARED_HEAP**=1/0, default to off.
+
+> [!NOTE]
+> When enabled, you can create and attach shared heaps, and the following APIs become available:
+>
+> ```C
+>    wasm_runtime_create_shared_heap
+>    wasm_runtime_attach_shared_heap
+>    wasm_runtime_detach_shared_heap
+>    wasm_runtime_shared_heap_malloc
+>    wasm_runtime_shared_heap_free
+> ```
+>
+> A wasm app can call these to use the shared heap attached to its module instance:
+>
+> ```C
+>    void *shared_heap_malloc();
+>    void shared_heap_free(void *ptr);
+> ```
+
+> [!WARNING]
+> The shared-heap feature is not supported in fast-jit mode.
 
 ### **Shrunk the memory usage**
-- **WAMR_BUILD_SHRUNK_MEMORY**=1/0, default to enable if not set
-> Note: When enabled, this feature will reduce memory usage by decreasing the size of the linear memory, particularly when the `memory.grow` opcode is not used and memory usage is somewhat predictable.
 
-## **Instruction metering**
-- **WAMR_BUILD_INSTRUCTION_METERING**=1/0, default to disable if not set
-> Note: Enabling this feature allows limiting the number of instructions a wasm module instance can execute. Use the `wasm_runtime_set_instruction_count_limit(...)` API before calling `wasm_runtime_call_*(...)` APIs to enforce this limit.
+- **WAMR_BUILD_SHRUNK_MEMORY**=1/0, default to on.
 
-## **Combination of configurations:**
+> [!NOTE]
+> When enabled, this reduces memory by shrinking linear memory, especially when `memory.grow` is unused and memory needs are predictable.
 
-We can combine the configurations. For example, if we want to disable interpreter, enable AOT and WASI, we can run command:
+### **Instruction metering**
 
-``` Bash
+- **WAMR_BUILD_INSTRUCTION_METERING**=1/0, default to off.
+
+> [!NOTE]
+> This limits the number of instructions a wasm module instance can run. Call `wasm_runtime_set_instruction_count_limit(...)` before `wasm_runtime_call_*(...)` to enforce the cap.
+
+> [!WARNING]
+> This is only supported in classic interpreter mode.
+
+### **Invoke general FFI**
+
+- **WAMR_BUILD_INVOKE_NATIVE_GENERAL**=1/0, default to off.
+
+By default, WAMR uses architecture-specific calling conventions to call native functions from WASM modules. When this feature is enabled, WAMR uses a general calling convention that works on all architectures but is slower. The details are in [iwasm_common.cmake](../core/iwasm/common/iwasm_common.cmake)
+
+### **Host defined log**
+
+- **WAMR_BH_LOG**=<log_callback>, default to off.
+
+### **AOT Validator**
+
+- **WAMR_BUILD_AOT_VALIDATOR**=1/0, default to off.
+
+> [!NOTE]
+> By default, WAMR believes AOT files are valid and unforged.
+
+### **Copy Call Stack**
+
+- **WAMR_BUILD_COPY_CALL_STACK**=1/0, default to off.
+
+> [!NOTE]
+> Unlike [dump call stack](dump-call-stack-feature), which prints the call stack on exceptions, this feature lets the embedder copy the call stack programmatically via `wasm_runtime_dump_call_stack_to_buf()`.
+
+### **Librats**
+
+- **WAMR_BUILD_LIB_RATS**=1/0, default to off.
+
+> [librats](https://github.com/inclavare-containers/librats) is a C library designed to facilitate remote attestation for secure computing environments. It provides a framework for attesting the integrity of computing environments remotely, enabling trust establishment between different Trusted Execution Environments (TEEs).
+
+> [!WARNING]
+> This is for Intel SGX platforms only.
+
+### **Sanitizer**
+
+- **WAMR_BUILD_SANITIZER**=[ubsan|asan|tsan|posan], default is empty
+
+Use one or more of the following sanitizers when building WAMR with sanitizer support: AddressSanitizer, UndefinedBehaviorSanitizer, ThreadSanitizer, or Pointer-Overflow Sanitizer.
+
+### **Intel Protected File System**
+
+- **WAMR_BUILD_SGX_IPFS**=1/0, default to off.
+
+> [!WARNING]
+> This is for Intel SGX platforms only.
+
+### **Support spec test**
+
+- **WAMR_BUILD_SPEC_TEST**=1/0, default to off.
+
+### **WASM Cache**
+
+- **WAMR_BUILD_WASM_CACHE**=1/0, default to off.
+
+### **Test Garbage Collection**
+
+- **WAMR_TEST_GC**=1/0, default to off.
+
+It is used to test garbage collection related APIs and features. Refer to [iwasm_gc.cmake](../core/iwasm/common/gc/iwasm_gc.cmake) for details.
+
+It is used to cache loaded wasm modules in memory to speed up module instantiation only in wasm-c-api.
+
+## **Combination of configurations**
+
+You can mix settings. For example, to disable the interpreter, enable AOT and WASI, run:
+
+```Bash
 cmake .. -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_LIBC_WASI=1 -DWAMR_BUILD_PLATFORM=linux
 ```
 
-Or if we want to enable interpreter, disable AOT and WASI, and build as X86_32, we can run command:
+To enable the interpreter, disable AOT and WASI, and target X86_32, run:
 
-``` Bash
+```Bash
 cmake .. -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_LIBC_WASI=0 -DWAMR_BUILD_TARGET=X86_32
 ```
 
-When enabling SIMD for fast interpreter mode, you'll need to enable both SIMD and the SIMDe library:
+When enabling SIMD for fast interpreter mode, turn on both SIMD and the SIMDe library:
 
-``` Bash
+```Bash
 
 cmake .. -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_SIMD=1 -DWAMR_BUILD_LIB_SIMDE=1
 ```
 
-For Valgrind, begin with the following configurations and add additional ones as needed:
+For Valgrind, start with these and add more as needed:
 
-``` Bash
+```Bash
   #...
   -DCMAKE_BUILD_TYPE=Debug \
   -DWAMR_DISABLE_HW_BOUND_CHECK=0 \
@@ -381,8 +704,7 @@ For Valgrind, begin with the following configurations and add additional ones as
   #...
 ```
 
-To enable the minimal Lime1 feature set, we need to disable some features that are on by default, such as 
-bulk memory and reference types:
+To enable the minimal Lime1 feature set, turn off features that are on by default such as bulk memory and reference types:
 
 ```Bash
 cmake .. -DWAMR_BUILD_LIME1=1 -DWAMR_BUILD_BULK_MEMORY=0 -DWAMR_BUILD_REF_TYPES=0 -DDWAMR_BUILD_SIMD=0

+ 38 - 0
doc/shared_heap.md

@@ -0,0 +1,38 @@
+# Introducing the Shared-Heap Feature in WAMR
+
+In the world of WebAssembly, flexibility and performance are key. The WebAssembly Micro Runtime (WAMR) has introduced a powerful feature known as the shared heap, designed to enhance performance by allowing data sharing between multiple WebAssembly (WASM) instances, or between WASM and its host, without incurring the overhead of data copying. Let's delve into what this feature offers and how it can be effectively utilized.
+
+## What is the Shared Heap?
+
+The shared heap is an innovative extension of the WebAssembly linear memory. Unlike traditional memory, which requires data copying between WASM instances or to the host, the shared heap allows direct access to the same memory space. This can significantly improve performance in scenarios where multiple WASM instances need to interact or share data with the host.
+
+## Key Benefits
+
+- Expanded Memory Space: The shared-heap feature effectively expands the linear memory space by introducing hosted memory address spaces. This new linear memory space can be seen as a virtual space, encompassing multiple real spaces.
+- Toolchain Workaround: The shared heap acts as a workaround for the current lack of toolchain support for the multi-memory proposal. This provides a practical solution for developers needing enhanced memory capabilities.
+- Boundary Checks and Sandbox Protection: The shared heap maintains boundary checks and extends sandbox protection to portions of the real memory space, ensuring secure and reliable memory access across shared heaps.
+- Ongoing Evaluation: The shared-heap feature is still under evaluation, and the team is actively seeking better solutions to further improve the functionality and performance.
+
+## How Does It Work?
+
+While the concept of a shared heap might seem straightforward, implementing it correctly requires careful attention. It is a runtime feature, not part of the standard WebAssembly specification, nor an ongoing proposal. Here’s how you can leverage the shared heap in your applications:
+
+### Creating a Shared Heap
+
+1. WAMR Managed Shared Heap: Use the `wasm_runtime_create_shared_heap(SharedHeapInitArgs \*init_args)` API to create a shared heap. If only `init_args.size` is specified with `init_args.pre_allocated_addr` set to NULL, WAMR will allocate and manage the shared heap. This allows dynamic memory management through `wasm_runtime_shared_heap_malloc()` and `wasm_runtime_shared_heap_free()`. Memory allocation from this heap is valid and can be shared, with automatic cleanup when the runtime is destroyed.
+
+2. Preallocated Shared Heap: Alternatively, you can use pre-allocated memory, either from the system heap or a static global buffer. This requires you to handle its accessibility, size, and management. Specify `init_args.pre_allocated_addr` along with `init_args.size` to create this type of shared heap, which acts as a single large chunk for direct data sharing.
+
+### Creating and Attaching Shared Heap Chains
+
+To form a unified memory space, you can chain multiple shared heaps using the `wasm_runtime_chain_shared_heaps(wasm_shared_heap_t head, wasm_shared_heap_t body)` API. This creates a continuous memory region from the perspective of the WASM app, even though it might consist of separate regions in the native environment.
+
+Once chained, attach the shared heap to WASM apps using `wasm_runtime_attach_shared_heaps(wasm_module_inst_t module_inst, wasm_shared_heap_t shared_heaps)`. This ensures no overlap with the existing linear memory of the WASM app instance, preventing accidental overwrites.
+
+### Resource Allocation and Data Transfer
+
+After attaching the shared heap, both host and WASM code can allocate resources directly from it. Host code can use `wasm_runtime_shared_heap_malloc()`, while WASM code can utilize `shared_heap_malloc()`. This allows one side to allocate memory and pass the address or index to the other side, facilitating efficient data transfer. The original boundary checks for loading and storing in linear memory naturally extend to the shared-heap area, as it is part of the linear memory. This integration ensures that memory operations remain secure and consistent.
+
+## Conclusion
+
+The shared heap feature is an exciting advancement in WASM performance optimization. By enabling direct memory sharing, it reduces overhead and boosts efficiency in applications requiring high interactivity. While it offers great benefits, remember it heavily relies on correct implementation to manage shared data effectively. As the feature is still under evaluation, let's work together on a better solution. We are collecting every potential usage and unique feature, looking for the shared common ground that will drive future innovations in WebAssembly applications.

+ 1 - 1
doc/stability_wasm_proposals.md

@@ -2,7 +2,7 @@
 
 This document is intended to describe the current status of WebAssembly proposals and WASI proposals in WAMR.
 
-Only track proposals that are followed in the [WebAssembly proposals](https://github.com/WebAssembly/proposals) and [WASI proposals](https://github.com/WebAssembly/WASI/blob/main/Proposals.md).
+Only track proposals that are followed in the [WebAssembly proposals](https://github.com/WebAssembly/proposals) and [WASI proposals](https://github.com/WebAssembly/WASI/blob/main/docs/Proposals.md).
 
 Normally, the document tracks proposals that are in phase 4. However, if a proposal in an earlier phase receives support, it will be added to the list below.
 

+ 183 - 196
doc/tiered_support.md

@@ -1,196 +1,183 @@
-# Tiered Supported
-
-**Tier definitions**
-
-- **A — Production Ready:** fully tested and stable.
-- **B — Almost Production Ready:** partially tested; close to production.
-- **C — Experimental / Not Production Ready:** unfinished or volatile.
-
-The condition _tested_ mentioned above specifically refers to whether there are enough tests in CI.
-
-## Architecture Support
-
-| Architecture | Tier  |
-| ------------ | ----- |
-| **x86-64**   | **A** |
-| **x86-32**   | **A** |
-| AArch64      | B     |
-| ARC          | B     |
-| ARM          | B     |
-| RISCV32      | B     |
-| RISCV64      | B     |
-| THUMB        | B     |
-| XTENSA       | B     |
-| MIPS         | C     |
-
-## OS / Platform Support
-
-| Platform           | Tier  |
-| ------------------ | ----- |
-| **NuttX**          | **A** |
-| **Ubuntu**         | **A** |
-| Android            | B     |
-| macOS              | B     |
-| Windows            | B     |
-| Zephyr             | B     |
-| AliOS-Things       | C     |
-| Cosmopolitan       | C     |
-| ESP-IDF (FreeRTOS) | C     |
-| FreeBSD            | C     |
-| iOS                | C     |
-| RT-Thread          | C     |
-| RIOT               | C     |
-| VxWorks            | C     |
-
-## WebAssembly Proposal Support
-
-> During configuration, It is able to disable or enable the following features by setting the corresponding flags (see Appendix). It is also possible to check features status in the configuration output.
-
-| WASM Proposal / Extension              | Tier        |
-| -------------------------------------- | ----------- |
-| **Bulk Memory**                        | A           |
-| **Extended Constant Expressions**      | A           |
-| **Import/Export of Mutable Globals**   | A           |
-| **Memory64**                           | A           |
-| **Multi-value**                        | A           |
-| **Non-trapping float-to-int**          | A           |
-| **Reference Types**                    | A           |
-| **Shared Memory (Threads)**            | A           |
-| **SIMD (128-bit)**                     | A           |
-| **Sign-extension Operators**           | A           |
-| GC (Garbage Collection)                | B           |
-| Stringref                              | B           |
-| Tail Calls                             | B           |
-| Multi-memory                           | C           |
-| Legacy Exception Handling              | C           |
-| Branch Hinting                         | Unsupported |
-| Custom Annotation Syntax (text format) | Unsupported |
-| Exception Handling (new spec)          | Unsupported |
-| JS String Builtins                     | Unsupported |
-| Relaxed SIMD                           | Unsupported |
-
-# WAMR-Specific Feature Support
-
-> During configuration, It is able to disable or enable the following features by setting the corresponding flags (see Appendix). It is also possible to check features status in the configuration output.
-
-| WAMR Feature                      | Tier |
-| --------------------------------- | ---- |
-| **AoT (wamrc)**                   | A    |
-| **AOT intrinsics**                | A    |
-| **Fast Interpreter**              | A    |
-| **Interpreter (classic)**         | A    |
-| **Libc builtin**                  | A    |
-| **Libc WASI**                     | A    |
-| **Quick AOT/JIT entries**         | A    |
-| **Shrunk memory**                 | A    |
-| **Wakeup of blocking operations** | A    |
-| **WASM C API**                    | A    |
-| Fast JIT                          | B    |
-| LLVM ORC JIT                      | B    |
-| Memory profiling                  | B    |
-| Module instance context[^7]       | B    |
-| Multi-module                      | B    |
-| Perf profiling                    | B    |
-| Pthread                           | B    |
-| Shared heap                       | B    |
-| WASI threads                      | B    |
-| WASI-NN (neural network APIs)     | B    |
-| Debug Interpreter                 | B    |
-| Debug AOT                         | C    |
-| Tier-up (Fast JIT → LLVM JIT)     | C    |
-
----
-
-# Appendix: All compilation flags
-
-| Compilation flags                           | Tiered | Default | on Ubuntu |
-| ------------------------------------------- | ------ | ------- | --------- |
-| WAMR_APP_THREAD_STACK_SIZE_MAX              | B      | ND[^1]  |           |
-| WAMR_BH_LOG                                 | B      | ND      |           |
-| WAMR_BH_VPRINTF                             | B      | ND      |           |
-| WAMR_BUILD_ALLOC_WITH_USAGE                 | B      | ND      |           |
-| WAMR_BUILD_ALLOC_WITH_USER_DATA             | B      | ND      |           |
-| WAMR_BUILD_AOT                              | A      | ND      | 1         |
-| WAMR_BUILD_AOT_INTRINSICS                   | A      | 1[^2]   |           |
-| WAMR_BUILD_AOT_STACK_FRAME                  | A      | ND      |           |
-| WAMR_BUILD_AOT_VALIDATOR                    | B      | ND      |           |
-| WAMR_BUILD_BULK_MEMORY                      | A      | 1       |           |
-| WAMR_BUILD_COPY_CALL_STACK                  | B      | ND      |           |
-| WAMR_BUILD_CUSTOM_NAME_SECTION              | B      | ND      |           |
-| WAMR_BUILD_DEBUG_AOT                        | C      | ND      |           |
-| WAMR_BUILD_DEBUG_INTERP                     | B      | ND      |           |
-| WAMR_BUILD_DUMP_CALL_STACK                  | B      | ND      |           |
-| WAMR_BUILD_DYNAMIC_AOT_DEBUG                | C      | ND      |           |
-| WAMR_BUILD_EXCE_HANDLING                    | C      | 0       |           |
-| WAMR_BUILD_EXTENDED_CONST_EXPR              | A      | 0       |           |
-| WAMR_BUILD_FAST_INTERP                      | A      | ND      | 1         |
-| WAMR_BUILD_FAST_JIT                         | B      | ND      |           |
-| WAMR_BUILD_FAST_JIT_DUMP                    | B      | ND      |           |
-| WAMR_BUILD_GC                               | B      | 0       |           |
-| WAMR_BUILD_GC_HEAP_VERIFY                   | B      | ND      |           |
-| WAMR_BUILD_GLOBAL_HEAP_POOL                 | A      | ND      |           |
-| WAMR_BUILD_GLOBAL_HEAP_SIZE                 | A      | ND      |           |
-| WAMR_BUILD_INSTRUCTION_METERING             | C      | ND      |           |
-| WAMR_BUILD_INTERP                           | A      | ND      | 1         |
-| WAMR_BUILD_INVOKE_NATIVE_GENERAL            | B      | ND      |           |
-| WAMR_BUILD_JIT                              | B      | ND      |           |
-| WAMR_BUILD_LAZY_JIT                         | B      | 1[^3]   |           |
-| WAMR_BUILD_LIBC_BUILTIN                     | A      | ND      | 1         |
-| WAMR_BUILD_LIBC_EMCC                        | C      | ND      |           |
-| WAMR_BUILD_LIBC_UVWASI                      | C      | ND      |           |
-| WAMR_BUILD_LIBC_WASI                        | A      | ND      | 1         |
-| WAMR_BUILD_LIB_PTHREAD                      | B      | ND      |           |
-| WAMR_BUILD_LIB_PTHREAD_SEMAPHORE            | B      | ND      |           |
-| WAMR_BUILD_LIB_RATS                         | C      | ND      |           |
-| WAMR_BUILD_LIB_WASI_THREADS                 | B      | ND      |           |
-| WAMR_BUILD_LINUX_PERF                       | B      | ND      |           |
-| WAMR_BUILD_LIME1                            | A      | NO      |           |
-| WAMR_BUILD_LOAD_CUSTOM_SECTION              | A      | ND      |           |
-| WAMR_BUILD_MEMORY64                         | A      | 0       |           |
-| WAMR_BUILD_MEMORY_PROFILING                 | B      | ND      |           |
-| WAMR_BUILD_MINI_LOADER                      | B      | ND      |           |
-| WAMR_BUILD_MODULE_INST_CONTEXT              | B      | ND      | 1         |
-| WAMR_BUILD_MULTI_MEMORY                     | C      | 0       |           |
-| WAMR_BUILD_MULTI_MODULE                     | B      | ND      |           |
-| WAMR_BUILD_PERF_PROFILING                   | B      | ND      |           |
-| WAMR_BUILD_PLATFORM                         | -      | ND      | linux     |
-| WAMR_BUILD_QUICK_AOT_ENTRY                  | A      | 1[^4]   |           |
-| WAMR_BUILD_REF_TYPES                        | A      | ND      | 1         |
-| WAMR_BUILD_SANITIZER                        | B      | ND      |           |
-| WAMR_BUILD_SGX_IPFS                         | C      | ND      |           |
-| WAMR_BUILD_SHARED_HEAP                      | A      | ND      |           |
-| WAMR_BUILD_SHARED_MEMORY                    | A      | 0       | 1         |
-| WAMR_BUILD_SHRUNK_MEMORY                    | A      | ND      | 1         |
-| WAMR_BUILD_SIMD                             | A      | ND      | 1         |
-| WAMR_BUILD_SIMDE                            | A      | ND      | 1         |
-| WAMR_BUILD_SPEC_TEST                        | A      | ND      |           |
-| WAMR_BUILD_STACK_GUARD_SIZE                 | B      | ND      |           |
-| WAMR_BUILD_STATIC_PGO                       | B      | ND      |           |
-| WAMR_BUILD_STRINGREF                        | B      | 0       |           |
-| WAMR_BUILD_TAIL_CALL                        | A      | 0       | 1         |
-| WAMR_BUILD_TARGET                           | -      | ND      | X86-64    |
-| WAMR_BUILD_THREAD_MGR                       | A      | ND      |           |
-| WAMR_BUILD_WAMR_COMPILER                    | A      | ND      |           |
-| WAMR_BUILD_WASI_EPHEMERAL_NN                | B      | ND      |           |
-| WAMR_BUILD_WASI_NN                          | B      | ND      |           |
-| WAMR_BUILD_WASI_NN_ENABLE_EXTERNAL_DELEGATE | B      | ND      |           |
-| WAMR_BUILD_WASI_NN_ENABLE_GPU               | B      | ND      |           |
-| WAMR_BUILD_WASI_NN_EXTERNAL_DELEGATE_PATH   | B      | ND      |           |
-| WAMR_BUILD_WASI_NN_LLAMACPP                 | B      | ND      |           |
-| WAMR_BUILD_WASI_NN_ONNX                     | B      | ND      |           |
-| WAMR_BUILD_WASI_NN_OPENVINO                 | B      | ND      |           |
-| WAMR_BUILD_WASI_NN_TFLITE                   | B      | ND      |           |
-| WAMR_BUILD_WASI_TEST                        | B      | ND      |           |
-| WAMR_BUILD_WASM_CACHE                       | B      | ND      |           |
-| WAMR_CONFIGURABLE_BOUNDS_CHECKS             | C      | ND      |           |
-| WAMR_DISABLE_APP_ENTRY                      | A      | ND      |           |
-| WAMR_DISABLE_HW_BOUND_CHECK                 | A      | ND      |           |
-| WAMR_DISABLE_STACK_HW_BOUND_CHECK           | A      | ND      |           |
-| WAMR_DISABLE_WAKEUP_BLOCKING_OP             | B      | ND      |           |
-| WAMR_DISABLE_WRITE_GS_BASE                  | B      | ND      |           |
-| WAMR_TEST_GC                                | B      | ND      |           |
-
-[^1]: _ND_ represents _not defined_
-[^2]: active if `WAMR_BUILD_AOT` is 1
-[^3]: active if `WAMR_BUILD_FAST_JIT` or `WAMR_BUILD_JIT1` is 1
-[^4]: active if `WAMR_BUILD_AOT` or `WAMR_BUILD_JIT` is 1
+# Tiered Support
+
+## Tier A
+
+This tier is the highest level of support. Features and targets in this tier are fully supported, actively maintained, and regularly tested. Users can expect prompt assistance and comprehensive documentation for any issues or questions related to these features. Users can rely on Tier A features for production environments. Targets in this tier usually have been used in products.
+
+## Tier B
+
+This tier represents a moderate level of support. Features and targets in this tier are generally supported and maintained, but may not receive the same level of attention as Tier A. While efforts are made to ensure stability, users may encounter occasional issues that are not immediately addressed. Documentation may be less comprehensive compared to Tier A. Users are encouraged to report any issues they encounter, but response times may vary.
+
+## Tier C
+
+This tier indicates experimental features with foundational support levels. These implementations are typically optimized for specific platforms, running modes, or use cases, and may not receive active maintenance. Documentation tends to be minimal or require updates. Production deployment requires specialized expertise and careful evaluation, including establishing appropriate threat models and ensuring comprehensive understanding of the implementation scope. Users should be prepared to troubleshoot issues and handle ongoing maintenance independently, accepting full responsibility for any limitations or challenges that may arise.
+
+> [!NOTE]
+>
+> - **actively maintained** and **fully supported**. users can expect timely assistance, comprehensive documentation, and regular updates for any issues or questions related to these features.
+> - **regularly tested**. means there are automated tests in CI that run on a regular basis to ensure the stability and functionality of these features.
+
+## Labels
+
+**Target** refers to the specific hardware architecture or operating system that the runtime can be compiled for and run on.
+
+**Runtime Extensions** are features that extend the runtime capabilities of the system beyond the core WebAssembly specification. These extensions may include optimizations, additional APIs, or other enhancements that improve performance, usability, or functionality.
+
+**Portability** indicates the ability of the runtime to operate across different platforms or environments without requiring significant modifications. This includes compatibility with various operating systems, hardware architectures, and development frameworks.
+
+# TierA
+
+## Targets
+
+| Description                |
+| -------------------------- |
+| aarch64-unknown-nuttx-eabi |
+| i386-pc-linux-gnu          |
+| x86_64-pc-linux-gnu        |
+| x86_64-apple-darwin        |
+| x86_64-none-linux-gnu      |
+
+## Features
+
+| Description                      | Compilation Flags                                                                                           | Labels             |
+| -------------------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------ |
+| Linux Compatibility              | WAMR_BUILD_PLATFORM=linux                                                                                   | Portability        |
+| AoT runtime                      | [WAMR_BUILD_AOT](./build_wamr.md#configure-aot)                                                             | Running mode       |
+| Fast Interpreter                 | [WAMR_BUILD_FAST_INTERP](./build_wamr.md#configure-interpreters)                                            | Running mode       |
+| Classic Interpreter              | [WAMR_BUILD_INTERP](./build_wamr.md#configure-interpreters)                                                 | Running mode       |
+| AoT compilation (wamrc)          | [WAMR_BUILD_WAMR_COMPILER](./build_wamr.md#configure-aot)                                                   | Compiler           |
+| Bulk Memory                      | [WAMR_BUILD_BULK_MEMORY](./build_wamr.md#bulk-memory-feature)                                               | Wasm Proposal      |
+| Name section                     | [WAMR_BUILD_CUSTOM_NAME_SECTION](./build_wamr.md#name-section)                                              | Wasm Proposal      |
+| Extended Constant Expressions    | [WAMR_BUILD_EXTENDED_CONST_EXPR](./build_wamr.md#extended-constant-expression)                              | Wasm Proposal      |
+| Non-trapping float-to-int        | ALWAYS ON. Can not be disabled                                                                              | Wasm Proposal      |
+| Import/Export of Mutable Globals | ALWAYS ON. Can not be disabled                                                                              | Wasm Proposal      |
+| Multi-value                      | ALWAYS ON. Can not be disabled                                                                              | Wasm Proposal      |
+| WASI LIBC                        | [WAMR_BUILD_LIBC_WASI](./build_wamr.md#configure-libc)                                                      | Wasm Proposal      |
+| WASI threads                     | [WAMR_BUILD_LIB_WASI_THREADS](./build_wamr.md#lib-wasi-threads)                                             | Wasm Proposal      |
+| Custom sections                  | [WAMR_BUILD_LOAD_CUSTOM_SECTION](./build_wamr.md#load-wasm-custom-sections)                                 | Wasm Proposal      |
+| Memory64                         | [WAMR_BUILD_MEMORY64](./build_wamr.md#memory64-feature)                                                     | Wasm Proposal      |
+| Reference Types                  | [WAMR_BUILD_REF_TYPES](./build_wamr.md#reference-types-feature)                                             | Wasm Proposal      |
+| Threads                          | [WAMR_BUILD_SHARED_MEMORY](./build_wamr.md#shared-memory-feature)                                           | Wasm Proposal      |
+| SIMD (128-bit)                   | [WAMR_BUILD_SIMD](./build_wamr.md#128-bit-simd-feature)                                                     | Wasm Proposal      |
+| AOT intrinsics                   | [WAMR_BUILD_AOT_INTRINSICS](./build_wamr.md#aot-intrinsics)                                                 | Runtime Extensions |
+| AoT stack frame                  | [WAMR_BUILD_AOT_STACK_FRAME](./build_wamr.md#aot-stack-frame-feature)                                       | Runtime Extensions |
+| Global heap pool                 | [WAMR_BUILD_GLOBAL_HEAP_POOL](./build_wamr.md#a-pre-allocation-for-runtime-and-wasm-apps)                   | Runtime Extensions |
+| Global heap size                 | [WAMR_BUILD_GLOBAL_HEAP_SIZE](./build_wamr.md#a-pre-allocation-for-runtime-and-wasm-apps)                   | Runtime Extensions |
+| Libc builtin                     | [WAMR_BUILD_LIBC_BUILTIN](./build_wamr.md#configure-libc)                                                   | Runtime Extensions |
+| Module instance context          | [WAMR_BUILD_MODULE_INST_CONTEXT](./build_wamr.md#module-instance-context-apis)                              | Runtime Extensions |
+| Quick AOT/JIT entries            | [WAMR_BUILD_QUICK_AOT_ENTRY](./build_wamr.md#configure-aot)                                                 | Runtime Extensions |
+| Shrunk memory                    | [WAMR_BUILD_SHRUNK_MEMORY](./build_wamr.md#shrunk-the-memory-usage)                                         | Runtime Extensions |
+| Thread manager                   | [WAMR_BUILD_THREAD_MGR](./build_wamr.md#thread-manager)                                                     | Runtime Extensions |
+| App entry                        | [WAMR_DISABLE_APP_ENTRY](./build_wamr.md#exclude-wamr-application-entry-functions)                          | Runtime Extensions |
+| hardware bound check             | [WAMR_DISABLE_HW_BOUND_CHECK](./build_wamr.md#disable-boundary-check-with-hardware-trap)                    | Runtime Extensions |
+| stack hardware bound check       | [WAMR_DISABLE_STACK_HW_BOUND_CHECK](./build_wamr.md#disable-native-stack-boundary-check-with-hardware-trap) | Runtime Extensions |
+| Wakeup blocking operation        | [WAMR_DISABLE_WAKEUP_BLOCKING_OP](./build_wamr.md#disable-async-wakeup-of-blocking-operation)               | Runtime Extensions |
+
+# TierB
+
+## Targets
+
+| Description            |
+| ---------------------- |
+| arc-unknown-none-elf   |
+| x86_64-pc-windows-msvc |
+| mips-unknown-elf       |
+| mips64-unknown-elf     |
+
+## Features
+
+| Description                        | Compilation Flags                                                                                                       | Labels             |
+| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------ |
+| Darwin Compatibility               | WAMR_BUILD_PLATFORM=darwin                                                                                              | Portability        |
+| ESP-IDF Compatibility              | WAMR_BUILD_PALTFORM=esp-idf                                                                                             | Portability        |
+| Nuttx Compatibility                | WAMR_BUILD_PALTFORM=nuttx                                                                                               | Portability        |
+| SGX Compatibility                  | WAMR_BUILD_PALTFORM=linux-sgx                                                                                           | Portability        |
+| Zephyr Compatibility               | WAMR_BUILD_PALTFORM=zephyr                                                                                              | Portability        |
+| GC (Garbage Collection)            | [WAMR_BUILD_GC](./build_wamr.md#garbage-collection)                                                                     | Wasm Proposal      |
+| Stringref                          | [WAMR_BUILD_STRINGREF](./build_wamr.md#garbage-collection)                                                              | Wasm Proposal      |
+| Tail Calls                         | [WAMR_BUILD_TAIL_CALL](./build_wamr.md#tail-call-feature)                                                               | Wasm Proposal      |
+| LLVM JIT                           | [WAMR_BUILD_JIT](./build_wamr.md#configure-llvm-jit)                                                                    | Running mode       |
+| Per Instance running mode          | ALWAYS ON. Can not be disabled                                                                                          | Runtime Extensions |
+| Maximum stack size for app threads | [WAMR_APP_THREAD_STACK_SIZE_MAX](./build_wamr.md#set-maximum-app-thread-stack-size)                                     | Runtime Extensions |
+| Host defined logging               | [WAMR_BH_LOG](./build_wamr.md#host-defined-log)                                                                         | Runtime Extensions |
+| Host defined vprintf               | [WAMR_BH_vprintf](./build_wamr.md#host-defined-vprintf)                                                                 | Runtime Extensions |
+| Allocation with usage tracking     | [WAMR_BUILD_ALLOC_WITH_USAGE](./build_wamr.md#user-defined-linear-memory-allocator)                                     | Runtime Extensions |
+| Allocation with user data          | [WAMR_BUILD_ALLOC_WITH_USER_DATA](./build_wamr.md#user-defined-linear-memory-allocator)                                 | Runtime Extensions |
+| Bulk-memory-opt                    | [WAMR_BUILD_BULK_MEMORY_OPT](./build_wamr.md#bulk-memory-opt)                                                           | Runtime Extensions |
+| Call-indirect-overlong             | [WAMR_BUILD_CALL_INDIRECT_OVERLONG](./build_wamr.md#call-indirect-overlong)                                             | Runtime Extensions |
+| Copy Call Stack                    | [WAMR_BUILD_COPY_CALL_STACK](./build_wamr.md#copy-call-stack)                                                           | Runtime Extensions |
+| Debug Interpreter                  | [WAMR_BUILD_DEBUG_INTERP](./build_wamr.md#configure-debug)                                                              | Runtime Extensions |
+| Dump call stack                    | [WAMR_BUILD_DUMP_CALL_STACK](./build_wamr.md#dump-call-stack-feature)                                                   | Runtime Extensions |
+| Garbage Collection Heap Verify     | [WAMR_BUILD_GC_HEAP_VERIFY](./build_wamr.md#garbage-collection)                                                         | Runtime Extensions |
+| Native General Invocation          | [WAMR_BUILD_INVOKE_NATIVE_GENERAL](./build_wamr.md#invoke-general-ffi)                                                  | Runtime Extensions |
+| Lazy JIT Compilation               | [WAMR_BUILD_LAZY_JIT](./build_wamr.md#configure-llvm-jit)                                                               | Runtime Extensions |
+| Pthread                            | [WAMR_BUILD_LIB_PTHREAD](./build_wamr.md#lib-pthread)                                                                   | Runtime Extensions |
+| Pthread Semaphore Support          | [WAMR_BUILD_LIB_PTHREAD_SEMAPHORE](./build_wamr.md#lib-pthread-semaphore)                                               | Runtime Extensions |
+| Lime1 runtime                      | [WAMR_BUILD_LIME1](./build_wamr.md#lime1-target)                                                                        | Runtime Extensions |
+| Linux Performance Counters         | [WAMR_BUILD_LINUX_PERF](./build_wamr.md#linux-perf-support)                                                             | Runtime Extensions |
+| Memory profiling                   | [WAMR_BUILD_MEMORY_PROFILING](./build_wamr.md#memory-profiling-experiment)                                              | Runtime Extensions |
+| Multi-module                       | [WAMR_BUILD_MULTI_MODULE](./build_wamr.md#multi-module-feature)                                                         | Runtime Extensions |
+| Perf profiling                     | [WAMR_BUILD_PERF_PROFILING](./build_wamr.md#performance-profiling-experiment)                                           | Runtime Extensions |
+| Shared heap                        | [WAMR_BUILD_SHARED_HEAP](./build_wamr.md#shared-heap-among-wasm-apps-and-host-native)                                   | Runtime Extensions |
+| Stack Guard Size                   | [WAMR_BUILD_STACK_GUARD_SIZE](./build_wamr.md#stack-guard-size)                                                         | Runtime Extensions |
+| WASI Ephemeral NN                  | [WAMR_BUILD_WASI_EPHEMERAL_NN](./build_wamr.md#lib-wasi-nn-with-wasi_ephemeral_nn-module-support)                       | Runtime Extensions |
+| WASI-NN (neural network APIs)      | [WAMR_BUILD_WASI_NN](./build_wamr.md#lib-wasi-nn)                                                                       | Runtime Extensions |
+| External Delegate for WASI NN      | [WAMR_BUILD_WASI_NN_ENABLE_EXTERNAL_DELEGATE](./build_wamr.md#lib-wasi-nn-external-delegate-mode)                       | Runtime Extensions |
+| GPU Support for WASI NN            | [WAMR_BUILD_WASI_NN_ENABLE_GPU](./build_wamr.md#lib-wasi-nn-gpu-mode)                                                   | Runtime Extensions |
+| External Delegate Path for WASI NN | [WAMR_BUILD_WASI_NN_EXTERNAL_DELEGATE_PATH](./build_wamr.md#lib-wasi-nn-external-delegate-mode)                         | Runtime Extensions |
+| LLAMA CPP for WASI NN              | [WAMR_BUILD_WASI_NN_LLAMACPP](./build_wamr.md#lib-wasi-nn)                                                              | Runtime Extensions |
+| ONNX for WASI NN                   | [WAMR_BUILD_WASI_NN_ONNX](./build_wamr.md#lib-wasi-nn)                                                                  | Runtime Extensions |
+| OpenVINO for WASI NN               | [WAMR_BUILD_WASI_NN_OPENVINO](./build_wamr.md#lib-wasi-nn)                                                              | Runtime Extensions |
+| TFLite for WASI NN                 | [WAMR_BUILD_WASI_NN_TFLITE](./build_wamr.md#lib-wasi-nn)                                                                | Runtime Extensions |
+| Configurable bounds checks         | [WAMR_CONFIGURABLE_BOUNDS_CHECKS](./build_wamr.md#configurable-memory-access-boundary-check)                            | Runtime Extensions |
+| Write GS base                      | [WAMR_DISABLE_WRITE_GS_BASE](./build_wamr.md#disable-writing-the-linear-memory-base-address-to-x86-gs-segment-register) | Runtime Extensions |
+
+# TierC
+
+## Targets
+
+| Description            |
+| ---------------------- |
+| aarch64-apple-ios      |
+| arm-none-eabi          |
+| i386-unknown-elf       |
+| i386-wrs-vxworks       |
+| riscv32-esp-elf        |
+| riscv32-unknown-elf    |
+| riscv64-unknown-elf    |
+| x86_64-linux-android   |
+| x86_64-linux-cosmo     |
+| x86_64-unknown-freebsd |
+| x86_64-wrs-vxworks     |
+| xtensa-esp32-elf       |
+
+## Features
+
+| Description               | Compilation Flags                                                                                     | Labels             |
+| ------------------------- | ----------------------------------------------------------------------------------------------------- | ------------------ |
+| AliOS compatibility       | WAMR_BUILD_PLATFORM=alios-things                                                                      | Portability        |
+| Android Compatibility     | WAMR_BUILD_PLATFORM=android                                                                           | Portability        |
+| Cosmo Compatibility       | WAMR_BUILD_PLATFORM=cosmopolitan                                                                      | Portability        |
+| FreeBSD Compatibility     | WAMR_BUILD_PLATFORM=freebsd                                                                           | Portability        |
+| iOS Compatibility         | WAMR_BUILD_PLATFORM=darwin                                                                            | Portability        |
+| RIOT OS Compatibility     | WAMR_BUILD_PLATFORM=riot                                                                              | Portability        |
+| RT-Thread Compatibility   | WAMR_BUILD_PLATFORM=rt-thread                                                                         | Portability        |
+| VxWorks Compatibility     | WAMR_BUILD_PLATFORM=vxworks                                                                           | Portability        |
+| Windows Compatibility     | WAMR_BUILD_PLATFORM=windows                                                                           | Portability        |
+| Legacy Exception Handling | [WAMR_BUILD_EXCE_HANDLING](./build_wamr.md#exception-handling)                                        | Wasm Proposal      |
+| Multi-memory              | [WAMR_BUILD_MULTI_MEMORY](./build_wamr.md#multi-memory)                                               | Wasm Proposal      |
+| Fast JIT                  | [WAMR_BUILD_FAST_JIT](./build_wamr.md#configure-fast-jit)                                             | Running mode       |
+| Multi-tier JIT            | [Combination of flags](./build_wamr.md#configure-multi-tier-jit)                                      | Running mode       |
+| AoT Validator             | [WAMR_BUILD_AOT_VALIDATOR](./build_wamr.md#aot-validator)                                             | Runtime Extensions |
+| Debug AOT                 | [WAMR_BUILD_DEBUG_AOT](./build_wamr.md#configure-debug)                                               | Runtime Extensions |
+| Dynamic AoT debugging     | [WAMR_BUILD_DYNAMIC_AOT_DEBUG](./build_wamr.md#configure-debug)                                       | Runtime Extensions |
+| Fast JIT Dump             | [WAMR_BUILD_FAST_JIT_DUMP](./build_wamr.md#configure-fast-jit)                                        | Runtime Extensions |
+| Instruction Metering      | [WAMR_BUILD_INSTRUCTION_METERING](./build_wamr.md#instruction-metering)                               | Runtime Extensions |
+| Libc EMCC Compatibility   | [WAMR_BUILD_LIBC_EMCC](./build_wamr.md#libc-emcc)                                                     | Runtime Extensions |
+| Libc UVWASI Compatibility | [WAMR_BUILD_LIBC_UVWASI](./build_wamr.md#libc-uvwasi)                                                 | Runtime Extensions |
+| RATS Library              | [WAMR_BUILD_LIB_RATS](./build_wamr.md#librats)                                                        | Runtime Extensions |
+| Mini Loader               | [WAMR_BUILD_MINI_LOADER](./build_wamr.md#wasm-mini-loader)                                            | Runtime Extensions |
+| SGX IPFS Support          | [WAMR_BUILD_SGX_IPFS](./build_wamr.md#intel-protected-file-system)                                    | Runtime Extensions |
+| Static PGO                | [WAMR_BUILD_STATIC_PGO](./build_wamr.md#running-pgoprofile-guided-optimization-instrumented-aot-file) | Runtime Extensions |
+| WASM cache                | [WAMR_BUILD_WASM_CACHE](./build_wamr.md#wasm-cache)                                                   | Runtime Extensions |
+| Test garbage collection   | [WAMR_TEST_GC](./build_wamr.md#test-garbage-collection)                                               | Runtime Extensions |

+ 1 - 1
gitbook/tutorial/README.md

@@ -1,6 +1,6 @@
 # Tutorial
 
-In this chapter, we want to walk you through the basic development knowledge and skills of WARM you may need so that you are ready to write your wasm application with WARM.
+In this chapter, we want to walk you through the basic development knowledge and skills of WAMR you may need so that you are ready to write your wasm application with WAMR.
 
 For starters, you could learn how to compile different running mode of WAMR and their usage in [this section](build-tutorial/README.md).
 

+ 2 - 1
idf_component.yml

@@ -8,10 +8,11 @@ dependencies:
   idf: ">=4.4"
 targets:
   - esp32
+  - esp32s2
   - esp32s3
   - esp32c3
   - esp32c6
   - esp32p4
   - esp32c5
 examples:
-  - path: product-mini/platforms/esp-idf
+  - path: product-mini/platforms/esp-idf

+ 1 - 1
language-bindings/go/build.sh

@@ -21,7 +21,7 @@ cmake ${WAMR_DIR}/product-mini/platforms/${PLATFORM} \
     -DWAMR_BUILD_LIB_PTHREAD=1 -DWAMR_BUILD_DUMP_CALL_STACK=1 \
     -DWAMR_BUILD_MEMORY_PROFILING=1
 make -j ${nproc}
-cp -a libvmlib.a ${WAMR_GO_DIR}/packaged/lib/${PLATFORM}-${ARCH}
+cp -a libiwasm.a ${WAMR_GO_DIR}/packaged/lib/${PLATFORM}-${ARCH}
 
 cd ${WAMR_GO_DIR}
 go test

+ 1 - 1
language-bindings/go/go.mod

@@ -2,4 +2,4 @@ module github.com/bytecodealliance/wasm-micro-runtime/language-bindings/go
 
 go 1.15
 
-require github.com/stretchr/testify v1.7.0
+require github.com/stretchr/testify v1.11.1

+ 12 - 4
language-bindings/go/go.sum

@@ -1,11 +1,19 @@
-github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
-github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
+github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
+github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
+github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
+github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
+github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
+github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

+ 1 - 1
language-bindings/go/wamr/cgo.go

@@ -6,7 +6,7 @@
 package wamr
 
 // #cgo CFLAGS: -I${SRCDIR}/packaged/include
-// #cgo LDFLAGS: -lvmlib -lm
+// #cgo LDFLAGS: -liwasm -lm
 //
 // #cgo linux,amd64 LDFLAGS: -Wl,-rpath,${SRCDIR}/packaged/lib/linux-amd64 -L${SRCDIR}/packaged/lib/linux-amd64
 // #cgo linux,arm64 LDFLAGS: -Wl,-rpath,${SRCDIR}/packaged/lib/linux-aarch64 -L${SRCDIR}/packaged/lib/linux-aarch64

+ 0 - 6
product-mini/platforms/android/CMakeLists.txt

@@ -111,12 +111,6 @@ set_version_info (vmlib)
 
 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -pie -fPIE")
 
-if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
-  if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
-    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
-  endif ()
-endif ()
-
 # The following flags are to enhance security, but it may impact performance,
 # we disable them by default.
 #if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")

+ 13 - 11
product-mini/platforms/common/libc_wasi.c

@@ -162,16 +162,18 @@ libc_wasi_parse(char *arg, libc_wasi_parse_context_t *ctx)
     return LIBC_WASI_PARSE_RESULT_OK;
 }
 
-void
-libc_wasi_init(wasm_module_t wasm_module, int argc, char **argv,
-               libc_wasi_parse_context_t *ctx)
+static void
+libc_wasi_set_init_args(struct InstantiationArgs2 *args, int argc, char **argv,
+                        libc_wasi_parse_context_t *ctx)
 {
-    wasm_runtime_set_wasi_args(wasm_module, ctx->dir_list, ctx->dir_list_size,
-                               ctx->map_dir_list, ctx->map_dir_list_size,
-                               ctx->env_list, ctx->env_list_size, argv, argc);
-
-    wasm_runtime_set_wasi_addr_pool(wasm_module, ctx->addr_pool,
-                                    ctx->addr_pool_size);
-    wasm_runtime_set_wasi_ns_lookup_pool(wasm_module, ctx->ns_lookup_pool,
-                                         ctx->ns_lookup_pool_size);
+    wasm_runtime_instantiation_args_set_wasi_arg(args, argv, argc);
+    wasm_runtime_instantiation_args_set_wasi_env(args, ctx->env_list,
+                                                 ctx->env_list_size);
+    wasm_runtime_instantiation_args_set_wasi_dir(
+        args, ctx->dir_list, ctx->dir_list_size, ctx->map_dir_list,
+        ctx->map_dir_list_size);
+    wasm_runtime_instantiation_args_set_wasi_addr_pool(args, ctx->addr_pool,
+                                                       ctx->addr_pool_size);
+    wasm_runtime_instantiation_args_set_wasi_ns_lookup_pool(
+        args, ctx->ns_lookup_pool, ctx->ns_lookup_pool_size);
 }

+ 0 - 8
product-mini/platforms/cosmopolitan/CMakeLists.txt

@@ -136,14 +136,6 @@ set_version_info (vmlib)
 
 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
 
-if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
-  if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
-    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
-    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mindirect-branch-register")
-    # UNDEFINED BEHAVIOR, refer to https://en.cppreference.com/w/cpp/language/ub
-  endif ()
-endif ()
-
 # The following flags are to enhance security, but it may impact performance,
 # we disable them by default.
 #if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")

+ 0 - 6
product-mini/platforms/ios/CMakeLists.txt

@@ -113,12 +113,6 @@ include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
 
 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -pie -fPIE")
 
-if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
-  if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
-    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
-  endif ()
-endif ()
-
 # The following flags are to enhance security, but it may impact performance,
 # we disable them by default.
 #if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")

+ 1 - 5
product-mini/platforms/linux-sgx/CMakeLists.txt

@@ -16,10 +16,6 @@ if (NOT DEFINED WAMR_BUILD_TARGET)
   if (CMAKE_SIZEOF_VOID_P EQUAL 8)
     # Build as X86_64 by default in 64-bit platform
     set (WAMR_BUILD_TARGET "X86_64")
-    if (NOT DEFINED WAMR_BUILD_SIMD)
-      # Enable SIMD by default in 64-bit platform
-      set (WAMR_BUILD_SIMD 1)
-    endif ()
   elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
     # Build as X86_32 by default in 32-bit platform
     set (WAMR_BUILD_TARGET "X86_32")
@@ -74,7 +70,7 @@ if (NOT DEFINED WAMR_BUILD_FAST_INTERP)
 endif ()
 
 if (NOT DEFINED WAMR_BUILD_MULTI_MODULE)
-  # Enable multiple modules
+  # Disable multiple modules
   set (WAMR_BUILD_MULTI_MODULE 0)
 endif ()
 

Некоторые файлы не были показаны из-за большого количества измененных файлов