Skip to content

Please enable WasmGC #71

@lukehutch

Description

@lukehutch

Wasmtime has supported WasmGC for over a year and a half now: https://bytecodealliance.org/articles/wasmtime-27.0

Can this please be enabled in wasm_run? It quite dramatically expands the set of languages that can run on wasm.

wasm_run-0.1.0+2/native/src/config.rs:

  1. WasmFeatures::supported() - Lines 491-521

  pub fn supported() -> WasmFeatures {
      #[cfg(feature = "wasmtime")]
      {
          return WasmFeatures {
              // ... enabled features ...
              simd: true,
              relaxed_simd: true,
              threads: true,
              multi_memory: true,
              memory64: true,
              // Unsupported
              component_model: false, // Feature
              garbage_collection: false,  // <-- HERE
              exceptions: false,
              tail_call: false,
              // ...
          };
      }
  }

  2. WasmFeatures::default() - Lines 427-459

  pub fn default() -> WasmFeatures {
      #[cfg(feature = "wasmtime")]
      {
          return WasmFeatures {
              // ...
              // Unsupported
              component_model: false,
              garbage_collection: false,  // <-- HERE
              tail_call: false,
              exceptions: false,
              // ...
          };
      }
  }

  3. ModuleConfig::wasm_features() - Lines 558-596

  pub fn wasm_features(&self) -> WasmFeatures {
      #[cfg(feature = "wasmtime")]
      {
          return WasmFeatures {
              // ...
              // Unsupported
              component_model: false,
              garbage_collection: false,  // <-- HERE
              tail_call: false,
              exceptions: false,
              // ...
          };
      }
  }

  4. Missing from ModuleConfigWasmtime - Lines 285-325

  The ModuleConfigWasmtime struct has no field for GC:
  pub struct ModuleConfigWasmtime {
      pub wasm_threads: Option<bool>,
      pub wasm_simd: Option<bool>,
      pub wasm_relaxed_simd: Option<bool>,
      pub wasm_multi_memory: Option<bool>,
      pub wasm_memory64: Option<bool>,
      // HERE: no wasm_gc field
  }

  5. Missing from wasmtime config conversion - Lines 167-206

  The From<ModuleConfig> for wasmtime::Config impl doesn't call config.wasm_gc():
  impl From<ModuleConfig> for wasmtime::Config {
      fn from(c: ModuleConfig) -> Self {
          let mut config = Self::new();
          // ... other options ...
          wtc.wasm_threads.map(|v| config.wasm_threads(v));
          wtc.wasm_simd.map(|v| config.wasm_simd(v));
          // HERE: no config.wasm_gc(true)
      }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions