[type:refactor] replace inactive wasmtime-java with chicory pure-Java WASM runtime#6356
Open
eye-gu wants to merge 6 commits into
Open
[type:refactor] replace inactive wasmtime-java with chicory pure-Java WASM runtime#6356eye-gu wants to merge 6 commits into
eye-gu wants to merge 6 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors ShenYu’s WASM plugin runtime by replacing the inactive, native-dependent wasmtime-java integration with the pure-Java Chicory runtime, and extends the test suite to execute real .wasm artifacts produced by both Rust and TinyGo (Go) to validate the shared-memory ABI end-to-end.
Changes:
- Replace wasmtime-java APIs with Chicory (
ExportFunction,Store,Memory) across the WASM loader and WASM plugin/handler abstractions. - Add TinyGo “wasmabi” helper package plus multiple TinyGo test WASM modules and integrate them into JUnit tests to validate real WASM execution on CI.
- Update build/dependency metadata and release license docs to remove wasmtime artifacts and include Chicory artifacts.
Reviewed changes
Copilot reviewed 41 out of 51 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| shenyu-plugin/shenyu-plugin-wasm-api/src/main/java/org/apache/shenyu/plugin/wasm/api/loader/WasmLoader.java | Replaces wasmtime-based loader with Chicory; adds WASI stubs, runtime compilation attempt, and export lookup. |
| shenyu-plugin/shenyu-plugin-wasm-api/src/main/java/org/apache/shenyu/plugin/wasm/api/AbstractWasmPlugin.java | Switches WASM function invocation to Chicory ExportFunction.apply(...). |
| shenyu-plugin/shenyu-plugin-wasm-base/src/main/java/org/apache/shenyu/plugin/wasm/base/AbstractShenyuWasmPlugin.java | Switches WASM execution path to Chicory; exposes Memory instead of ByteBuffer; adds initializer-based constructor. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/main/java/org/apache/shenyu/plugin/wasm/base/handler/AbstractWasmPluginDataHandler.java | Migrates handler invocation from wasmtime consumers to Chicory ExportFunction.apply(...). |
| shenyu-plugin/shenyu-plugin-wasm-base/src/main/java/org/apache/shenyu/plugin/wasm/base/handler/AbstractWasmMetaDataHandler.java | Migrates metadata handler invocation to Chicory and updates refresh call. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/main/java/org/apache/shenyu/plugin/wasm/base/handler/AbstractWasmDiscoveryHandler.java | Migrates discovery handler invocation to Chicory. |
| shenyu-plugin/shenyu-plugin-wasm-api/pom.xml | Replaces wasmtime-java dependency with Chicory runtime/compiler (+ wasi currently declared). |
| shenyu-plugin/shenyu-plugin-wasm-api/src/test/java/org/apache/shenyu/plugin/wasm/api/AbstractWasmPluginTest.java | Converts tests to execute real Rust + Go WASM and validate shared-memory ABI via Chicory Memory. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/java/org/apache/shenyu/plugin/wasm/base/AbstractShenyuWasmPluginTest.java | Converts base WASM plugin tests to execute real Rust + Go WASM and validate host-function wiring. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/java/org/apache/shenyu/plugin/wasm/base/handler/AbstractWasmPluginDataHandlerTest.java | Executes real Rust + Go handler WASM; validates get_args/put_result shared-memory flow. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/java/org/apache/shenyu/plugin/wasm/base/handler/AbstractWasmMetaDataHandlerTest.java | Executes real Rust + Go metadata handler WASM; validates shared-memory flow. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/java/org/apache/shenyu/plugin/wasm/base/handler/AbstractWasmDiscoveryHandlerTest.java | Executes real Rust + Go discovery handler WASM; validates shared-memory flow. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/pkg/wasmabi/go.mod | Adds TinyGo ABI helper module definition for tests. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/pkg/wasmabi/abi.go | Adds TinyGo ABI helpers (GetArgs/PutResult) and WASI stderr printing helper. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/go-shenyu-wasm-plugin/README.md | Documents building TinyGo WASM for AbstractShenyuWasmPlugin test. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/go-shenyu-wasm-plugin/Makefile | Automates TinyGo build and resource copy for AbstractShenyuWasmPlugin Go WASM. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/go-shenyu-wasm-plugin/main.go | TinyGo WASM module exporting doExecute/before/after for base plugin test. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/go-shenyu-wasm-plugin/go.mod | TinyGo module definition for the base plugin Go WASM test module. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/go-plugin-data-handler/README.md | Documents building TinyGo WASM for plugin data handler test. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/go-plugin-data-handler/Makefile | Automates TinyGo build and resource copy for plugin data handler Go WASM. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/go-plugin-data-handler/main.go | TinyGo WASM module exporting handler/remove functions for plugin data handler test. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/go-plugin-data-handler/go.mod | TinyGo module definition for plugin data handler Go WASM test module. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/go-meta-data-handler/README.md | Documents building TinyGo WASM for metadata handler test. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/go-meta-data-handler/Makefile | Automates TinyGo build and resource copy for metadata handler Go WASM. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/go-meta-data-handler/main.go | TinyGo WASM module exporting handle/remove/refresh for metadata handler test. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/go-meta-data-handler/go.mod | TinyGo module definition for metadata handler Go WASM test module. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/go-discovery-handler/README.md | Documents building TinyGo WASM for discovery handler test. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/go-discovery-handler/Makefile | Automates TinyGo build and resource copy for discovery handler Go WASM. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/go-discovery-handler/main.go | TinyGo WASM module exporting discovery handler function for test. |
| shenyu-plugin/shenyu-plugin-wasm-base/src/test/go-discovery-handler/go.mod | TinyGo module definition for discovery handler Go WASM test module. |
| shenyu-plugin/shenyu-plugin-wasm-api/src/test/go-wasm-plugin/README.md | Documents building TinyGo WASM for AbstractWasmPlugin test. |
| shenyu-plugin/shenyu-plugin-wasm-api/src/test/go-wasm-plugin/Makefile | Automates TinyGo build and resource copy for AbstractWasmPlugin Go WASM. |
| shenyu-plugin/shenyu-plugin-wasm-api/src/test/go-wasm-plugin/main.go | TinyGo WASM module exporting execute/before/after for API plugin test. |
| shenyu-plugin/shenyu-plugin-wasm-api/src/test/go-wasm-plugin/go.mod | TinyGo module definition for API plugin Go WASM test module. |
| shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/LICENSE | Updates third-party component list to include Chicory and remove wasmtime-related entries. |
| shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/licenses/LICENSE-wasmtime.txt | Removes wasmtime license text from release docs. |
| shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/licenses/LICENSE-wasmtime-wasi.txt | Removes wasmtime-wasi license text from release docs. |
| shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/licenses/LICENSE-wasi-common.txt | Removes wasi-common license text from release docs. |
| shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/licenses/LICENSE-wasi-cap-std-sync.txt | Removes wasi-cap-std-sync license text from release docs. |
| shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/licenses/LICENSE-jni-rs.txt | Removes jni-rs license text from release docs. |
| pom.xml | Adds Chicory version + dependency management entries; adjusts RAT exclusions for WASM build artifacts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 41 out of 51 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/licenses/LICENSE-chicory.txt:6
- This LICENSE file omits the Apache 2.0 appendix while still containing text that references it ("an example is provided in the Appendix below"). That makes the license text internally inconsistent and may cause release compliance checks to fail; either include the full standard Apache 2.0 license text (including appendix) or remove/adjust references accordingly.
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.
fix #6353
wasmtime-java is no longer actively maintained — no recent releases or commits. As a native-library-dependent runtime, it also introduces platform coupling and deployment friction. This PR replaces it with Chicory, an actively maintained pure-Java WASM runtime (Apache 2.0), eliminating both the maintenance risk and native dependencies.
compilermodule usesMachineFactoryCompilerto translate WASM bytecode into JVM bytecode at module load time, significantly improving execution performance over interpreter-only mode. Falls back gracefully to the interpreter if compilation is unavailable.wasmabiGo package (src/test only) to simplifywasm test module communication with the Java host, enabling Go-based WASM plugin development alongside existing Rust support. All test suites now verify both Go and Rust
.wasmoutputs.Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true.