Skip to content

[type:refactor] replace inactive wasmtime-java with chicory pure-Java WASM runtime#6356

Open
eye-gu wants to merge 6 commits into
apache:masterfrom
eye-gu:fix-6353
Open

[type:refactor] replace inactive wasmtime-java with chicory pure-Java WASM runtime#6356
eye-gu wants to merge 6 commits into
apache:masterfrom
eye-gu:fix-6353

Conversation

@eye-gu
Copy link
Copy Markdown
Contributor

@eye-gu eye-gu commented Jun 3, 2026

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.

  • Runtime compilation: Chicory's compiler module uses MachineFactoryCompiler to 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.
  • TinyGo support: Added internal test helper wasmabi Go package (src/test only) to simplify
    wasm 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 .wasm outputs.

Make sure that:

  • You have read the contribution guidelines.
  • You submit test cases (unit or integration tests) that back your changes.
  • Your local test passed ./mvnw clean install -Dmaven.javadoc.skip=true.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread shenyu-plugin/shenyu-plugin-wasm-base/src/test/pkg/wasmabi/abi.go
Comment thread shenyu-plugin/shenyu-plugin-wasm-base/src/test/pkg/wasmabi/abi.go
Comment thread shenyu-plugin/shenyu-plugin-wasm-api/pom.xml
Comment thread pom.xml
Comment thread shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/LICENSE
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread shenyu-plugin/shenyu-plugin-wasm-base/src/test/pkg/wasmabi/abi.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace Wasmtime-Java (native) with Chicory (pure-Java) WASM runtime

2 participants