Skip to content

Engine.new doesn't expose wasm_exceptions #598

@takahashim

Description

@takahashim

wasmtime::Config has a wasm_exceptions(bool) method (gated on the default-enabled gc feature, so it's built into the released gem), but it isn't surfaced as a keyword on Wasmtime::Engine.new.
Any module that uses the exception-handling proposal fails to even parse, with no way to opt in from Ruby.

This affects all wasm produced by clang with -mllvm -wasm-enable-sjlj (the standard recipe for <setjmp.h> in wasm).
A single setjmp call in the source is enough to pull in EH instructions.

How to reproduce

require "wasmtime"

WAT = <<~WAT
  (module
    (tag $e)
    (func (export "raise")
      throw $e))
WAT

def attempt(label, **cfg)
  Wasmtime::Module.new(Wasmtime::Engine.new(**cfg), WAT)
  puts "#{label}: OK"
rescue => e
  puts "#{label}: #{e.class}: #{e.message}"
end

attempt("without options      ")
attempt("wasm_exceptions: true", wasm_exceptions: true)
$ ruby repro.rb
without options      : Wasmtime::Error: Could not build module: failed to parse WebAssembly module
wasm_exceptions: true: ArgumentError: Unknown option: :wasm_exceptions

Line 1 — engine refuses to parse the module (expected: EH is off by default).
Line 2 — no Ruby-side knob to turn it on.

Environment

  • wasmtime gem: 44.0.0
  • Ruby: 3.4.8
  • Platform: arm64-darwin (also reproducible on x86_64-linux)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions