Upgrade Native Wasm Support - #50
Open
zhaohai666 wants to merge 1 commit into
Open
Conversation
6 tasks
Signed-off-by: zhaohaihzb <zhaohaihzb@126.com>
zhaohai666
force-pushed
the
feature/wg-go124-native-wasm
branch
from
July 7, 2026 07:34
b539712 to
dd4b3e0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description: Upgrade Native Wasm Support for Go 1.24
Overview
This PR fully upgrades the wasm-go SDK to natively support Go 1.24+ WASI/Wasm compilation (GOOS=wasip1), eliminating the mandatory dependency on TinyGo. A unified ABI adaptation layer is implemented to achieve dual-toolchain compatibility, supporting both traditional TinyGo compilation and official Go native Wasm compilation. This upgrade significantly improves compilation efficiency, enriches standard library compatibility, and lowers the development threshold for Higress Wasm plugins.
Background
The current wasm-go SDK relies entirely on TinyGo for Wasm building, which suffers from slow compilation speed, incomplete Go standard library support, immature debugging tools, and limited third-party ecosystem compatibility. Starting from Go 1.24, the official toolchain provides stable native WASI Wasm compilation capability, which can effectively resolve the above pain points and bring better development experience and runtime stability.
Core Changes
Defined the standard WasmABI interface in internal/abi/abi.go, covering memory management, foreign function calls, memory read/write, allocation and release capabilities
Implemented dual ABI implementations via build tags:
Provided compile-time constant judgment to automatically match the corresponding ABI implementation according to the compilation environment
Reconstructed Makefile to support one-click switching of dual compilation modes:
Test Result
Advantages & Optimization Outlook
Current Improvements
Subsequent Optimization Directions
Risk & Mitigation
Related