-
Notifications
You must be signed in to change notification settings - Fork 291
Description
With a significant amount of effort I was able to write ‘hello world‘ in Kotlin and run it on Spin! Hooray!
One major roadblock I faced was Spin’s lack of support for 4 opt-in features in Wasmtime:
WasmFeatures::GC
WasmFeatures::REFERENCE_TYPES
WasmFeatures::EXCEPTIONS
WasmFeatures::FUNCTION_REFERENCESI was able to get it working locally by changing Spin’s Wasmtime configuration. I enabled the required features in crates/core/src/lib.rs:
impl Default for Config {
fn default() -> Self {
let mut inner = wasmtime::Config::new();
inner.async_support(true);
inner.epoch_interruption(true);
inner.wasm_component_model(true);
inner.wasm_component_model_async(true);
+ inner.wasm_gc(true);
+ inner.wasm_reference_types(true);
+ inner.wasm_exceptions(true);
+ inner.wasm_function_references(true);
// If targeting musl, disable native unwind to address this issue:REFERENCE_TYPES is in WasmFeatures::WASM2, and the other ones are in WasmFeatures::WASM3.
I need this capability to run Kotlin programs in Spin. I expect other languages would similarly benefit from their availability.
One solution would be to let me opt-in to Wasm features in my spin.toml:
[component.rounds-experimental]
source = "rounds-experimental.wasm"
allowed_outbound_hosts = []
require_wasm_features = ["gc", "reference_types", "exceptions", "function_references"]
An alternate solution would be for Spin to automatically inspect my .wasm file and enable the Wasmtime features required to run my app. Perhaps it could issue a warning if any experimental features are used.
If you’d like me to submit a PR to implement this behaviour, I’d be quite happy to. But I won’t proceed without your blessing. You all might have better ideas!