Skip to content

Conversation

cosmo0920
Copy link
Contributor

@cosmo0920 cosmo0920 commented Sep 16, 2025


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

  • Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

Summary by CodeRabbit

  • New Features

    • Enabled WebAssembly support on Windows ARM64 builds, including the WASM filter for enhanced extensibility.
    • Added optimized native invocation paths for ARM64 and ARM64 SIMD to improve performance and compatibility on Windows on ARM devices.
  • Chores

    • Updated Windows ARM64 build configuration and tooling to support assembly compilation with MSVC.
    • Adjusted CI workflow to correctly target Windows 64-bit (ARM64) builds with appropriate compile flags.

Copy link

coderabbitai bot commented Sep 16, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Enables Windows ARM64 (AArch64) WAMR/WASM support: updates GitHub Actions to pass WAMR target for Windows Arm64; switches CMake to enable WASM on Windows arm64; adds ARM64 MASM assembly implementations (non-SIMD and SIMD) and configures MSVC/MASM build rules in iwasm_common.cmake.

Changes

Cohort / File(s) Summary
CI: Windows AArch64 target flag
.github/workflows/call-build-windows.yaml
Adds -DWAMR_BUILD_TARGET=AARCH64 to CMake options for Windows 64-bit (Arm64) matrix entry.
CMake: Windows ARM64 WASM enablement
cmake/windows-setup.cmake
Sets FLB_WASM and FLB_FILTER_WASM to Yes for arm64 Windows builds.
WAMR AArch64 MASM sources (non-SIMD + SIMD)
lib/wasm-micro-runtime-WAMR-2.4.1/core/iwasm/common/arch/invokeNative_armarm64.asm, .../arch/invokeNative_armarm64_simd.asm
Adds ARM64 MASM implementations of invokeNative for non-SIMD and SIMD, handling register preload, optional stack arg staging, invocation, and epilogue.
CMake: MASM integration and source switching
lib/wasm-micro-runtime-WAMR-2.4.1/core/iwasm/common/iwasm_common.cmake
Introduces Windows/MSVC AArch64 MASM setup: checks VCToolsInstallDir, sets MASM compiler/commands, switches AArch64 .s to .asm sources on Windows/MSVC, and applies MASM source properties (including SIMD variant).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant GH as GitHub Actions
  participant CMake as CMake (configure)
  participant MSVC as MSVC+MASM
  participant WAMR as WAMR Build

  GH->>CMake: Configure with -DWAMR_BUILD_TARGET=AARCH64 (Windows Arm64)
  CMake->>CMake: Detect Windows + MSVC + AArch64
  alt VCToolsInstallDir present
    CMake->>MSVC: Set ASM_MASM compiler/commands
    CMake->>WAMR: Use armarm64.asm (+_simd.asm) sources
  else Missing tools
    CMake-->>GH: Fatal error (stop)
  end
  MSVC->>WAMR: Compile MASM sources
  WAMR-->>GH: Build artifacts
Loading
sequenceDiagram
  autonumber
  participant VM as WASM VM (WAMR)
  participant IN as invokeNative (ARM64)
  participant FP as Target Func

  VM->>IN: invokeNative(func_ptr, argv, nstacks)
  IN->>IN: Load d0–d7, x0–x7 from argv
  alt nstacks > 0
    IN->>IN: Allocate aligned stack space
    IN->>IN: Copy stack args from argv
  end
  IN->>FP: blr func_ptr
  FP-->>IN: return
  IN-->>VM: return
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

ok-package-test

Suggested reviewers

  • edsiper
  • koleini
  • fujimotos
  • niedbalski
  • patrick-stephens

Poem

I twitched my ears at ARM’s new art,
Stacked some args, then made a start—
MASM whispers, registers dance,
AArch64 gets its chance.
With blr leaps I take the call—
Wasm wakes, and we build it all. 🐇✨

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Title Check ✅ Passed The title accurately summarizes the primary change — enabling WASM for Windows on arm64/AArch64 — which aligns with the modifications to the Windows build matrix, CMake defaults, and added ARM64 assembly and MASM handling. It is concise and focused on the main change rather than listing files or unrelated details. The title does include an extraneous leading '[' and could be slightly rephrased for clarity.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cosmo0920 cosmo0920 changed the title [Canary enabling wasm arm64 windows [Canary] build: wasm: Enabling wasm arm64 windows Sep 16, 2025
@cosmo0920 cosmo0920 marked this pull request as draft September 16, 2025 08:19
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (4)
lib/wasm-micro-runtime-WAMR-2.4.1/core/iwasm/common/iwasm_common.cmake (2)

15-25: Duplicate MASM per-file properties; consolidate to one place.

You set ASM_MASM properties for the same sources both here and again within the AARCH64 branch below. Keep a single definition to avoid drift.

  • Keep the top-level foreach (_WAMR_ARM64_MASM_SOURCES) block and remove the later per-file property blocks in the AARCH64 section.
-        set(_WAMR_ARM64_MASM_SOURCES ${IWASM_COMMON_DIR}/arch/invokeNative_armarm64.asm)
-        set_source_files_properties(${_WAMR_ARM64_MASM_SOURCES}
-          PROPERTIES
-            LANGUAGE ASM_MASM
-            COMPILE_DEFINITIONS ""
-            INCLUDE_DIRECTORIES ""
-            COMPILE_OPTIONS "/nologo"
-        )
+        # (properties already set at top-level for ARM64 MASM sources)
-        set(_WAMR_ARM64_MASM_SOURCES_SIMD ${IWASM_COMMON_DIR}/arch/invokeNative_armarm64_simd.asm)
-        set_source_files_properties(${_WAMR_ARM64_MASM_SOURCES_SIMD}
-          PROPERTIES
-            LANGUAGE ASM_MASM
-            COMPILE_DEFINITIONS ""
-            INCLUDE_DIRECTORIES ""
-            COMPILE_OPTIONS "/nologo"
-        )
+        # (properties already set at top-level for ARM64 MASM sources)

Also applies to: 107-116, 123-132


27-28: Improve failure message for missing VCToolsInstallDir.

Suggest hinting to use the Developer Command Prompt action (already used in CI) and to install “MSVC v143 ARM64 build tools”.

-    message(FATAL_ERROR "VCToolsInstallDir is not defined. Please run from a Developer Command Prompt or specify armasm64.exe manually.")
+    message(FATAL_ERROR "VCToolsInstallDir not set. Run CMake from a Developer Command Prompt (MSVC) and ensure 'MSVC ARM64 build tools' are installed.")
lib/wasm-micro-runtime-WAMR-2.4.1/core/iwasm/common/arch/invokeNative_armarm64.asm (1)

25-42: Stack-args copy loop: OK; minor micro‑nit.

Logic is correct. Micro‑nit: prefer cbz/cbnz for zero checks to shave one instruction, if desired.

-        cmp     x21, #0
-        b.eq    call_func
+        cbz     x21, call_func
lib/wasm-micro-runtime-WAMR-2.4.1/core/iwasm/common/arch/invokeNative_armarm64_simd.asm (1)

35-41: Same cbz/cbnz micro‑nit for the copy loop.

Optional.

-        cmp     x21, #0
-        b.eq    call_func
+        cbz     x21, call_func
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 60db310 and 140d4ab.

📒 Files selected for processing (5)
  • .github/workflows/call-build-windows.yaml (1 hunks)
  • cmake/windows-setup.cmake (2 hunks)
  • lib/wasm-micro-runtime-WAMR-2.4.1/core/iwasm/common/arch/invokeNative_armarm64.asm (1 hunks)
  • lib/wasm-micro-runtime-WAMR-2.4.1/core/iwasm/common/arch/invokeNative_armarm64_simd.asm (1 hunks)
  • lib/wasm-micro-runtime-WAMR-2.4.1/core/iwasm/common/iwasm_common.cmake (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-31T12:46:11.940Z
Learnt from: ThomasDevoogdt
PR: fluent/fluent-bit#9277
File: .github/workflows/pr-compile-check.yaml:147-151
Timestamp: 2025-08-31T12:46:11.940Z
Learning: In fluent-bit CMakeLists.txt, the system library preference flags are defined as FLB_PREFER_SYSTEM_LIB_ZSTD and FLB_PREFER_SYSTEM_LIB_KAFKA with the FLB_ prefix.

Applied to files:

  • cmake/windows-setup.cmake
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (25)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_ARROW=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=Off, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_THREAD=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=Off, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_UNDEFINED=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_THREAD=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_MEMORY=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_ADDRESS=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SMALL=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=Off, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_ADDRESS=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_COVERAGE=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_MEMORY=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_UNDEFINED=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=Off, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SMALL=On, 3.31.6, clang, clang++)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, gcc, g++, ubuntu-24.04, clang-14)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, clang, clang++, ubuntu-24.04, clang-14)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, gcc, g++, ubuntu-22.04, clang-12)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, clang, clang++, ubuntu-22.04, clang-12)
  • GitHub Check: pr-compile-centos-7
🔇 Additional comments (7)
.github/workflows/call-build-windows.yaml (1)

95-95: Good: WAMR AArch64 target wired into the Arm64 Windows matrix.

This matches iwasm_common.cmake’s AARCH64 branch selection and unblocks the MASM-based invokeNative. No issues spotted.

Please confirm the CMake configure log shows:

  • WAMR_BUILD_PLATFORM=windows
  • WAMR_BUILD_TARGET=AARCH64
  • WAMR_BUILD_SIMD as intended (0/1)
cmake/windows-setup.cmake (2)

39-44: Enable FLB_WASM on Windows/arm64: OK.

This aligns Windows arm64 defaults with x64/x86. Keep an eye on package size and CI time impact.


135-140: Enable FLB_FILTER_WASM on Windows/arm64: OK.

Consistent with FLB_WASM above; expect new plugin to build under arm64 toolchain.

Please run a local arm64 Windows build to ensure filter_wasm links successfully with WAMR (static CRT and vcpkg triplet arm64-windows-static).

lib/wasm-micro-runtime-WAMR-2.4.1/core/iwasm/common/iwasm_common.cmake (1)

103-120: Source selection for AARCH64 on Windows/MSVC: looks correct after fix.

Once the compiler path issue is addressed, the conditional picks .asm for non‑SIMD and the SIMD variant when enabled. No other concerns.

Confirm both configurations compile:

  • WAMR_BUILD_SIMD=0 (default)
  • WAMR_BUILD_SIMD=1 (SIMD path)

Also applies to: 121-136

lib/wasm-micro-runtime-WAMR-2.4.1/core/iwasm/common/arch/invokeNative_armarm64.asm (2)

56-67: Argument loading order matches WAMR AArch64 ABI usage.

Loading d0–d7 then x0–x7 from argv is consistent with WAMR’s calling convention expectations.


45-73: ```shell
#!/bin/bash
set -euo pipefail

echo "1) Locate asm file(s) matching invokeNative* (show paths)"
rg -n --hidden --no-ignore "invokeNative[_A-Za-z0-9]*arm" -S || true
echo

ASM="lib/wasm-micro-runtime-WAMR-2.4.1/core/iwasm/common/arch/invokeNative_armarm64.asm"
echo "2) If the expected file exists, print the first 200 lines"
if [ -f "$ASM" ]; then
echo "=== Found: $ASM ==="
sed -n '1,200p' "$ASM"
else
echo "=== $ASM not found at expected path ==="
rg -n --hidden --no-ignore "invokeNative_armarm64.asm|invokeNative_armarm64" -S || true
fi
echo

echo "3) Search the repo for unwind-related assembler directives (.cfi, .seh, fnstart/fnend, .xdata/.pdata)"
rg -n --hidden --no-ignore '.cfi_|.cfi\b|.seh|fnstart|fnend|.xdata|.pdata' -g '**/*.{s,S,asm}' -S || true
echo

echo "4) Show any arm64-targeted assembly files (paths only)"
rg -n --hidden --no-ignore 'aarch64|arm64' -g '**/*.{s,S,asm}' -S || true
echo

echo "5) Search build system / platform macros for Windows/Win32 references"
rg -n --hidden --no-ignore 'CMAKE_SYSTEM_NAME.*Windows|_WIN32\b|WIN32\b|MINGW|MSYS|_MSC_VER|MSVC|Windows' -S || true
echo

echo "6) Search for references to this asm file in build scripts (Makefiles, CMakeLists, etc.)"
rg -n --hidden --no-ignore 'invokeNative_armarm64.asm|invokeNative_armarm64' -S || true
echo

echo "7) Show top-level README/CMake/BUILD snippets (if present) to infer supported platforms"
for f in README.md README.rst CMakeLists.txt BUILD.md configure; do
if [ -f "$f" ]; then
echo "=== $f (first 200 lines) ==="
sed -n '1,200p' "$f"
echo
fi
done


</blockquote></details>
<details>
<summary>lib/wasm-micro-runtime-WAMR-2.4.1/core/iwasm/common/arch/invokeNative_armarm64_simd.asm (1)</summary><blockquote>

`56-61`: **Neon loads: efficient; keep as-is.**

Using ld1 on v0–v7 is compact and correct for the argv layout.

</blockquote></details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant